Perl Program

Availability

Permission is hereby granted to use this code in any way provided that the above copyright is included in all copies. That having been said, if you find a problem in any of this software I would love to hear from you.

GetArgs – Command-Line Argument Parser

This is a library routine for parsing command arguments and switches (yes, I know there are several of these, but when I originally wrote this none supported all the features I wanted).

The call takes a simple description of the supported options, positional arguments, variables to set with the supplied values, and help text to be provided to the user as part of the usage message. Support is automatic for -usage, --usage, -help, --help, and -?; and for the end of switch arguments marker '--'.

  • Full Detailed Description
  • This package provides the routine 'getargs' for parsing command line arguments. It automates most of a standard command line interface by taking a picture of the expected arguments of the form:
    ( <4tuple> [, <4tuple> ]... ) <4tuple> ::= , , , ::= '-' for switch arguments (these are order independent
  • Full The Perl
  • package getargs; sub main'getargs #'
    {local(@Picture) = @_;
    # Now parse the argument picture
    local( $Type, $Keyword, $Key, $Size, $Variable, $Tuple );
    local( %Sizes, %Switches );
    local( $Options, $Mandatories, @Positional, $Target, %Targets );
    for ( $Tuple = 0; $Tuple < $#Picture; $Tuple += 4 )

Web Request Tester – HTTP Request Debugging Made Easy

The Web Request Tester (wwwreq) allows you to manually craft and send raw HTTP/1.1 requests to any web server and view the full response.
Perfect for developers exploring web server behavior, debugging APIs, or testing edge cases not supported by browsers or tools like curl.

  • Full Detailed Description
  • Provides -usage, --usage, -help, --help, and -?
    (if the 'usage' or 'help' switches are specified in the picture,the caller will get it like any other switch).
    Provides '--' for the end of switch arguments.
    Switch and Optional arguments not specified in @ARGV are not defined by getargs - you can either test for that or just assign them default values before calling getargs.
  • Full The Perl Description
  • Used only with the 'TRACE' method, it limits the number of proxies which may forward the request. No limit is sent if this option is not specified.
    --useragent
    Specify a User Agent string to send (defaults to '$DefaultUserAgent') Specify a null string argument to disable sending a User Agent string. Not valid with 0.9.

    Symbolic Link Tools

    Shadow – Create Mirror Directory Trees with Symlinks

    Shadow builds a mirrored directory structure where all files are symbolic links to the originals. Ideal for:

    • Staging environments
    • Debugging live vs. source directories
    • Managing build systems

    This kind of directory is very useful in a variety of software development contexts.

    • Detailed Description
    • $ShadowDir = '.';
      $Verbose = 0;
      $SkipDefault = '^(RCS|SCCS|CVS)$';
      $Skip = $ENV{ 'SHADOWSKIP' } || $SkipDefault;
      $TreeOnly = 0;
      $Usage = <<_help_message_ makes a copy if specified>

      This script uses the getargs argument parser

    Mkreal – Convert Symlinks to Real Files

    Mkreal complements Shadow by replacing each symbolic link with a real, physical copy of the target file. Useful for preparing standalone distributions or backups.

    Relink – Smart Symlink Creator

    Relink lets you easily create or modify symbolic links, acting as a smarter alternative to ln -s.

    • The Perl
    • #!/usr/bin/perl foreach ( @ARGV )
      { if ( -l ) { if ( -f ){
      $Real = readlink; unlink; `cp $Real $_`; unless ( $? ) {
      $Mode = (stat( $_ ))[2]; chmod( ($Mode | 0200) , $_ ); } else {
      warn "??? $?\n"; } } else { warn "'$_' does not represent a file:\n\t$Real\n";
      } } else { warn "'$_' is not a link.\n"; } }
    This script uses the getargs argument parser