Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Argv 1.24

    Download button

    No screenshots available
    Downloads: 491  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David Boyce | More programs
    Perl Artistic License / FREE
    September 28th, 2009, 01:16 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Argv description

    Provides an OO interface to an arg vector

    Argv is a Perl module that provides an OO interface to an arg vector.

    SYNOPSIS

    use Argv;

    # A roundabout way of getting perl's version.
    my $pl = Argv->new(qw(perl -v));
    $pl->exec;

    # Run /bin/cat, showing how to provide "predigested" options.
    Argv->new('/bin/cat', [qw(-u -n)], @ARGV)->system;

    # A roundabout way of globbing.
    my $echo = Argv->new(qw(echo M*));
    $echo->glob;
    my $globbed = $echo->qx;
    print "'echo M*' globs to: $globbed";

    # A demonstration of head-like behavior (aborting early)
    my $maxLinesToPrint = 5;
    my $callback = sub {
    print shift;
    return !(--$maxLinesToPrint);
    };
    my $head = Argv->new('ls', [qw(-l -a)]);
    $head->readonly("yes");
    $head->pipe($callback);

    # A demonstration of the builtin xargs-like behavior.
    my @files = split(/s+/, $globbed);
    my $ls = Argv->new(qw(ls -d -l), @files);
    $ls->parse(qw(d l));
    $ls->dbglevel(1);
    $ls->qxargs(1);
    my @long = $ls->qx;
    $ls->dbglevel(0);
    print @long;

    # A demonstration of how to use option sets in a wrapper program.
    @ARGV = qw(Who -a -y foo -r); # hack up an @ARGV
    my $who = Argv->new(@ARGV); # instantiate
    $who->dbglevel(1); # set verbosity
    $who->optset(qw(UNAME FOO WHO)); # define 3 option sets
    $who->parseUNAME(qw(a m n p)); # parse these to set UNAME
    $who->parseFOO(qw(y=s z)); # parse -y and -z to FOO
    $who->parseWHO('r'); # for the 'who' cmd
    warn "got -y flag in option set FOOn" if $who->flagFOO('y');
    print Argv->new('uname', $who->optsUNAME)->qx;
    $who->prog(lc $who->prog); # force $0 to lower case
    $who->exec(qw(WHO)); # exec the who cmd



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    arg vector | OO interface | Perl module | Argv | arg | vector

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM