Stupid Mac::Glue Tricks

| | Comments (0)
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:

#!/bin/sh
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'

use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on November 19, 2003 3:12 PM.

cenotaph-1.4 Released was the previous entry in this site.

Stupid Mac::Glue/SSH Tricks is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.