App-Options

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

######################################################################
## File: $Id: README 3442 2005-05-14 14:14:01Z spadkins $
######################################################################

1. What is the App-Options distribution?

You might say App-Options distribution is "yet another command line
option processor."  However, it was created for maximum ease of use
with the needs of the Perl 5 Enterprise Environment in mind
(more on that later).

The distribution consists of one Perl module and one shell script.

   App::Options - a perl module which combines command line parameters,
       environment variables, and configuration files to produce
       a hash of option values.

README  view on Meta::CPAN

   code the "--help" feature, etc.  With App::Options, you simply
   "use App::Options;" and all the hard work is done.
   Advanced options can be added later as necessary as args
   to the "use" statement.  This met design goal #3.

Design goal #4 required the autodetection of the ${prefix}
variable.  Thus, the App::Options module can be integrated with
the discipline of choosing a root directory for your
software installation (i.e. PREFIX=/usr/mycompany/2.0.12).

5. You say it's so easy. Show me.

  #!/usr/bin/perl
  use App::Options;
  # now use the %App::options hash
  print "yada yada\n" if ($App::options{verbose});

It's that easy.

And it automatically has "-?" and "--help" support without
you having to code a thing.

lib/App/Options.pm  view on Meta::CPAN

            print STDERR "\n" if ($debug_options);
        }
    }
}

sub file_is_secure {
    my ($file) = @_;
    my ($secure, $dir);
    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks);
    if ($^O =~ /MSWin32/) {
        $secure = 1; # say it is without really checking
    }
    else {
        $secure = $path_is_secure{$file};
        if (!defined $secure) {
            ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($file);
            if (!($mode & 0400)) {
                $secure = 0;
                print "Error: Option file is not secure because it is not readable by the owner.\n";
            }
            elsif ($mode & 0077) {



( run in 0.940 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )