Skip to content

Instantly share code, notes, and snippets.

@mattn
Forked from xaicron/gist:304564
Created February 15, 2010 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/304597 to your computer and use it in GitHub Desktop.
Save mattn/304597 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Encode;
use Gtk2 -init;
my $data = decode_utf8 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__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment