Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Porting from OSX to OS9

2 views
Skip to first unread message

Oorbee Roy

unread,
Oct 16, 2002, 9:38:54 PM10/16/02
to macperl...@perl.org

Hi,

Although I'm a long time Perl (Unix) developer, I'm
very new to the Mac world. I'm currently developing a
perl script on OSX and wish to port it to OS9. I have
had very little exposure to OSX (I love it) and even
less exposure to OS9.

The script is run only from the command line with
parameters (ie ./code.cgi -f file.txt -log no) and it
runs well from the terminal on OSX. My question is,
if I go ahead and install MacPerl on OS9, will users
still be able to run the script with parameters? If
yes, how? If no, what are the alternatives? I'd
prefer not to use the browser at this time.

My apologies for the inexperienced question. Thank
you in advance for your time.

Oorbee Roy

=====
>~<>~<>~<>~<>~<>~<>~<>~<>~<
oorbee roy
http://www.oorbeeroy.com
>~<>~<>~<>~<>~<>~<>~<>~<>~<

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

Chris Nandor

unread,
Oct 17, 2002, 7:32:48 AM10/17/02
to oorbee roy, macperl...@perl.org
At 18:38 -0700 2002.10.16, oorbee roy wrote:
>Although I'm a long time Perl (Unix) developer, I'm
>very new to the Mac world. I'm currently developing a
>perl script on OSX and wish to port it to OS9. I have
>had very little exposure to OSX (I love it) and even
>less exposure to OS9.

A few things:

* Read the perlport man page, which contains a wealth of useful information
about writing portable Perl programs.

* In brief, Mac OS users (as opposed to Mac OS X users) can run MPW and use
perl from the command line, and run the script on the command line
(although "./" will not work). Also, man perlport has a method you can try
for calling the program with the MacPerl application, so a dialog box can
pop up asking for arguments.

* This list is for the porting of perl itself to Mac OS, not for the
porting of Perl programs. Try the mac...@perl.org list, or the
macperl...@perl.org list (http://lists.perl.org/).

Please direct followups to one of the other lists. Thanks,

--
Chris Nandor pu...@pobox.com http://pudge.net/
Open Source Development Network pu...@osdn.com http://osdn.com/

Axel Rose

unread,
Oct 17, 2002, 8:40:01 AM10/17/02
to oorbee roy, macperl...@perl.org
Hello Oorbee,

I copied some samples from my local Perl scripts. They
show some options how you could make entering options
under MacPerl a bit more user-friendly. There are much
more elaborate ways possible, but ...


HTH


Axel


# enter a file path
chomp( my $pwd = `pwd` );
my $file = $ARGV[0] || MacPerl::Ask( "input:", $pwd );


# ask for choices
my $choice = MacPerl::Answer( "Options:", "-A-", "-B-" );


# simulate Unix like command line
my $MACOS = ( $^O =~ /Mac/ ) || 0;
if ($MACOS) {
my $ans =
MacPerl::Ask( 'Please enter @ARGV (-h for help)',
defined $ARGV[0] ? $ARGV[0] : "" );
if ( $ans =~ /\b-h\b/i ) { @ARGV = ('-h') }
else {
my $args = main::splitargs($ans);
@ARGV = @$args;
}
}

sub splitargs {
my @return;

my $s = shift;
$s =~ s/^\s*//;
$s =~ s/\s*$//;

my @args = split //, $s;
my $inparam = 0;
my $fileparam = 0;
my $param = 0;
my $pos = 0;
for (@args) {
if ( /^-/ and !$inparam and !$fileparam ) {
$return[$param] = $_;
$inparam = 1;
$fileparam = 0;
$pos++;
}
elsif ( $inparam and !$fileparam ) {
$return[$param] .= $_;
if ( $args[ $pos + 1 ] and $args[ $pos + 1 ] eq ' ' ) {
$inparam = 0;
$fileparam = 1;
$param++;
}
$pos++;
}
elsif ( !$inparam and $fileparam ) {
$return[$param] .= $_;
}
elsif ( !$inparam and !$fileparam ) {
$return[$param] .= $_;
$fileparam = 1;
}
else {
warn "internal logic error\n";
}
}
$return[-1] =~ s/^\s+//;
return \@return;
}

0 new messages