.\" 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::Web 3pm" .TH Jifty::Web 3pm "2011-04-25" "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::Web \- Web framework for a Jifty application .SH "METHODS" .IX Header "METHODS" \fInew\fR .IX Subsection "new" .PP Creates a new \f(CW\*(C`Jifty::Web\*(C'\fR object .PP \fImason\fR .IX Subsection "mason" .PP Returns a HTML::Mason::Request object .PP \fIout\fR .IX Subsection "out" .PP Send a string to the browser. .PP \fIurl\fR .IX Subsection "url" .PP Returns the root url of this Jifty application. This is pulled from the configuration file. Takes an optional named path which will form the path part of the resulting \s-1URL\s0. .PP \fIserial\fR .IX Subsection "serial" .PP Returns a unique identifier, guaranteed to be unique within the runtime of a particular process (i.e., within the lifetime of Jifty.pm). There's no sort of global uniqueness guarantee, but it should be good enough for generating things like moniker names. .SS "\s-1SESSION\s0 \s-1MANAGEMENT\s0" .IX Subsection "SESSION MANAGEMENT" \fIsetup_session\fR .IX Subsection "setup_session" .PP Sets up the current \f(CW\*(C`session\*(C'\fR object (a Jifty::Web::Session tied hash). Aborts if the session is already loaded. .PP \fIsession\fR .IX Subsection "session" .PP Returns the current session's hash. In a regular user environment, it persists, but a request can stop that by handing it a regular hash to use. .SS "\s-1CURRENT\s0 \s-1USER\s0" .IX Subsection "CURRENT USER" \fIcurrent_user [\s-1USER\s0]\fR .IX Subsection "current_user [USER]" .PP Getter/setter for the current user; this gets or sets the 'user' key in the session. These are Jifty::Record objects. .PP If a temporary_current_user has been set, will return that instead. .PP If the current application has no loaded current user, we get an empty app-specific \f(CW\*(C`CurrentUser\*(C'\fR object. (This \&\f(CW\*(C`ApplicationClass\*(C'\fR::CurrentUser class, a subclass of Jifty::CurrentUser, is autogenerated if it doesn't exist). .PP \fItemporary_current_user [\s-1USER\s0]\fR .IX Subsection "temporary_current_user [USER]" .PP Sets the current request's current_user to \s-1USER\s0 if set. .PP This value will _not_ be persisted to the session at the end of the request. To restore the original value, set temporary_current_user to undef. .SS "\s-1REQUEST\s0" .IX Subsection "REQUEST" \fIhandle_request [\s-1REQUEST\s0]\fR .IX Subsection "handle_request [REQUEST]" .PP This method sets up a current session, and then processes the given Jifty::Request object. If no request object is given, processes the request object in \*(L"request\*(R". .PP Each action on the request is vetted in three ways \*(-- first, it must be marked as \f(CW\*(C`active\*(C'\fR by the Jifty::Request (this is the default). Second, it must be in the set of allowed classes of actions (see \&\*(L"is_allowed\*(R" in Jifty::API). Finally, the action must validate. If it passes all of these criteria, the action is fit to be run. .PP Before they are run, however, the request has a chance to be interrupted and saved away into a continuation, to be resumed at some later point. This is handled by \*(L"save_continuation\*(R" in Jifty::Request. .PP If the continuation isn't being saved, then \f(CW\*(C`handle_request\*(C'\fR goes on to run all of the actions. If all of the actions are successful, it looks to see if the request wished to call any continuations, possibly jumping back and re-running a request that was interrupted in the past. This is handled by \*(L"call_continuation\*(R" in Jifty::Request. .PP For more details about continuations, see Jifty::Continuation. .PP \fIrequest [\s-1VALUE\s0]\fR .IX Subsection "request [VALUE]" .PP Gets or sets the current Jifty::Request object. .PP \fIresponse [\s-1VALUE\s0]\fR .IX Subsection "response [VALUE]" .PP Gets or sets the current Jifty::Response object. .PP \fIform\fR .IX Subsection "form" .PP Returns the current Jifty::Web::Form object, creating one if there isn't one already. .PP \fInew_action class => \s-1CLASS\s0, moniker => \s-1MONIKER\s0, order => \s-1ORDER\s0, arguments => \s-1PARAMHASH\s0\fR .IX Subsection "new_action class => CLASS, moniker => MONIKER, order => ORDER, arguments => PARAMHASH" .PP Creates a new action (an instance of a subclass of Jifty::Action). The named arguments passed to this method are passed on to the \f(CW\*(C`new\*(C'\fR method of the action named in \f(CW\*(C`CLASS\*(C'\fR. If you pass an odd number of arguments, then the first argument is interpreted as \f(CW\*(C`class\*(C'\fR. .PP \fIArguments\fR .IX Subsection "Arguments" .IP "class" 4 .IX Item "class" \&\f(CW\*(C`CLASS\*(C'\fR is qualified, and an instance of that class is created, passing the \f(CW\*(C`Jifty::Web\*(C'\fR object, the \f(CW\*(C`MONIKER\*(C'\fR, and any other arguments that \f(CW\*(C`new_action\*(C'\fR was supplied. .IP "moniker" 4 .IX Item "moniker" \&\f(CW\*(C`MONIKER\*(C'\fR is a unique designator of an action on a page. The moniker is content-free and non-fattening, and may be auto-generated. It is used to tie together arguments that relate to the same action. .IP "order" 4 .IX Item "order" \&\f(CW\*(C`ORDER\*(C'\fR defines the order in which the action is run, with lower numerical values running first. .IP "arguments" 4 .IX Item "arguments" \&\f(CW\*(C`ARGUMENTS\*(C'\fR are passed to the \*(L"new\*(R" in Jifty::Action method. In addition, if the current request (\f(CW\*(C`$self\->request\*(C'\fR) contains an action with a matching moniker, any arguments that are in that requested action but not in the \f(CW\*(C`PARAMHASH\*(C'\fR list are set. This implements \*(L"sticky fields\*(R". .PP As a contrast to \*(L"add_action\*(R" in Jifty::Web::Form, this does not add the action to the current form \*(-- instead, the first form field to be rendered will automatically register the action in the current form field at that time. .PP \fInew_action_from_request \s-1REQUESTACTION\s0\fR .IX Subsection "new_action_from_request REQUESTACTION" .PP Given a Jifty::Request::Action, creates a new action using \f(CW\*(C`new_action\*(C'\fR. .PP \fIfailed_actions\fR .IX Subsection "failed_actions" .PP Returns an array of Jifty::Action objects, one for each Jifty::Request::Action that is marked as failed in the current response. .PP \fIsucceeded_actions\fR .IX Subsection "succeeded_actions" .PP As \*(L"failed_actions\*(R", but for actions that completed successfully; less often used. .SS "\s-1REDIRECTS\s0 \s-1AND\s0 \s-1CONTINUATIONS\s0" .IX Subsection "REDIRECTS AND CONTINUATIONS" \fInext_page [\s-1VALUE\s0]\fR .IX Subsection "next_page [VALUE]" .PP Gets or sets the next page for the framework to show. This is normally set during the \f(CW\*(C`take_action\*(C'\fR method or a Jifty::Action .PP \fIforce_redirect [\s-1VALUE\s0]\fR .IX Subsection "force_redirect [VALUE]" .PP Gets or sets whether we should force a redirect to \f(CW\*(C`next_page\*(C'\fR, even if it's already the current page. You might set this, e.g. to force a redirect after a POSTed action. .PP \fIredirect_required\fR .IX Subsection "redirect_required" .PP Returns true if we need to redirect, now that we've processed all the actions. We need a redirect if either \f(CW\*(C`next_page\*(C'\fR is different from the current page, or \f(CW\*(C`force_redirect\*(C'\fR has been set. .PP \fIwebservices_redirect [\s-1TO\s0]\fR .IX Subsection "webservices_redirect [TO]" .PP Handle redirection inside webservices call. This is meant to be hooked by plugin that knows what to do with it. .PP \fIredirect [\s-1TO\s0]\fR .IX Subsection "redirect [TO]" .PP Redirect to the next page. If you pass this method a parameter, it redirects to that \s-1URL\s0 rather than \fBnext_page\fR. .PP It creates a continuation of where you want to be, and then calls it. If you want to redirect to a page with parameters, pass in a Jifty::Web::Form::Clickable object. .PP \fIcaller\fR .IX Subsection "caller" .PP Returns the Jifty::Request of our enclosing continuation, or an empty Jifty::Request if we are not in a continuation. .SS "\s-1HTML\s0 \s-1GENERATION\s0" .IX Subsection "HTML GENERATION" \fItangent \s-1PARAMHASH\s0\fR .IX Subsection "tangent PARAMHASH" .PP If called in non-void context, creates and renders a Jifty::Web::Form::Clickable with the given \fI\s-1PARAMHASH\s0\fR, forcing a continuation save. .PP In void context, does a redirect to the \s-1URL\s0 that the Jifty::Web::Form::Clickable object generates. .PP Both of these versions preserve all state variables by default. .PP \fIgoto \s-1PARAMHASH\s0\fR .IX Subsection "goto PARAMHASH" .PP Does an instant redirect to the url generated by the Jifty::Web::Form::Clickable object generated by the \fI\s-1PARAMHASH\s0\fR. .PP \fIlink \s-1PARAMHASH\s0\fR .IX Subsection "link PARAMHASH" .PP Generates and renders a Jifty::Web::Form::Clickable using the given \&\fI\s-1PARAMHASH\s0\fR. .PP \fIreturn \s-1PARAMHASH\s0\fR .IX Subsection "return PARAMHASH" .PP If called in non-void context, creates and renders a Jifty::Web::Form::Clickable using the given \fI\s-1PARAMHASH\s0\fR, additionally defaults to calling the current continuation. .PP Takes an additional argument, \f(CW\*(C`to\*(C'\fR, which can specify a default path to return to if there is no current continuation. .PP In void context, does a redirect to the \s-1URL\s0 that the Jifty::Web::Form::Clickable object generates. .SS "template_exists \s-1PATH\s0" .IX Subsection "template_exists PATH" Returns true if \s-1PATH\s0 is a valid template inside your template root. This checks for both Template::Declare and HTML::Mason Templates. Specifically, returns a reference to the handler which can process the template. .PP If \s-1PATH\s0 is a \fIreference\fR to the path, it will update the path to append \f(CW\*(C`/index.html\*(C'\fR if the path in question doesn't exist, but the index does. .SS "render_template \s-1PATH\s0" .IX Subsection "render_template PATH" Use our templating system to render a template. Searches through \&\*(L"view_handlers\*(R" in Jifty::Handler to find the first handler which provides the given template, and caches the handler for future requests. .PP Catches errors, and redirects to \f(CW\*(C`/errors/500\*(C'\fR; also shows \&\f(CW\*(C`/errors/404\*(C'\fR if the template cannot be found. .PP \fIrender_messages [\s-1MONIKER\s0]\fR .IX Subsection "render_messages [MONIKER]" .PP Outputs any messages that have been added, in
and
tags. Messages are added by calling \&\*(L"message\*(R" in Jifty::Result. .PP If a moniker is specified, only messages for that moniker are rendered. .PP \fIrender_success_messages [\s-1MONIKER\s0]\fR .IX Subsection "render_success_messages [MONIKER]" .PP Render success messages for the given moniker, or all of them if no moniker is given. .PP \fIrender_error_messages [\s-1MONIKER\s0]\fR .IX Subsection "render_error_messages [MONIKER]" .PP Render error messages for the given moniker, or all of them if no moniker is given. .PP \fI_render_messages \s-1TYPE\s0 [\s-1MONIKER\s0]\fR .IX Subsection "_render_messages TYPE [MONIKER]" .PP Output any messages of the given \s-1TYPE\s0 (either 'error' or 'message') in a
tag. If a moniker is given, only renders messages for that action. Internal helper for \*(L"render_success_messages\*(R" and \&\*(L"render_errors\*(R". .PP \fIquery_string \s-1KEY\s0 => \s-1VALUE\s0 [, \s-1KEY\s0 => \s-1VALUE\s0 [, ...]]\fR .IX Subsection "query_string KEY => VALUE [, KEY => VALUE [, ...]]" .PP Returns an URL-encoded query string piece representing the arguments passed to it. .PP \fIescape \s-1STRING\s0\fR .IX Subsection "escape STRING" .PP HTML-escapes the given string and returns it .PP \fIescape_uri \s-1STRING\s0\fR .IX Subsection "escape_uri STRING" .PP URI-escapes the given string and returns it .PP \fInavigation\fR .IX Subsection "navigation" .PP Returns the Jifty::Web::Menu for this web request; one is automatically created if it hasn't been already. .PP \fIpage_navigation\fR .IX Subsection "page_navigation" .PP Returns the Jifty::Web::Menu for this web request; one is automatically created if it hasn't been already. This is useful for separating page-level navigation from app-level navigation. .PP \fIinclude_css\fR .IX Subsection "include_css" .PP Returns a \f(CW\*(C`\*(C'\fR tag for the compressed \s-1CSS\s0 .PP \fIadd_css \s-1FILE1\s0, \s-1FILE2\s0, ...\fR .IX Subsection "add_css FILE1, FILE2, ..." .PP Pushes files onto \f(CW\*(C`Jifty\->web\->css_files\*(C'\fR .PP \fIinclude_javascript\fR .IX Subsection "include_javascript" .PP Returns a \f(CW\*(C`