In your code you can specify the directory location of the pm:
use lib '/path/to/pm';But then it'd need to be run from precisely the same place each and every time no matter what.
The "best practice" would be to introduce it to your perl module area via the standard method. Go to CPAN and download the file:
http://search.cpan.org/~kraehe/XML-Handler-YAWriter-0.23/YAWriter.pm Once you have it downloaded & extracted, do: cd /path/to/extracted/files perl Makefile.PL make sudo make install (these steps assume UNIX. YMMV)and then when you use your perl program, just use the directive to include the module up near your make strict area like so:
#!/usr/bin/perl -w
use XML::Handler::YAWriter;
use strict;
{
code here
}
In this way, perl makes sure that your module lives where perl wants
it to be to properly operate in your environment. It knows his
location, and how to properly source it without trouble.
I hope that's the answer you were looking for. Happy Perl! --jms On Mar 4, 2009, at 5:58 AM, Dermot wrote:
2009/3/3 <[email protected]>: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:I could be wrong (I have been in the past :)) but you have YAMwriter.pm in your current working directory, then you have said `use XML::Handler::YAWriter` then perl will expect a path, as the error says, like "XML/Handler/YAWriter.pm". The colons '::' are directory separators. You could could try a hack with `use YAWriter` but that might cause inheritance problems. It sound like you didn't installed the module correctly. Good luck, Dp. -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
PGP.sig
Description: This is a digitally signed message part
