In my iPhoto shell, I made a "reload" command that re-exec-ed the script. I could make changes and simply reload right from the shell prompt. I kinda liked the feature, although it doesn't add much value over re-running the command.
However, once I use some AppleScript (or, I guess, AppleEvents) through Mac::Glue, it breaks. I cannot exec anymore. I can run things in subshells though. Whatever causes this happens after the first interaction. Simply loading a glue does not do anything.
I had a really short example of this, but I somehow messed up the simple operation of putting it on my key drive.
Re:Example
brian_d_foy on 2004-02-28T10:14:10
Found it...#!/usr/bin/perl
print "This is stdout\n";
print STDERR "This is stderr\n";
print "Load Mac::Glue? [y/n] ";
chomp( my $answer = <STDIN> );
if( $answer =~ m/y/ )
{
require Mac::Glue;
die "Could not load Mac::Glue: $@" if $@;
my $iPhoto = Mac::Glue->new( 'iPhoto' );
print "Talk to iPhoto? [y/n] ";
chomp( my $answer = <STDIN> );
if( $answer =~ m/y/ )
{
my $current = $iPhoto->prop( "current album" )->prop( "name" )->get;
print "Current album is $current\n";
print "I expect to see an exec error now, with `uname` output\n",
"but not exec 'date' output\n"
}
else
{
print "You should see the output of `uname` and exec 'date'\n"
}
}
print `uname`;
exec "/bin/date";
die "Could not exec! $!";Re:Example
pudge on 2004-03-04T04:04:43
I run this and get:I presume you expected it to die, not print the date? I am sorry to disappoint! What's your perl -V, and module versions?[pudge@bourque Desktop]$ perl foo.plx
This is stdout
This is stderr
Load Mac::Glue? [y/n] y
Talk to iPhoto? [y/n] y
Current album is Photo Library
I expect to see an exec error now, with `uname` output
but not exec 'date' output
Darwin
Wed Mar 3 20:01:49 PST 2004Re:Example
brian_d_foy on 2004-03-04T12:37:04
oh well, I'll think about it when I get home and update everything.Re:Example
pudge on 2004-03-04T15:41:07
When do you get home?Re:Example
brian_d_foy on 2004-03-05T13:49:11
Sometime after I leave here.