Created
February 15, 2010 11:19
-
-
Save xaicron/304564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Encode qw/decode/; | |
use Gtk2 -init; | |
use Pod::Usage qw/pod2usage/; | |
use opts; | |
opts | |
my $encoding => { isa => 'Str', default => 'utf8' }, | |
my $help => { isa => 'Bool' }, | |
; | |
pod2usage 1 if $help; | |
my $data = decode $encoding, do { local $/; <STDIN> } || ''; | |
&main();exit; | |
sub main() { | |
my $clip = Gtk2::Clipboard->get(Gtk2::Gdk->SELECTION_CLIPBOARD); | |
$clip->set_text($data); | |
$clip->store; | |
Gtk2->main_iteration_do(1) if $^O eq 'MSWin32'; | |
} | |
__END__ | |
=head1 NAME | |
pclip - save clipboard for Gtk2 | |
=head1 SYNOPSIS | |
cat file | pclip [--encoding encoding --help] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment