The Error
SeanMAC:tmp localhome$ perl test.pl
Can't locate SOAP/Lite.pm in @INC (@INC contains: /Library/Perl/Updates/5.8.8/darwin-thread-multi-2level /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at test.pl line 17.
BEGIN failed--compilation aborted at test.pl line 17.
So I created a test script and attempted to execute it. It threw up an error at Line 17 complaining that I didn't have the SOAP::Lite library. I.e. "Can't locate SOAP/Lite.pm"
In .NET we would probably either Google the library or use NuGet (NuGet.org - NuGet is a Visual Studio extension that makes it easy to install and update open source libraries).
If we would ever try to compare Perl to the .NET world, we could relate CPAN to NuGet in terms of what it does for us. That is, gets third party libraries, unpacks them and installs them for us.
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of over 100,000 modules of software written in Perl, as well as documentation for it.
To use cpan, open up a terminal or command window, and use the following command. This will run cpan as ROOT user. This is sometimes necessary as it requires access to shared library directories.
Code Snippet
- perl -MCPAN -e 'shell'
End of Code Snippet
You will then be in the cpan shell. Type 'h' for help....
command | argument | description |
a,b,d,m | WORD or /REGEXP/ | about authors, bundles, distributions, modules |
i | WORD or /REGEXP/ | about anything of above |
r | NONE | reinstall recommendations |
ls | AUTHOR | about files in the author's directory |
get | download | |
make | make (implies get) | |
test | MODULES | make test (implies make) |
install | DISTS, BUNDLES | make install (implies test) |
clean | make clean | |
look | open subshell in these dists' directories | |
readme | display these dists' README files |
If we wish to install our library (This includes get/download, make, test and install) then we simply issue the command....
Code Snippet
- install [Library Name]
End of Code Snippet
with example
Code Snippet
- install SOAP::Lite
End of Code Snippet
You will be asked a few options, mostly regarding ideal location to download from, connection timeouts etc... You can simply keep hitting enter to use the defaults.
If all is successful, your library will be installed and included within the @INC array (Containing paths to libraries used by Perl).
Happy Scripting!
1 comment:
Thanks, this has helped me!
Post a Comment