.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Jifty::Plugin 3pm" .TH Jifty::Plugin 3pm "2010-12-08" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Jifty::Plugin \- Describes a plugin to the Jifty framework .SH "DESCRIPTION" .IX Header "DESCRIPTION" Plugins are like mini-apps. They come in packages with share directories which provide static and template files; they provide actions; they have dispatcher rules. To create the skeleton of a new plugin, you can use the command: jifty plugin \-\-name SomePlugin .PP To use a plugin in your Jifty application, find the \f(CW\*(C`Plugins:\*(C'\fR line in the \f(CW\*(C`config.yml\*(C'\fR file: .PP .Vb 5 \& Plugins: \& \- SpiffyThing: {} \& \- SomePlugin: \& arguments: to \& the: constructor .Ve .PP The dispatcher for a plugin should live in \&\f(CW\*(C`Jifty::Plugin::\f(CIname\f(CW::Dispatcher\*(C'\fR; it is written like any other Jifty::Dispatcher. Plugin dispatcher rules are checked before the application's rules; however, see \*(L"Plugins and rule ordering\*(R" in Jifty::Dispatcher for how to manually specify exceptions to this. .PP Actions and models under a plugin's namespace are automatically discovered and made available to applications. .SS "new" .IX Subsection "new" Sets up a new instance of this plugin. This is called by Jifty after reading the configuration file, and is supplied whatever plugin-specific settings were in the config file. Note that because plugins affect Mason's component roots, adding plugins during runtime is not supported. .SS "init [\s-1ARGS\s0]" .IX Subsection "init [ARGS]" Called by \*(L"new\*(R", this does any custom configuration that the plugin might need. It is passed the same parameters as \*(L"new\*(R", gleaned from the configuration file. .SS "new_request" .IX Subsection "new_request" Called right before every request. By default, does nothing. .SS "template_root" .IX Subsection "template_root" Returns the root of the \f(CW\*(C`HTML::Mason\*(C'\fR template directory for this plugin .SS "po_root" .IX Subsection "po_root" Returns the plugin's message catalog directory. Returns undef if it doesn't exist. .SS "template_class" .IX Subsection "template_class" Returns the Template::Declare view package for this plugin .SS "static_root" .IX Subsection "static_root" Returns the root of the static directory for this plugin .SS "dispatcher" .IX Subsection "dispatcher" Returns the classname of the dispatcher class for this plugin .SS "prereq_plugins" .IX Subsection "prereq_plugins" Returns an array of plugin module names that this plugin depends on. .SS "version" .IX Subsection "version" Returns the database version of the plugin. Needs to be bumped any time the database schema needs to be updated. Plugins that do not directly define any models don't need to worry about this. .SS "bootstrapper" .IX Subsection "bootstrapper" Returns the name of the class that can be used to bootstrap the database models. This normally returns the plugin's class name with \f(CW\*(C`::Bootstrap\*(C'\fR added to the end. Plugin bootstrappers can be built in exactly the same way as application bootstraps. .PP See Jifty::Bootstrap. .SS "upgrade_class" .IX Subsection "upgrade_class" Returns the name of the class that can be used to upgrade the database models and schema (such as adding new data, fixing default values, and renaming columns). This normally returns the plugin's class name with \f(CW\*(C`::Upgrade\*(C'\fR added to the end. Plugin upgrade classes can be built in exactly the same was as application upgrade classes. .PP See Jifty::Upgrade. .SS "table_prefix" .IX Subsection "table_prefix" Returns a prefix that will be placed in the front of all table names for plugin models. Be default, the plugin name is converted to an identifier based upon the class name. .SS "wrap" .IX Subsection "wrap" Takes a PSGI\-$app closure and returns the wrapped one if your plugin wants to do something to the request handling process. See also Plack::Middleware. .SS "psgi_app_static" .IX Subsection "psgi_app_static" Returns a PSGI\-$app that serves the static content of the plugin if any. The default is a app with root set to plugin's \f(CW\*(C`static_root\*(C'\fR