NAME
CGI::Application::Plugin::Phrasebook - A CGI::Application plugin for Data::Phrasebook
SYNOPSIS
package MyCGIApp;
use base 'CGI::Application';
use CGI::Application::Plugin::Phrasebook;
sub cgiapp_prerun {
my $self = shift;
$self->config_phrasebook(
class => 'Plain',
loader => 'YAML',
file => 'conf/my_phrasebook.yml',
);
# ... do other stuff here ...
}
sub some_run_mode {
my $self = shift;
# grab the phrasebook instance
# and fetch a keyword from it
return $self->phrasebook->fetch('a_phrasebook_keyword');
}
DESCRIPTION
This is a very simple plugin which provides access to an instance of Data::Phrasebook inside your CGI::Application. I could have just stuffed this in with param
, but this way is much nicer (and easier to type).
METHODS
- config_phrasebook (@phrasebook_args)
-
This configures your Data::Phrasebook instance by simply passing any arguments onto
Data::Phrasebook::new
. It then stashes it into the CGI::Application instance. - phrasebook
-
This will return the Data::Phrasebook instance, or undef if one has not yet been configured.
SEE ALSO
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2006 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.