finding modules via @INC

Discussion in 'Perl Misc' started by sysdrk@wowway.com, Mar 4, 2009.

  1. Guest

    I'm trying to use an XML pretty printer called xmlpretty on UNIX that
    I downloaded from the net. xmlpretty is a simple perl program that
    uses a module called YAWriter.pm that came with the package. So
    xmlpretty has:

    use XML::Handler::YAWriter;

    However, with xmlpretty and YAWriter.pm in the same directory and
    running xmlpretty from this directory, perl complains it can't find
    YAWriter.pm:

    $ export PERL5LIB=`pwd`
    $ xmlpretty
    Can't locate XML/Handler/YAWriter.pm in @INC (@INC contains: /home/
    kertz/xml/XML
    -Handler-YAWriter-0.23 /usr/perl5/5.00503/sun4-solaris /usr/
    perl5/5.00503 /usr/p
    erl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
    xmlpretty line 4.
    BEGIN failed--compilation aborted at xmlpretty line 4.

    Note that @INC is set to the current directory twice - first with the
    PERL5LIB and the default addition of the current directory (.) to this
    search path.

    However, if I run the xmlpretty directly with the perl command and use
    the -l option to specify the current directory, it works (and fails if
    I leave the -l option off):

    $ perl -l `pwd` xmlpretty
    $

    Can anyone tell me what I need to do to be able to run xmlpretty
    directly and have it find the YAWriter.pm module that is in the same
    directory?

    Here is my perl version:
    This is perl, version 5.005_03 built for sun4-solaris

    Denis
     
    , Mar 4, 2009
    #1
    1. Advertising

  2. wrote:
    > I'm trying to use an XML pretty printer called xmlpretty on UNIX that
    > I downloaded from the net. xmlpretty is a simple perl program that
    > uses a module called YAWriter.pm that came with the package. So
    > xmlpretty has:
    >
    > use XML::Handler::YAWriter;
    >
    > However, with xmlpretty and YAWriter.pm in the same directory and
    > running xmlpretty from this directory, perl complains it can't find
    > YAWriter.pm:
    >
    > $ export PERL5LIB=`pwd`
    > $ xmlpretty
    > Can't locate XML/Handler/YAWriter.pm in @INC (@INC contains: /home/
    > kertz/xml/XML
    > -Handler-YAWriter-0.23 /usr/perl5/5.00503/sun4-solaris /usr/
    > perl5/5.00503 /usr/p
    > erl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
    > xmlpretty line 4.
    > BEGIN failed--compilation aborted at xmlpretty line 4.
    >
    > Note that @INC is set to the current directory twice - first with the
    > PERL5LIB and the default addition of the current directory (.) to this
    > search path.
    >
    > However, if I run the xmlpretty directly with the perl command and use
    > the -l option to specify the current directory, it works (and fails if
    > I leave the -l option off):
    >
    > $ perl -l `pwd` xmlpretty
    > $
    >
    > Can anyone tell me what I need to do to be able to run xmlpretty
    > directly and have it find the YAWriter.pm module that is in the same
    > directory?


    It's a module, and not supposed to be placed in the same directory as
    the script. The best you can do is to install XML::Handler::YAWriter
    properly, e.g. using CPAN.pm.

    Another option is to create a directory XML in
    /usr/perl5/site_perl/5.005, then create a subdirectory Handler in the
    XML directory and place YAWriter.pm there. Then you should have:

    /usr/perl5/site_perl/5.005/XML/Handler/YAWriter.pm

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Mar 4, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. niz
    Replies:
    2
    Views:
    1,926
    Simon Andrews
    Jul 23, 2003
  2. thewhizkid

    @INC equiv in .csh scripts ?

    thewhizkid, Jan 21, 2004, in forum: Perl
    Replies:
    1
    Views:
    1,161
    Michael Korte
    Jan 21, 2004
  3. =?Utf-8?B?dmluYXk=?=

    INC

    =?Utf-8?B?dmluYXk=?=, Nov 15, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    535
    =?Utf-8?B?dmluYXk=?=
    Nov 15, 2004
  4. Jennifer
    Replies:
    1
    Views:
    167
    Tad McClellan
    Jun 24, 2003
  5. Replies:
    3
    Views:
    1,633
Loading...

Share This Page