JavaScript-Bookmarklet
view release on metacpan or search on metacpan
bin/make-bookmarklet view on Meta::CPAN
use warnings;
use open IO => ":utf8", # UTF8 by default
":std"; # Apply to STDIN/STDOUT/STDERR
use JavaScript::Bookmarklet qw(make_bookmarklet);
my $src = do { local $/; <> };
my $bookmarklet = make_bookmarklet($src);
print $bookmarklet;
eval {
system("/bin/echo -n '$bookmarklet' | /usr/bin/pbcopy")
; # put bookmarklet on clipboard.
};
warn "Bookmarklet code not be placed in your clipboard: $@" if $@;
__END__
=head1 NAME
make-bookmarklet - a command-line script that transforms
human-readable JavaScript code into bookmarklet form.
=head1 DESCRIPTION
This script will attempt to copy the bookmarklet code to
your desktop clipboard using pbcopy if possible. A warning
will be issued if it cannot regardless of the availablity of
pbcopy, the bookmarklet code will be output.
=head1 USAGE
make-bookmarklet < example.js
=head1 SUPPORT
Bugs should be reported via the CPAN bug tracker at
( run in 3.311 seconds using v1.01-cache-2.11-cpan-2398b32b56e )