view release on metacpan or search on metacpan
- Fixed the MSWin32 OS string. Oops - I thought it was winSomething
- Added a few more OS strings
- clipaccumulate, the most obscure script in the batch!
0.07 2005-06-02
- fixed stupid typo in clipedit. Not sure how I let this slip by me. =\
0.06 2005-06-01
- `editclip`, sure to be a celebrated entry in the world of clipboard editing!
- Renamed `joinclip` to `clipjoin`, and `browseclip` to `clipbrowse`. Sorry
if you already are in the habit of typing the others (I still am).
- `clipbrowse` now opens URLs into a new tab.
{
"abstract" : "Copy and paste with any OS",
"author" : [
"Shlomi Fish <shlomif@cpan.org>"
],
"dynamic_config" : 1,
"generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010",
"keywords" : [
"clipboard",
"copy",
"paste"
],
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "ExecDir",
"version" : "6.032"
},
{
"class" : "Dist::Zilla::Plugin::Keywords",
"config" : {
"Dist::Zilla::Plugin::Keywords" : {
"keywords" : [
"clipboard",
"copy",
"paste"
]
}
},
"name" : "Keywords",
"version" : "0.007"
},
{
"class" : "Dist::Zilla::Plugin::OSPrereqs",
- 'Shlomi Fish <shlomif@cpan.org>'
build_requires:
Module::Build: '0.28'
Test::More: '0.88'
lib: '0'
configure_requires:
Module::Build: '0.28'
dynamic_config: 1
generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010'
keywords:
- clipboard
- copy
- paste
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Clipboard
provides:
Clipboard:
file: lib/Clipboard.pm
version: '6.032'
-
class: Dist::Zilla::Plugin::ExecDir
name: ExecDir
version: '6.032'
-
class: Dist::Zilla::Plugin::Keywords
config:
Dist::Zilla::Plugin::Keywords:
keywords:
- clipboard
- copy
- paste
name: Keywords
version: '0.007'
-
class: Dist::Zilla::Plugin::OSPrereqs
config:
Dist::Zilla::Plugin::OSPrereqs:
os: '~darwin'
name: '~darwin'
README.mkdn view on Meta::CPAN
# Same as copy on non-X / non-Xclip systems
Clipboard->copy_to_all_selections('text_to_copy');
Clipboard->cut() is an alias for copy(). copy() is the preferred
method, because we're not really "cutting" anything.
# DESCRIPTION
Who doesn't remember the first time they learned to copy and paste, and
generated an exponentially growing text document? Yes, that's right,
clipboards are magical.
With Clipboard.pm, this magic is now trivial to access,
in a cross-platform-consistent API, from your Perl code.
# STATUS
Seems to be working well for Linux, OSX, \*BSD, and Windows. I use it
every day on Linux, so I think I've got most of the details hammered out
(X selections are kind of weird). Please let me know if you encounter
any problems in your setup.
README.mkdn view on Meta::CPAN
[http://matrix.cpantesters.org/?dist=Clipboard](http://matrix.cpantesters.org/?dist=Clipboard)
- CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
[http://deps.cpantesters.org/?module=Clipboard](http://deps.cpantesters.org/?module=Clipboard)
## Bugs / Feature Requests
Please report any bugs or feature requests by email to `bug-clipboard at rt.cpan.org`, or through
the web interface at [https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard](https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard). You will be automatically notified of any
progress on the request by the system.
## Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
[https://github.com/shlomif/Clipboard](https://github.com/shlomif/Clipboard)
#!/bin/sh
# Useful for exploring the way X selections work.
# For example, run watch -n1 pxclip in one xterm, then highlight something in
# another. Now single-click in the xterm to remove the highlighting. Now
# highlight something in Firefox. Now highlight something in the xterm again.
# Now switch back to Firefox, and hit ^C.
# Weird, huh?
for n in primary secondary clipboard buffer; do
echo "== $n =="
xclip -o -selection "$n"
echo
done
echo "== Clipboard.pm default =="
perl -Ilib -MClipboard -e "print Clipboard->paste"
echo
#!/usr/bin/perl
# Basic acceptance test. I didn't want to put anything that messes with the
# real clipboard into t/ in case it ends up inadvertently messing up someones
# selection, somehow.
use strict;
use warnings;
use lib 'lib';
use Clipboard;
my $save = Clipboard->paste;
print "Original: ", Clipboard->paste, "\n";
Clipboard->copy('looks like Clipboard->copy works');
print " Now: ", Clipboard->paste, "\n";
Clipboard->copy($save);
print "(Restored original clipboard)\n"
-remove = Readme
-remove = Test::Compile
dist = Clipboard
github_name = Clipboard
[AutoPrereqs]
skip = ^Mac::Pasteboard$
skip = ^Win32::Clipboard$
[ExecDir]
dir = scripts
[Keywords]
keyword = clipboard
keyword = copy
keyword = paste
[OSPrereqs / ~darwin]
Mac::Pasteboard = 0.011
[OSPrereqs / MSWin32]
Win32::Clipboard = 0
[OSPrereqs / cygwin]
Win32::Clipboard = 0
[ReadmeMarkdownFromPod]
; [Test::TidyAll]
lib/Clipboard.pm view on Meta::CPAN
sub cut { goto © }
sub paste { my $self = shift; return $driver->paste(@_); }
sub bind_os { my $driver = shift; return map { $_ => $driver } @_; }
sub find_driver {
my $self = shift;
my $os = shift;
my %drivers = (
# list stolen from Module::Build, with some modifications (for
# example, cygwin doesn't count as Unix here, because it will
# use the Win32 clipboard.)
bind_os(Xsel => qw(linux bsd$ aix bsdos dec_osf dgux
dynixptx gnu hpux irix dragonfly machten next os2 sco_sv solaris
sunos svr4 svr5 unicos unicosmk)),
bind_os(Xclip => qw(linux bsd$ aix bsdos dec_osf dgux
dynixptx gnu hpux irix dragonfly machten next os2 sco_sv solaris
sunos svr4 svr5 unicos unicosmk)),
#bind_os(WaylandClipboard => qw(linux)), # Do not uncomment this line...
bind_os(MacPasteboard => qw(darwin)),
);
lib/Clipboard.pm view on Meta::CPAN
# Same as copy on non-X / non-Xclip systems
Clipboard->copy_to_all_selections('text_to_copy');
Clipboard->cut() is an alias for copy(). copy() is the preferred
method, because we're not really "cutting" anything.
=head1 DESCRIPTION
Who doesn't remember the first time they learned to copy and paste, and
generated an exponentially growing text document? Yes, that's right,
clipboards are magical.
With Clipboard.pm, this magic is now trivial to access,
in a cross-platform-consistent API, from your Perl code.
=head1 STATUS
Seems to be working well for Linux, OSX, *BSD, and Windows. I use it
every day on Linux, so I think I've got most of the details hammered out
(X selections are kind of weird). Please let me know if you encounter
any problems in your setup.
lib/Clipboard.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
lib/Clipboard/MacPasteboard.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
lib/Clipboard/WaylandClipboard.pm view on Meta::CPAN
my @cmd_parts = qw(wl-paste --no-newline);
push(@cmd_parts, '--primary') if ($selection eq 'primary');
push(@cmd_parts, '|');
my $cmd = join(' ', @cmd_parts);
open my $exe, $cmd or die "Couldn't run `$cmd`: $!\n";
my $result = do { local $/; <$exe> };
close $exe or die "Error closing `$cmd`: $!";
return $result;
}
# "regular" isn't directly used in this code (it is the wl-clipboard default)
sub all_selections { qw( regular primary ) }
sub favorite_selection { my $self = shift; ($self->all_selections)[0] }
sub available {
# close STDERR
open my $olderr, '>&', \*STDERR;
close STDERR;
open STDERR, '>', File::Spec->devnull;
my $open_retval = open my $just_checking, 'wl-copy --version |';
lib/Clipboard/WaylandClipboard.pm view on Meta::CPAN
close STDERR;
open STDERR, '>&', $olderr;
close $olderr;
return $open_retval;
}
{
available() or warn <<'EPIGRAPH';
Can't find the 'wl-copy' program from the wlâclipboard package.
Clipboard.pm's Wayland support depends on it.
Here's the project homepage: https://github.com/bugaevc/wl-clipboard
EPIGRAPH
}
1;
__END__
=pod
lib/Clipboard/WaylandClipboard.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
lib/Clipboard/Win32.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
lib/Clipboard/Xclip.pm view on Meta::CPAN
sub paste_from_selection {
my $self = shift;
my ($selection) = @_;
my $cmd = "xclip -o -selection $selection|";
open my $exe, $cmd or die "Couldn't run `$cmd`: $!\n";
my $result = do { local $/; <$exe> };
close $exe or die "Error closing `$cmd`: $!";
return $result;
}
# This ordering isn't officially verified, but so far seems to work the best:
sub all_selections { qw(primary buffer clipboard secondary) }
sub favorite_selection { my $self = shift; ($self->all_selections)[0] }
sub xclip_available {
# close STDERR
open my $olderr, '>&', \*STDERR;
close STDERR;
open STDERR, '>', File::Spec->devnull;
my $open_retval = open my $just_checking, 'xclip -o|';
lib/Clipboard/Xclip.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
lib/Clipboard/Xsel.pm view on Meta::CPAN
sub paste_from_selection {
my $self = shift;
my ($selection) = @_;
my $cmd = "xsel -o --$selection|";
open my $exe, $cmd or die "Couldn't run `$cmd`: $!\n";
my $result = do { local $/; <$exe> };
close $exe or die "Error closing `$cmd`: $!";
return $result;
}
# This ordering isn't officially verified, but so far seems to work the best:
sub all_selections { qw(primary buffer clipboard secondary) }
sub favorite_selection { my $self = shift; ($self->all_selections)[0] }
sub xsel_available {
# close STDERR
open my $olderr, '>&', \*STDERR;
close STDERR;
open STDERR, '>', File::Spec->devnull;
my $open_retval = open my $just_checking, 'xsel -o|';
lib/Clipboard/Xsel.pm view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
scripts/clipaccumulate view on Meta::CPAN
# PODNAME: clipaccumulate
use strict;
use warnings;
use Clipboard;
my $END_STRING = 'endEndENDenDend';
my $should_quit = 0;
my $prev = Clipboard->paste;
my $total = '';
warn "To exit, hit ^C, or copy this string into the clipboard: $END_STRING\n";
$SIG{INT} = sub { $should_quit = 1 };
while (1) {
my $cur = Clipboard->paste;
$should_quit = 1 if $cur eq $END_STRING;
last if $should_quit;
if ($prev ne $cur) {
print $cur, ' ';
$total .= $cur . ' ';
}
$prev = $cur;
scripts/clipaccumulate view on Meta::CPAN
}
__END__
=pod
=encoding UTF-8
=head1 NAME
clipaccumulate - Make a bunch of little clipboards into one big one.
=head1 VERSION
version 0.32
=head1 USAGE
The first thing it says (which goes to STDERR, so you can redirect into a file
if you want), is how to exit, which is by copying the magic "end" string into
the clipboard. Crufty? Yep. You can still do Ctrl+C if you don't like this
(or if the string scrolls off the top of the screen).
The next thing it does is wait for the clipboard to change, at which point it
will print out the new data and go back to waiting for the clipboard to
change.
Then you copy the exit string, and it will fill the clipboard with all the
little pieces it saw along the way.
(Right now, it just joins everything with spaces in between - is this bugging
anyone?)
=head1 MOTIVATION
Hard to explain. I run into cases where I wanted to make a bunch of small
notes that included all these different bits of info. Instead of jotting them
down on a scrap of paper, I made this.
scripts/clipaccumulate view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
scripts/clipbrowse view on Meta::CPAN
system(sprintf $browser, $query);
__END__
=pod
=encoding UTF-8
=head1 NAME
clipbrowse - Load a URL from the clipboard into your browser.
=head1 VERSION
version 0.32
=head1 USAGE
# ...copy something
# (You might want to do a `clipjoin` if the URL text is messy)
$ clipbrowse
Remember that many browsers will usefully load things that don't look like
URL's. For example Firefox does a Google "I'm feeling lucky" with non-URLs.
This means you can have any text in your clipboard and `clipbrowse`.
=head1 MOTIVATION
It saves a couple of seconds every time you run it. Chrome and Firefox, for
examples, automatically create a new tab and loads the page when you invoke it
from the command line. Already we've saved a Ctrl+T and a Shift+Insert. When
you consider the parallelizing (that your browser will be actively loading the
page while you're Alt+Tabbing to it), you've squeaked out a little more.
Maybe I'm just a freak, but I like shaving out wasted time like that.
scripts/clipbrowse view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
scripts/clipedit view on Meta::CPAN
}
__END__
=pod
=encoding UTF-8
=head1 NAME
clipedit - Edit clipboard contents in one swoop.
=head1 VERSION
version 0.32
=head1 MOTIVATION
Eliminating the "Open editor, edit stuff, copy back to the clipboard" shuffle.
=head1 NOTE
If for some reason the clipboard contents changes during the edit session, you
will be prompted to choose between 1) the original Clipboard contents, 2) the
new Clipboard contents, and 3) the result of your edits (which is the default
if you just hit "Enter").
=head1 CONFIGURATION
If you don't want the script to use C<vim> to edit, set either the
environment variable C<$VISUAL> or C<$EDITOR>.
=head1 AUTHOR
scripts/clipedit view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
scripts/clipfilter view on Meta::CPAN
use strict;
use warnings;
use Clipboard;
my %methods = (
-html => sub { require CGI; CGI::escapeHTML($_[0]) },
-uri => sub { require URI::Escape; URI::Escape::uri_escape($_[0]) },
);
my $result = filter($ARGV[0], Clipboard->paste);
Clipboard->copy($result);
print $result, "\n... is now in the clipboard.\n";
sub filter {
my ($method, $data) = @_;
if (exists $methods{$method}) {
return $methods{$method}->($data);
} else {
require IPC::Open2;
my ($child_out, $child_in);
my $cmd_text = join ' ', @ARGV; # just for error message output
my $pid = IPC::Open2::open2($child_out, $child_in, @ARGV)
scripts/clipfilter view on Meta::CPAN
}
__END__
=pod
=encoding UTF-8
=head1 NAME
clipfilter - Run various conversions for your clipboard data.
=head1 VERSION
version 0.32
=head1 USAGE
# (copy some stuff)
$ clipfilter -html
# (paste, with html entities substituted in)
scripts/clipfilter view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>
scripts/clipjoin view on Meta::CPAN
unless $ARGV[0] eq '-q';
__END__
=pod
=encoding UTF-8
=head1 NAME
clipjoin - Remove superfluous spaces from the clipboard.
=head1 VERSION
version 0.32
=head1 MOTIVATION
Often you'll copy some stuff, like this:
<ingy> hey rking, you should use YBFOD: http://search.cpan
scripts/clipjoin view on Meta::CPAN
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
L<http://deps.cpantesters.org/?module=Clipboard>
=back
=head2 Bugs / Feature Requests
Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Clipboard>