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

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/ )
              {
              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! $!";
      • 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?