I'm not a 'perl' pro, but I am a pro at using different shells, programs and
so on in different environments.  

It depends on the environment in which you're running.

For example, running on some type of *NIX at a command line, you might very
well want command line options so that people and scripts can easily change
the arguments (it is a pain to change environment variables ... more typing
and saving and exporting and what not).

However, if your perl script is called from other perl scripts (since people
aren't typing it), you may want to change the environment.

Of course, you may want to hide the arguments, in which case, variables in a
file readable by the script would be the choice, so that no one could see
the arguments (*NIX ps -elf) or the environment (*NIX ps axewwww).

IMHO, it really depends on what the best use is ... how much a pain ...
what's the protection ... do different people need different environments
but NEVER change it once they have that environment (the case for
Environment variables) ... etc.

I don't run much under M$ Windows, but that may very well point you in a
particular direction, based on what's easily available.

Bruce T. Harvey
Legg Mason Wood Walker, Inc.
Corporate Technology - UNIX Admin.
Red Run 2nd Floor - Owings Mills, MD
(410) 580-7383 - [EMAIL PROTECTED]
-------------------------------------------------------



-----Original Message-----
From: John McKown [mailto:[EMAIL PROTECTED]
Sent: Friday, December 26, 2003 12:38 PM
To: Perl Beginners Mailing List
Subject: Hi & a question


I'm new here and a very novice Perl coder. And I have a question, of 
course <grin>.

Is it more "Perl-like" to get information from the shell via UNIX 
Environment Variables or via the command line? For an example, I have 
writing a Perl program which reacts to messages sent to it. It has four 
input parameters. The current program gets this information, which is two 
distinct subdirectories, a port number, and an IP address, via four 
different environment variables. My question is should I do it that way or 
should I pass this information in via the command line. 

E.g.

export DIR1=...
export DIR2=...
export IPADDR=...
export IPPORT=...
perl-script.perl

or

perl-script.perl DIR1 DIR2 IPADDR IPPORT

Although my current code uses the first way, I'm beginning to think that 
the second is preferrable because it would be more portable to non-UNIX 
environments.

I hope everybody is having a good holiday.

--
Maranatha!
John McKown


IMPORTANT:  The security of electronic mail  sent through the Internet 
is not guaranteed.  Legg Mason therefore recommends that you do not 
send confidential information to us via electronic mail, including social 
security numbers, account numbers, and personal identification numbers.    

Delivery, and timely delivery, of electronic mail is also not 
guaranteed.  Legg Mason therefore recommends that you do not send time-sensitive 
or action-oriented messages to us via electronic mail, including 
authorization to  "buy" or "sell" a security or instructions to conduct any 
other financial transaction.  Such requests, orders or instructions will 
not be processed until Legg Mason can confirm your instructions or 
obtain appropriate written documentation where necessary.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to