Discussion:
Embedding modules
(too old to reply)
Todd Nine
2008-01-24 22:27:18 UTC
Permalink
Hi all,
I'm new to Perl, so I apologize if this is the incorrect list. I'm
attempting to create a small plug in to the Urchin web stats system, and I
want to embed the XML::Simple module in my code. Its CGI based and just
sits in a directory that apache accesses. Installing XML:Simple on every
host makes deployment a bit difficult. I'd like everything in a zip file
that the admin can just unzip, then use the scripts. I've already modified
the load path to load all my .pm files, how can I include the XML:Simple
code?

Thanks,
Todd
Jonathan Yu
2008-01-24 22:55:19 UTC
Permalink
Todd:

I think that there are two problems with your idea.

1. You have to make sure your copy of XML::Simple is kept up to date
for two reasons:
a. to ensure security (ie, security patches into the main tree need to
be added to yours)
b. to ensure the bindings always match up with the C version (in the
case of wrappers to libraries. not sure if XML::Simple is like
XML::LibXML though..)

2. You are making people download larger packages, which defeats the
purpose of CPAN. If everyone did this there'd be a lot of redundancy
and it would become a huge mess.

My answer is to write a Perl module and distribute it via CPAN. Write
it in a general way such that it can be used by others; particularly
since I'm sure lots of people would be interested in an easy interface
to Urchin/Google stats. Makefile.PL or Module-Build have facilities
for ensuring that all dependencies are appropriately met -- that's its
purpose.

If you *really* want to do this, and I'm almost certain it's not what
you want, then include the package in a lib/ directory and just 'use
lib "/path/to/lib/"' at the top of your code. Or you can mess around
with %INC%, but that's *really* not recommended.

Hope this helps,

Jon
Post by Todd Nine
Hi all,
I'm new to Perl, so I apologize if this is the incorrect list. I'm
attempting to create a small plug in to the Urchin web stats system, and I
want to embed the XML::Simple module in my code. Its CGI based and just
sits in a directory that apache accesses. Installing XML:Simple on every
host makes deployment a bit difficult. I'd like everything in a zip file
that the admin can just unzip, then use the scripts. I've already modified
the load path to load all my .pm files, how can I include the XML:Simple
code?
Thanks,
Todd
Loading...