App-pltest

 view release on metacpan or  search on metacpan

pltest  view on Meta::CPAN

I<perl:> Provide C<split()> pattern for B<-a> switch (C<//>'s are optional).

=item C<-II<directory>>

I<perl:> Specify C<@INC>/C<#include> directory (several B<-I>'s allowed).

=item C<-iI<[extension]>>

I<perl:> Edit C<< <> >> files in place (makes backup if extension supplied).

=item C<-n>

I<As I said before, I never repeat myself. :-)>

I<perl:> Assume C<< while (<>) { ... } >> loop around program.  It's a little
richer than that: if you use C<last>, it closes the current file, leaving you
to continue the loop on the next file.

=item C<-oI<[number]>>

Assume C<for(@ARGV) { ... }> loop around main program, and C<$ARGIND> (or
C<$I>) is the current position.  In this case B<-p> doesn't imply B<-n>.  If
number is given, that many args are passed at once as an array, referencing
the original values.  If there are not enough on the last round, C<@A(RGV)> is
filled up with C<undef>.

    pltest -opl '' I II III IV
    pltest -o3 'echo $ARGIND, @$_' i ii iii iv v vi vii viii ix
    pltest -opl '' I II III IV
    pltest -o3 'e $I, @$_' i ii iii iv v vi vii viii ix

    >   I
    >   II
    >   III
    >   IV
    >   0 i ii iii
    >   3 iv v vi
    >   6 vii viii ix

=item C<-OI<[number]>>

like B<-o>, but use C<@A(RGV)> as loop variable.

=item C<-pI<[number]>>

I<Does C<pltest -penis> do pussy?  B< >It implements C<cat>. :-*>

I<perl++:> On each loop C<print> (also B<-o> and B<-O>, in which case you must
fill C<$_>) iteration.  If number is given, print at most number times.

=item C<-PI<[number]>>

Like B<-p>, but print only if main program evaluates to true, like C<grep>.

=item C<-r>

Reset C<$.> and B<-p>/B<-P> counter for each file.

=item C<-T>

I<perl:> Enable tainting checks.

=item C<-t>

I<perl:> Enable tainting warnings.

=item C<-U>

I<perl:> Allow unsafe operations.

=item C<-u>

I<perl:> Dump core after parsing program.

=item C<-v>

I<perl:> Print version, patchlevel and license.

=item C<-VI<VERSION>>

Rerun with given perl version, which is just a string appended to F<perl>.

=item C<-W>

I<perl:> Enable all warnings.

=item C<-w>

I<perl:> Enable many useful warnings.

=item C<-X>

I<perl:> Disable all warnings.

=back

=head2 Functions

There are various functions, always also with a one letter alias, which
perform little tasks that can be useful in one liners.

=over

=item C<benchmark { } I<[name[, arg...]]>> |
C<b { } I<[name[, arg...]]>>

Benchmark slow code for 10s, display name, looping over args.

=item C<Benchmark { } I<[name[, arg...]]>> |
C<B { } I<[name[, arg...]]>>

Same, but run code 100 times in benchmark, to reduce overhead.

=item C<Config I<[regexp...]>> |
C<C I<[regexp...]>>

Import and return C<%Config>, e.g. C<< Config->{sitelib} >>, optionally only part matching regexps.

=item C<Date I<[arg...][, tz]>> |
C<D I<[arg...][, tz]>>

I<Why is Halloween Christmas?  Because Oct 31 = Dec 25. (^)>

Date (from arg [s, us], s{.us}, offset [+-]s{.us}, tz ([+-]0-14{:mm|.ff}).
Microseconds should be passed as strings, because floats have



( run in 0.663 second using v1.01-cache-2.11-cpan-39bf76dae61 )