Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • MNooning wrote:

    Here are some Windows one-liners. On Linux, use single quotes and forward slashes.
    Find the INC path that Perl sees when it starts up.
    >perl -e "print qq[INC = @INC\n];"
    INC = C:/Perl/site/lib C:/Perl/lib .

    Another way to find the INC path.
    perl -wle "print for @INC"
    C:/Perl/site/lib
    C:/Perl/lib

    Find out if a module is installed. If it is, no error messages will show.
    >perl -e "use Tk"

    Obtain the version of an installed module.
    >perl -MTk -e "print \"$Tk::VERSION\n\"
    804.028501

    Here is the same command on Cygwin
    >$ perl -MTk -e 'print $Tk::VERSION'
    804.028
    This is what you see if the module is not there:
    >perl -e "use TkBad"
    Can't locate TkBad.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at -e line 1. BEGIN failed--compilation aborted at -e line 1.


    This is also what you see if the module is not there:
    >perl -MTkBad -e "print \"$TkBad::VERSION\n\"
    Can't locate TkBad.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .). BEGIN failed--compilation aborted.

    Here is an example of getting the version of an installed module in a deep path. Again, the syntax is different on Linux.
    C:\oldProjects\proj_bu_2003\routines>perl -MCatalyst::Authentication::Store::LDAP -e "print \"$Catalyst::Authentication: :Store::LDAP::VERSION\n\"
    0.1005

    This is a bit of a different one-liner subject, but a quick way to scroll a module's package file is
    >perldoc -m Tk