[Catalyst] How to pass vars to modules

Daniel Hulme st at istic.org
Fri Apr 27 17:38:02 GMT 2007


On Fri, Apr 27, 2007 at 05:06:40PM +0100, RA Jones wrote:
> Dave Rolsky wrote:
> >Where in the tutorial does it suggest you load non-Catalyst modules 
> >like this?
> >
> >
> Sorry, it wasn't the tutorial, but the catalyst POD under the 
> Description section:
> 
> If your plugin starts with a name other than Catalyst::Plugin::, you can 
> fully qualify the name by using a unary plus:
> 
>   use Catalyst qw/
>       My::Module
>       +Fully::Qualified::Plugin::Name
>   /;
Perhaps it would be good to reword this paragraph of the docs to avoid
similar confusion in future. Although it was clear to me that it only
suggested loading Catalyst plugins, and not other Perl modules, this
way, I can see the ambiguity now it has been pointed out. I suggest the
following:

If you want to load a Catalyst plugin that doesn't live in the
Catalyst::Plugin:: namespace, you can fully qualify the name by
prepending a plus sign. For example, this:

  use Catalyst qw/
      My::Module
      +Fully::Qualified::Plugin::Name
  /;

will load and initialise Catalyst with the plugins
Catalyst::Plugin::My::Module and Fully::Qualified::Plugin::Name.

If you want to load a Perl module that isn't a Catalyst plugin, just
C<use> or C<require> it in each of your modules that needs it, in the
traditional way.

-- 
"And I see losing love is like a  window in your heart:  everybody sees 
 you're  blown  apart;  everybody  sees  the  wind  blow  in Graceland."
 -- Paul Simon, 1986
http://surreal.istic.org/                         How's it going to end?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070427/33a5c7a1/attachment.pgp


More information about the Catalyst mailing list