[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-AnyPerl] Multi Platform Scripts



I working on a perl script that will be executed on at least a Mac and a
UNIX box. When I try to run it on UNIX, the script fails because it
cannot find Mac Specific modules, even though they are inside of if
blocks that are not to be executed on a UNIX machine. How do I hide
these use statements? Or do I just install dummy .pm files on my UNIX
machine?

Here is the pertinate code.

sub BEGIN
{
  unshift (@INC, "/acct/rlg0301/perl5/lib");
  unshift (@INC, "/acct/rlg0301/perl5/lib/aix");
  unshift (@INC, "/acct/rlg0301/perl5/site_lib");
  unshift (@INC, "/acct/rlg0301/perl5/site_lib/aix");
  print "@INC \n";
}
use strict;
use Math::Trig;
use vars qw( ... );
open(STDERR, '>Dev:Console:Messages');

# for Mac users who forget to drag&drop the input file
if ($^O eq 'MacOS')
{
  if ($#ARGV < 0)
  {
    use Mac::StandardFile;
    $file = StandardGetFile('', 'TEXT');
    if ($file->sfGood())
    {
      push(@ARGV, $file->sfFile());
    }
    else
    {   
      exit(1);
    }
  }  
}    


The error message says:
Can't locate Mac/StandardFile.pm in @INC at catalog.plx line 77.
BEGIN failed--compilation aborted at catalog.plx line 77.

-- 
Richard L. Grubb
Boeing Wichita

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org