Stories
Slash Boxes
Comments
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 ]

Saturday February 21, 2004
12:03 PM

Mac::Glue and exec

[ #17542 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Yeah, gimme an example. And it's "Apple events", FWIW: upcase Apple, downcase events, two words.
    • 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/ )

      • I run this and get:
        [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 2004
        I presume you expected it to die, not print the date? I am sorry to disappoint! What's your perl -V, and module versions?