What is my name

From: Hannu Hirvonen (Hannu.Hirvonen_at_nokia.com)
Date: 10/30/03


Date: Thu, 30 Oct 2003 13:42:45 +0200
To: <beginners@perl.org>

Hi,

I have a little problem. I have script "test.pl" and inside this script I want to know what is "my name" (I mean this "test.pl".

test.pl script
---------------

my $this_scripts_name_is = who_am_I();

sub who_am_I
{
  my $my_name = xxxx; # what I have to put to this "xxxx" to get "test.pl" scripts name

  return $my_name;
}

Idea is that I read some information from the beginning of this file. There is at least lines:

#
# Usage of this script
#
# Here are instructions for usage of this script
#
#

Everything else is under control but I don't know how to get this script's name "generally". When I solve this problem I will add this "Usage" fields to all my scripts. When running script without parameters (e.g. "test.pl") script print out this "Usage fields".

Br,

- Hannu -



Relevant Pages

  • RE: RFC on script
    ... According to the usage shown ... this script should fail every time. ... a value unless the usage statement is wrong. ...
    (perl.beginners)
  • Re: unused indexes (Informix 7.31)
    ... I use this bash script in 10. ... function usage { ... printf "\noption 'a' is ascending sort order. ...
    (comp.databases.informix)
  • Re: RFC on script // GetOptions problems
    ... > meant to ridicule you or condemn your script. ... My main problem now is that if i have a long inFile "sub findVars " ... die usage() if $needHelp; ... > This is perl. ...
    (perl.beginners)
  • Re: confusing warnings and void values
    ... > RichT wrote: ... >> its a script for extracting data from a file and exporting it to another. ... > die usage() if $needHelp; ... > close DCIFILE; ...
    (perl.beginners)
  • Scripting best practicies
    ... Here are some rules that I think make a good script be it in simple ... · Be Verbose Internally ... what ever it prints to a log file which the user can access once the ... their usage. ...
    (comp.cad.synthesis)