Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > pulling or getting perl script name inside script

Reply
Thread Tools

pulling or getting perl script name inside script

 
 
J M
Guest
Posts: n/a
 
      11-06-2004
I have writeLog sub across several perl scripts that I use to generate logs
from scripts. I like to put script name in side log. Until now I have been
manually putting script name in writeLog sub but is there a way to pull
script name dynamically so I don't have to use static script names inside
perl script? TIA!


 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      11-06-2004
"J M" <(E-Mail Removed)> wrote in
news:h2Xid.22397$(E-Mail Removed). com:

> I have writeLog sub across several perl scripts that I use to generate
> logs from scripts. I like to put script name in side log. Until now I
> have been manually putting script name in writeLog sub but is there a
> way to pull script name dynamically so I don't have to use static
> script names inside perl script? TIA!


D:\Home> cat I_ought_to_read_the_docs_before_posting
print "$0\n";

D:\Home> perl I_ought_to_read_the_docs_before_posting
I_ought_to_read_the_docs_before_posting

Specifically, perldoc perlvar

Sinan

 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      11-06-2004
J M <(E-Mail Removed)> wrote:

> is there a way to pull
> script name dynamically



No need to "pull" it from anywhere, it is already sitting there
in a scalar variable, waiting for you to use it.

A friendly Perl program:

print 'Hi ', scalar(getpwuid($>)), ". My name is $0. How are you today?\n";
# ^^
# ^^ program name


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CGI: Execute a perl script inside another perl script xdarcos@hotmail.com Perl Misc 20 01-18-2005 12:33 PM
Execute another perl script from my perl script Petterson Mikael Perl Misc 3 01-05-2005 01:31 PM
problem calling perl script from SOAP server perl script pj Perl Misc 3 04-09-2004 10:23 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM
How to make Perl Script "POST" call from another Perl Script??? Wet Basement Perl 1 07-15-2003 10:25 PM



Advertisments