CGI-Ex-Recipes

 view release on metacpan or  search on metacpan

lib/CGI/Ex/Recipes.pm  view on Meta::CPAN

This is good, because CGI::Ex::Recipes has done his job, by providing a codebase and 
starting point for you.

You are wellcome to give feedback if you think some functionality is enough 
common to go up straight to CGI::Ex::App.

Bellow are described  overriten methods and methods defined in this package.  

=head2 load_conf

Returns  the value of C<$self-E<gt>{load_conf}> or 1(TRUE) by default.

=head2 pre_step

Returns 0 after executing C<$self-E<gt>step_args()>.

=head2 allow_morph

Blindly returns the current value of allow_morph key in Recipes.conf,
which should be interpreted as TRUE or FALSE.

=head2 path_info_map

This is just our example implementation, following recomendations in L<CGI::Ex::App|CGI::Ex::App>.

=head2 skip

Ran at the beginning of the loop before prepare, info_complete, and finalize are called. 
If it returns true, nav_loop moves on to the next step (the current step is skipped).

In our case we bind it to the presence of the C<id> parameter from the HTTP request. 
So if there is an C<id> parameter it returns 0, otherwise 1.

=head2 get_pass_by_user

Returns the password for the given user. See the get_pass_by_user method of CGI::Ex::Auth 
for more information. Installed as a hook to the authentication object during the 
get_valid_auth method.

We get the password from the configuration file, which is enough for 
this demo, but you can do and SQL query for that purpose if you store
your users' info in the database.

=head2 require_auth

Returns 0 or 1 depending on configuration for individual steps.
This way we make only some steps to require authentication.

=head2 auth_args

Get authentication arguments from configuration if there is such
and returns a hashref. The template_args are merged in also.

=head2 hash_base

The extra work done here is that we use L<Scalar::Util|Scalar::Util> to C<weaken> 
the reference to the main application which we pass for use from within the templates and 
template plugins. Without doing this we may have problems under persistent environments, such as 
mod_perl. This is very handy when you need to dynamically generate HTML or 
use the attached DBI object. 
See L<CGI::Ex::Recipes::Template::Menu|CGI::Ex::Recipes::Template::Menu>, L<CGI::Ex::App|CGI::Ex::App>.

=head2 base_dir_abs

See also L<CGI::Ex::App|CGI::Ex::App>.

=head2 conf

Currently we use the old C<CGI::Ex::App::conf()>, 
so the configuration file is found as it was before CGI::Ex 2.18. 
See also L<CGI::Ex::App|CGI::Ex::App>.

=head2 ext_conf

We prefer C<conf> file extension as default over C<pl>.
See also L<CGI::Ex::App|CGI::Ex::App>.

=head2 pre_navigate

We have naive code here for logging out a user.
See also L<CGI::Ex::App|CGI::Ex::App>.

=head2 post_navigate

Currently I placed here a set of C<debug> statements for fun.
See also L<CGI::Ex::App|CGI::Ex::App>.


=head2 step_args

hook/method - returns parsed arguments from C<$self->form->{step_info}> 
for the curent step.
Initially called in pre_step.
Not in L<CGI::Ex::App|CGI::Ex::App>.

=head2 cache

Returns the cache object. See L<CGI::Ex::Recipes::Cache|CGI::Ex::Recipes::Cache>.
Not in L<CGI::Ex::App|CGI::Ex::App>.

=head1 UTILITY METHODS

These may go in another module - created specifically for this purpose.
And ofcource there are plenty of modules providing beter implementation.

=head2 strftmime

=head2 now

=head1 AUTHOR

Красимир Беров, C<< <k.berov at gmail.com> >>

=head1 BUGS

Probably many.

Please report any bugs or feature requests to k.berov@gmail.com by putting "CGI::Ex::Recipes" 
in the Subject line

=head1 ACKNOWLEDGEMENTS



( run in 0.602 second using v1.01-cache-2.11-cpan-39bf76dae61 )