Getopt::CallingName

Getopt::CallingName is a Perl script duties delegation based upon calling name.
Download

Getopt::CallingName Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sagar R. Shah
  • Publisher web site:
  • http://search.cpan.org/~srshah/

Getopt::CallingName Tags


Getopt::CallingName Description

Getopt::CallingName is a Perl script duties delegation based upon calling name. Getopt::CallingName is a Perl script duties delegation based upon calling name.SYNOPSIS use Getopt::CallingName; call_name( name_prefix => 'tv_', args => @my_array, );Sometimes you can have a script that can run in two or more 'modes' of operation. Apart from an option to specify the mode, the command line options are the same/very similar. Much of the code used by the various modes is common.As an application user interface decision, it may be more useful/helpful to be able to call the script by two or more names - i.e. one for each mode. This cuts out the command line option for specifying the mode.In some cases it might be appropriate just to move all the code, or at least all the common code, into a module and have separate wrapper perl scripts. The problem with this approach is either you end up duplicating command line option handling in each of the wrapper scripts or you end up moving the command line option handling into a module also. The former case introduces maintenance burden . The latter case can feel like a distortion/displacement of the code.Getopt::CallingName provides another alternative. The idea is that you create symbolic links to your actual script (which you might want to give a generic name). Each symbolic link corresponds to the name/mode with which you call the script. Within your script, after any common setup/options handling you call subroutine call_name to call the appropriate script subroutine for the mode. Requirements: · Perl


Getopt::CallingName Related Software