I ran into a problem while using PDF::Template. Specifically, my script dies with this message:
Can't locate object method "ToUpper" via package "main" (perhaps you f +orgot to load "main"?) at \ /usr/lib/perl5/5.6.1/utf8_heavy.pl line 30

Line 30 of utf8_heavy.pl looks like this:

$list ||= eval { $caller->$type(); } || do "$file.pl" || do "$encoding/$file.pl" || do "$encoding/Is/${type}.pl" || croak("Can't find $encoding character property definition v +ia $caller->$type or $file.pl");

It appears to be the eval call where the code is dying, but I thought that eval should trap the problem. The same code (with the same utf8_heavy.pl) running on a different system works: Mac OS X works, Mandrake Linux doesn't.

I've resorted to this horrible cludge to get my code working for now, but obviously a better solution would be appreciated:

if ($file eq 'To/Upper') { $list = do '/usr/lib/perl5/5.6.1/unicode/To/Upper.pl'; } elsif ($file eq 'To/Lower') { $list = do '/usr/lib/perl5/5.6.1/unicode/To/Lower.pl'; } else { $list ||= eval { $caller->$type(); } || do "$file.pl" || do "$encoding/$file.pl" || do "$encoding/Is/${type}.pl" || croak("Can't find $encoding character property definiti +on via $caller->$type or $file.pl"); }

In reply to Problem in utf8_heavy.pl by genecutl

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.