PM/Clip.pm
Difrex(Denis Zheleztsov) a634700cf3 Clipboard module
2014-04-28 16:12:07 +04:00

29 lines
470 B
Perl

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;