I have this little program:
lauxastst01:~/bin:cat test.pl #!/usr/bin/perl -w use strict; use Date::Manip qw(UnixDate); use XML::Twig; print "OK!\n";
When I run it from the command line, it outputs OK! When I run it as a cron job, it outputs this:
Can't load '/usr/local/perl/5.8.2/lib/site_perl/5.8.2/sun4-solaris/aut +o/XML/Parser/Expat/Expat.so' for module XML::Parser::Expat: ld.so.1: +perl: fatal: libexpat.so.0 : open failed: No such file or directory at /usr/local/perl/5.8.2/lib/ +5.8.2/sun4-solaris/DynaLoader.pm line 229. at /usr/local/perl/5.8.2/lib/site_perl/5.8.2/sun4-solaris/XML/Parser. +pm line 14 Compilation failed in require at /usr/local/perl/5.8.2/lib/site_perl/5 +.8.2/sun4-solaris/XML/Parser.pm line 14. BEGIN failed--compilation aborted at /usr/local/perl/5.8.2/lib/site_pe +rl/5.8.2/sun4-solaris/XML/Parser.pm line 18. Compilation failed in require at /usr/local/perl/5.8.2/lib/site_perl/5 +.8.2/XML/Twig.pm line 98. BEGIN failed--compilation aborted at /usr/local/perl/5.8.2/lib/site_pe +rl/5.8.2/XML/Twig.pm line 98. Compilation failed in require at ./test.pl line 4. BEGIN failed--compilation aborted at ./test.pl line 4.
It complains about Expat.so, which, I guess is required by Parser.pm, which, I guess is required by XML::Twig. Notice that I included a 'use' for Date::Manip before XML::Twig to show that it is not incapable of finding all modules, just that it can't find XML::Twig in the crontab environment. What gives?

In reply to Twig in a crontab? by BenHopkins

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.