On Tue, Apr 14, 2009 at 01:21:09PM -0400, Perrin Harkins wrote: > On Tue, Apr 14, 2009 at 12:48 PM, Roberto C. Sánchez > <[email protected]> wrote: > > As far as loading the module, I have tried: > > > > - "PerlModule Example::Image" in .htaccess > > - "use Example::Image;" in the main HTML::Mason component > > Either of those should be ok. If you decide to export the sub later, > you'd need to call it from Mason. > I'm not sure what you mean by this.
> > As far as calling the function:
> >
> > - get_image_data('masthead.png', $urls{'img'}, $dirs{'img'});
> > - Example::Image::get_image_data('masthead.png', $urls{'img'},
> > $dirs{'img'});
>
> Ok, I don't see how the first one could work with the code you've
> shown. You're defining the sub in a package, so you either have to
> export it or call it with the fully-qualified path, like you do in the
> second case.
>
I have used the first syntax and have not noticed a different in the
prevalence of the "Undefined subroutine" error between the two.
> If you're not familiar with this stuff, read up on exporting in the
> perlmod man page or your favorite Perl book.
>
> If you use the second syntax everywhere, I think this problem will go
> away. The issue is with the sub being available in your current
> namespace, not with loading the module.
>
I am currently using the latter call everywhere and it is still
generating the "Undefined subroutine" error.
> - Perrin
Regards,
-Roberto
--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com
signature.asc
Description: Digital signature
