Command line script vs modules/subroutines 
Author Message
 Command line script vs modules/subroutines

I am new to perl and am trying to convert a bunch of ksh scripts to perl. A lot
of these scripts are utilities called by many others, but can also be used
alone on the command line. I am trying to optimize the performance on WinNT, so
am trying to eliminate as many new processes as possible. Using zsh/ksh and gnu
exe's on WinNT is very slow, my first perl test conversion is 10x faster.

The main question I have about perl: is there a way to create a script that can
be used on the command line and also used in another perl script (without
invoking another perl process (i.e. system or ``)), or will I have to create
the utilities as modules and write wrapper scripts for command line use?

Thanx.

Ric
--
]---------------------------------------------------------------------------

] The views expressed here do not necessarily represent those of my employer
] BTW Eric Riis Hotchkiss is an anagram for: sickest Irish choir



Wed, 18 Jun 1902 08:00:00 GMT  
 Command line script vs modules/subroutines

Quote:

>The main question I have about perl: is there a way to create a script that can
>be used on the command line and also used in another perl script (without
>invoking another perl process (i.e. system or ``)), or will I have to create
>the utilities as modules and write wrapper scripts for command line use?

Well, you *can* have things which are both a script and a module.
It's usually regarded as a bit jokey, but perfectly straightforward.

Look in the standard Perl distribution for an example of how it can be done.
The 'diagnostics.pm' module is the same as the 'splain' script.

Mike Guy



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. executing commands, command-line vs. browser

2. -ln015 on #! line -vs- command line

3. Win32::OLE problem -- command line vs. CGI

4. LIBWWW - Command Line vs Web Browser

5. command line parameters (.bat vs .pl)

6. Subroutines from the command line

7. price of perl (was Re: GUI vs command line)

8. How to hide command line parameters from modules?

9. SNMP PERL module / command-line output differ

10. New Command Line Option Module Proposal

11. recognizing %ENV in command line script

12. Command line script - how to escape !

 

 
Powered by phpBB® Forum Software