Mac-PopClip-Quick
view release on metacpan or search on metacpan
# NAME
Mac::PopClip::Quick - quickly write PopClip extensions in Perl
# SYNOPSIS
First write a script:
#!/usr/bin/perl
use 5.012;
use warnings;
use autodie;
use Mac::PopClip::Quick;
use POSIX qw(strftime);
open my $fh, ''>>:utf8', "$ENV{HOME}/Dropbox/runlog.txt";
say $fh strftime("%FT%T",gmtime) . ' ' . popclip_text();
Then install it as a PopClip Extension
bash$ INSTALL_POPCLIP_EXTENSION=1 ./runlog.pl
# DESCRIPTION
PopClip For Mac is a commercial OS X utility from Pilotmoon Software that
creates little popup menus when you highlight text. Please see
[http://pilotmoon.com/popclip/](http://pilotmoon.com/popclip/) for more details.
This module make it easier to write PopClip extensions in Perl. With this
module you can turn a simple Perl script into an installable extension with a
single command.
The resulting extension does not depend on the Mac::PopClip::Quick module, and
can be safely distributed to systems that do not have this module installed.
## Examples
In your script you should `use Mac::PopClip::Quick`.
#!/usr/bin/perl
use Mac::PopClip::Quick;
system('say','The selected text is '.popclip_text());
From the command line you simply need to execute the script with the
`INSTALL_POPCLIP_EXTENSION` environment variable set to a true value.
bash$ INSTALL_POPCLIP_EXTENSION=1 ./reverse.pl
You can also create an executable suitable for distribution using the
bash$ CREATE_POPCLIP_EXTENSION=1 ./reverse.pl
Options can be set by passing them in the `use` statement:
use Mac::PopQuick::Quick (
extension_identifier => 'com.yourdomain.extensionname',
);
They'll be passed through to the underlying [Mac::PopClip::Quick::Generator](https://metacpan.org/pod/Mac::PopClip::Quick::Generator)
class's constructor.
You can use `after_action` to control what your extension does with the
script output, for example pasting it:
use Mac::PopQuick::Quick (
extension_name => 'Reverse Text',
after_action => 'paste-result',
);
print reverse popclip_text();
# Supported Options
## Core Options
### extension\_name
The name of the extension. By default this is the name of the script, minus
any file extension (e.g. if your script if called `foo.pl` then the extension
will be called `foo` by default.)
### title
The title. By default, the same as the `extension_name`.
### filename
( run in 1.041 second using v1.01-cache-2.11-cpan-364913b4093 )