Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all Iv'e downloaded a pdf module from CPAN and am trying to use it in my webspace provided by Demon Internet (www.demon.net) but no matter what I try it cannot 'find' the module called Reuse.pm which IS in the same directory as the following script. !/usr/bin/perl use lib "$ENV{'DOCUMENT_ROOT'}/pdftest"; use CGI::Carp qw(fatalsToBrowser); use Reuse; use PDF::Reuse; print "Content-type: text/html\n\n"; print "<HTML><BODY>Finished</BODY></HTML>"; It stops on the "use PDF::Reuse;" statement saying it can't find the module at yet the Use Reuse does not cause an error and the error shows the @inc path which contains the full path to my working directory. I've tried Demon's technical support but they offered very little advice Thanks in advance for your help Andrew Kennard
Post Follow-up to this messageOn Wed, 6 Apr 2005 16:46:43 +0100, a.kennard@btinternet.com (Andrew Kennard) wrote: >Iv'e downloaded a pdf module from CPAN and am trying to use it in my >webspace provided by Demon Internet (www.demon.net) but no matter what I tr y >it cannot 'find' the module called Reuse.pm which IS in the same directory >as the following script. > >!/usr/bin/perl >use lib "$ENV{'DOCUMENT_ROOT'}/pdftest"; >use CGI::Carp qw(fatalsToBrowser); >use Reuse; >use PDF::Reuse; >print "Content-type: text/html\n\n"; >print "<HTML><BODY>Finished</BODY></HTML>"; > > >It stops on the "use PDF::Reuse;" statement saying it can't find the module >at yet the Use Reuse does not cause an error and the error shows the @inc >path which contains the full path to my working directory. > >I've tried Demon's technical support but they offered very little advice 2 things to try: Instead of: use lib "$ENV{'DOCUMENT_ROOT'}/pdftest"; try use lib "."; In "." , create a directory called PDF, and put Reuse.pm into PDF. There is an internal naming of modules, at the top of the .pm file, where the package is declared. In your case, Reuse.pm should have "package PDF::Reuse" at the top. You can change that to just "package Reuse" and avoid having the PDF directory. I don't know why the "use lib "$ENV{'DOCUMENT_ROOT'}/pdftest"; dosn't work, but I'm guessing Perl dosn't like nested variables in it's use statements? -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
Post Follow-up to this message> >use lib "$ENV{'DOCUMENT_ROOT'}/pdftest";
use lib is done at compile time. the %ENV isn't available til run-time IIRC.
Post Follow-up to this messageOn Fri, 08 Apr 2005 11:59:12 -0400, Shaun Fryer wrote:
>
> use lib is done at compile time. the %ENV isn't available til run-time IIRC.[/colo
r]
False:
$ perl -le 'print grep /peter/ => @INC'
$ perl -le 'use lib $ENV{HOME}; print grep /peter/ => @INC'
/home/peter
$
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.