Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Wednesday November 19, 2003
06:12 PM

Stupid Mac::Glue Tricks

[ #15885 ]

I find one-liners in Mac::Glue to be annoying.

perl -MMac::Glue=:all -le '$itunes = new Mac::Glue "iTunes"; print $itunes->prop("player state")->get'

It's a mouthful, and mostly boilerplate. So how about this little shell script? Standardize on one glue var name, $g, and suck in Data::Dumper, which I commonly use, and:

perl -MMac::Glue=:all -MData::Dumper -l -e 'splice(@ARGV, 1, 1); $g = new Mac::Glue shift;$g->ERRORS(1);' -e "$2" "$@"

Now I can do:

glue iTunes 'print $g->prop("player state")->get'

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.