At 14|30 -0400 2002/04/09, Chris Nandor wrote:
>At 18:29 +0200 2002.04.09, Bart Lateur wrote:
>>On Tue, 9 Apr 2002 10:09:44 -0400, Chris Nandor wrote:
>>>What I would prefer is a separate module that would get called first, so
>>>you could do something like:
>>>
>>>     #!/usr/bin/perl
>>>     use Mac::ARGV;

true TMT1WTDI. And that would work. But I have an assortment of scripts
that already use Getopt::Std (some written by me, most not...) so...

>>>and it would automatically manipulate @ARGV before anyone else got to it.
>>>The module would have to work on any platform, so it could be installed
>>>anywhere, though it would only do something under MacPerl.

But that requires that the writer insert this Mac-specific line in all
their scripts, which is an effort that thousands of people need to make.
And they all need to make that effort on top of any other portability
coding. I'm not sure that adding a new module caled Mac::ARGV to the
standard distro would be any easier than adding some code to Getopt::Std
(which is never reached on other OSs). As a programmer who writes command
line scripts (for Unix, but they would work on MacOS) a lot I'd rather say
'hey perl! get me my options' and it would DWIM, appropriately for the
local system.

MacPerl is brilliant for many reasons - one of which is that it runs pretty
much any program that I give it, just like it would run on unix or windows.
E.g File::Spec behaves in many different ways, but it always does the right
thing for the OS.

My thoughts on this are that Getopt::Std _gets_ _options_. The name doesn't
say how it does it, there's nothing in the module name that says 'we
actually play with @ARGV' - all it claims to do is to get options from the
user. I think that the module should get the options in whatever way is
most appropriate for the user, and also easiest for the programming
community to call. And it requires no change to existing code. THousands of
existing commandline scripts will run on MacPerl (and many more will get
beyond usage() before hitting some Unix-specific code :-)

Now _usually_ yes you do invoke a script with arguments, by dropping files
on it or by appending command line arguments. But that is not appropriate
for MacOS. OK ideally Getopt::Std would pop up a config control panel, with
checkboxes for boolean command-line switches, and text areas for options
that take arguments, but I haven't got that far... I'll have a bash tonight
:-)

Just my 2p anyway - I've very much been brought up with the philosphy 'make
it robust, make it portable, make it generic, make it a black box with a
clean API and proper error handling and extensible too, make it appropriate
for its problem domain, and then document it'. Very snappy.

P

--
[EMAIL PROTECTED]                         "all the world's indeed a stage"
http://www.pkent.me.uk/              For PGP see the keyservers or website
http://www.selsyn.co.uk/
Fax: Britain 0870 137 9220 - America (208) 692-8600


Reply via email to