X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibfile-which-perl%2Flibfile-which-perl-0.05%2Fdebian%2Flibfile-which-perl%2Fusr%2Fshare%2Fdoc%2Flibfile-which-perl%2Fexamples%2Fpwhich;fp=dev%2Farm%2Flibfile-which-perl%2Flibfile-which-perl-0.05%2Fdebian%2Flibfile-which-perl%2Fusr%2Fshare%2Fdoc%2Flibfile-which-perl%2Fexamples%2Fpwhich;h=5e8d953f3f904ad88b4abadb7110de387563ccdb;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libfile-which-perl/libfile-which-perl-0.05/debian/libfile-which-perl/usr/share/doc/libfile-which-perl/examples/pwhich b/dev/arm/libfile-which-perl/libfile-which-perl-0.05/debian/libfile-which-perl/usr/share/doc/libfile-which-perl/examples/pwhich new file mode 100644 index 0000000..5e8d953 --- /dev/null +++ b/dev/arm/libfile-which-perl/libfile-which-perl-0.05/debian/libfile-which-perl/usr/share/doc/libfile-which-perl/examples/pwhich @@ -0,0 +1,101 @@ +#!/usr/bin/perl -w + +use strict; + +use File::Which; +use Getopt::Std; + +my %opts = (); + +getopts('av', \%opts); + +my @files = @ARGV; + +if ($opts{v}) { + print <<"END"; +This is pwhich running File::Which version $File::Which::VERSION + +Copyright 2002 Per Einar Ellefsen. +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. +END + + exit; +} + +unless(@files) { + print <<"EOS"; +Usage: $0 [-a] [-v] programname [programname ...] + -a Print all matches in PATH, not just the first. + -v Prints version and exits + +EOS + + exit; +} + +for my $file (@files) { + my @result = $opts{a} ? which($file) : scalar which($file); # need to force scalar + @result = () unless defined $result[0]; # we might end up with @result = (undef) -> 1 elem + for my $result (@result) { + print "$result\n" if $result; + } + print STDERR "pwhich: no $file in PATH\n" unless @result; +} + +__END__ + +=head1 NAME + +pwhich - Perl-only `which' + +=head1 Synopsis + + $ pwhich perl + $ pwhich -a perl # print all matches + $ pwhich perl perldoc ... # look for multiple programs + $ pwhich -a perl perldoc ... + +=head1 DESCRIPTION + +`pwhich' is a command-line utility program for finding paths to other +programs based on the user's C. It is similar to the usualy Unix +tool `which', and tries to emulate its functionality, but is written +purely in Perl (uses the module C), so is portable. + + +=head1 Calling syntax + + $ pwhich [-a] [-v] programname [programname ...] + +=head2 Options + +=over + +=item -a + +The option I<-a> will make C print all matches found in the +C variable instead of just the first one. Each match is printed +on a separate line. + +=item -v + +Prints version (of C) and copyright notice and exits. + +=back + +=head1 License + +This program is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=head1 See Also + +L, L, L + +=head1 Author + +Per Einar Ellefsen, Eper.einar (at) skynet.beE + +=cut +