* Dennis Daupert <[EMAIL PROTECTED]> [2004/03/02 09:13]:
> I'm trying to get the Mail.pm plugin working from "Perl Template Toolkit."
> I've typed in the code word-for-word straight from the book, Example 8-11.

I've attached Mail.pm, just in case.

> I set plugin base:
> 
> my $template = Template->new ({
>     INCLUDE_PATH => '/blah:/blah',
>     PLUGIN_BASE => 'MyOrg::Template::Plugin',
>     VARIABLES => \%globals,
> });
> 
> My page has:
> 
> [%  USE Mail %]
> 
> I get this error:
> 
> plugin error - Can't locate object method "load" via package
> "MyOrg::Template::Plugin::Mail" at
> /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Template/Plugins.pm
> line 213.

Except for the error message, this all looks good.  In fact, I don't get
this error message when I copy, paste, and run exactly what you've got
here.  Try running it with debugging on:

  use Template::Constants qw(:debug);

  my $template = Template->new ({
      INCLUDE_PATH => '/blah:/blah',
      PLUGIN_BASE => 'MyOrg::Template::Plugin',
      VARIABLES => \%globals,
      DEBUG => DEBUG_PLUGINS,
  });
  $template->process(\"[% USE Mail %]") or die $template->error;

And see what comes out.  I get:

  [Template::Plugins] fetch(Mail, <no args>, Template::Context=HASH(0x82519c4))
  [Template::Plugins] loading MyOrg/Template/Plugin/Mail.pm (PLUGIN_BASE)
  [Template::Plugins] calling MyOrg::Template::Plugin::Mail->load()
  [Template::Plugins] Mail => MyOrg::Template::Plugin::Mail

(darren)

-- 
An idea is not responsible for the people who believe in it.

Attachment: Mail.pm
Description: Perl program

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to