We got some new hardware, and I'm migrating some bits of glue from one server to another. Part of this process is compiling the Perl scripts, finding out which modules aren't there and installing the missing RPMs (we're using Red Hat 9 -- that's a topic for another thread). So far, so good.

I installed Mail::Sendmail from an RPM (perl-Mail-Sendmail-0.79-1.i386.rpm), and went to confirm that Perl could now find that module so I could move on to the next missing one. It failed, and I had a look at the next missing module .. to find that Perl still couldn't find Mail::Sendmail. Hmph.

Time to refresh my memory on how all this works. Doing a perl -V on my Production machine produces

@INC: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .
and doing the same on the new server produces
@INC: /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 .
So I have different versions of Perl -- and paths for 5.8.0 on the older machine, and 5.8.6 down to 5.8.3 on the new machine. Interesting. And where did Mail::Sendmail end up, anyway?
/usr/lib/perl5/site_perl/5.8.0/Mail/Sendmail.pm
Ah .. it was intalled in the 5.8.0 path. And that's not part of @INC, so the compiler complains. Now for my question.

Should I pass an argument to rpm so that the module installs somewhere Perl can find it? Should I hack in a sym-link (I'd prefer not to move the Mail::Sendmail module by brute force)? Would newer versions of the RPM go into a higher version of the /usr/lib/perl5 tree?

There are going to be other modules I have to update, and I want to do this the right way (for some definition of right).

Thanks all.

Update Thanks for the responses .. it looks like I don't have to deal with this issue now, since this server isn't going to host this service after all. But it is good to know that sym-links wouldn't have been a horrible hack, and I knew about the PERLLIB setting as well (suitable, since this was for a cron job anyway).

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to @INC and using older modules with newer Perl versions by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.