2014-04-29 15:45:31 +04:00
|
|
|
package ClipPass;
|
2014-04-28 16:12:07 +04:00
|
|
|
|
|
|
|
use Clipboard;
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
|
2014-05-06 00:40:26 +04:00
|
|
|
my $self = {};
|
2014-04-28 16:12:07 +04:00
|
|
|
|
|
|
|
bless $self, $class;
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub copy {
|
2014-05-06 00:40:26 +04:00
|
|
|
my ( $self, $password ) = @_;
|
2014-04-28 16:12:07 +04:00
|
|
|
|
|
|
|
if ( 'Clipboard::Xclip' eq $Clipboard::driver ) {
|
|
|
|
no warnings 'redefine';
|
|
|
|
*Clipboard::Xclip::all_selections = sub {
|
|
|
|
qw(clipboard primary buffer secondary);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Clipboard->copy("$password");
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|