From a634700cf3b1e9f82984cb258209c49d4b04f899 Mon Sep 17 00:00:00 2001 From: "Difrex(Denis Zheleztsov)" Date: Mon, 28 Apr 2014 16:12:07 +0400 Subject: [PATCH] Clipboard module --- Clip.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Clip.pm diff --git a/Clip.pm b/Clip.pm new file mode 100644 index 0000000..a6017e8 --- /dev/null +++ b/Clip.pm @@ -0,0 +1,28 @@ +package Clip; + +use Clipboard; + +sub new { + my $class = shift; + + my $self = { _password => shift, }; + + bless $self, $class; + return $self; +} + +sub copy { + my ($self) = @_; + my $password = $self->{_password}; + + if ( 'Clipboard::Xclip' eq $Clipboard::driver ) { + no warnings 'redefine'; + *Clipboard::Xclip::all_selections = sub { + qw(clipboard primary buffer secondary); + }; + } + + Clipboard->copy("$password"); +} + +1;