App::Munchies - Catalyst example application using food recipes as a data set


App-Munchies documentation  | view source Contained in the App-Munchies distribution.

Index


Name

Top

App::Munchies - Catalyst example application using food recipes as a data set

Version

Top

0.4.$Revision: 794 $

Synopsis

Top

Start the development mini server with

   bin/munchies_server.pl

Description

Top

This is an example application for the CatalystX::Usul base classes

Some web applications require common controllers and data models. For example; welcome mat, authentication, password changing, navigation tools and site map are some of the controllers implemented here. Since these modules are not an end in themselves, most of the visible text is stored in XML configuration files and can be customised using the controllers and data models provided. The string "Munchies" for example is a generic application name and it is meant to be replaced with a more specific application name once it has been written

Pages are rendered using a single TT template. The template, CSS, Javascript and collection of GIFs, PNG, etc are stored together and form a "skin" for which a switching mechanism is provided. This enables development of the web application to proceed independently of the interface development. Content (provided by Perl on Catalyst) has been separated from layout (TT+CSS), presentation (CSS) and behaviour (JS). If the interface is not to your liking, write your own skin. These ideas and techniques have been aquired from http://www.csszengarden.com/ and http://www.cssplay.co.uk/

Don't even think about using anything other than a modern version of Firefox to display these pages

Installation

Top

Run these commands as root to install this application from a distribution tarball:

   tar -xvzf App-Munchies-?.?.?.tar.gz
   cd App-Munchies-?.?.?
   ./install.sh

It defaults to installing all files (including the var data) under /opt/app-munchies (which is easy to remove if this is not a permanent installation)

If you want to customise the installation then instead of install.sh run

   ./Build.PL
   ./Build --ask
   ./Build distclean
   cd ..
   tar -czf App-Munchies-local.tar.gz App-Munchies-?.?.?

which will create a local tarball. Install from this and you will not be prompted to answer any more questions

Once the schema has been deployed and populated the following (optional) commands will be run:

   bin/munchies_cli    -n -c pod2html    -o uid=[% uid %] -o gid=[% gid %]
   bin/munchies_schema -n -c catalog_mmf -o uid=[% uid %] -o gid=[% gid %]

as the munchies user. They may take some time to finish. When complete the var area of the application is about 60Mb in size

This distribution contains a setuid root program. It is used to provide limited access to root only functions, e.g. authentication against /etc/shadow. The build process asks if this should be enabled. It is not enabled by default

N.B. Remove user_root from var/secure/support.sub if it exists

N.B. Change the password for the admin account in the R02-Database realm

Subroutines/Methods

Top

list_sessions

Lists the users session data stored in Catalyst::Plugin::Session::Store::FastMmap

This method should be implemented on each of the C::P::S::Store::* backends

Diagnostics

Top

Append -d to bin/munchies_server.pl to start the mini server in debug mode

Replace the prepare body method in Catalyst.pm with this one

   sub prepare_body {
      my $c = shift;

      # Do we run for the first time?
      return if defined $c->request->{_body};

      # Initialize on-demand data
      $c->engine->prepare_body( $c, @_ );
      $c->prepare_parameters;
      $c->prepare_uploads;

      if ( $c->debug && keys %{ $c->req->body_parameters } ) {
         my $params = $c->req->body_parameters;
         my $re = $c->config->{Debug}->{skip_dump_parameters};
         my $t = Text::SimpleTable->new( [ 35, 'Parameter' ], [ 36, 'Value' ] );

         for my $key ( sort keys %{ $params } ) {
            my $param = exists $params->{ $key } ? $params->{ $key } : q();
            my $value = ref $param eq q(ARRAY)
                      ? (join q(, ), @{ $param }) : $param;

            $value = q(*) x length $value if ($re && $key =~ m{ \A $re \z }mx);

            $t->row( $key, $value );
         }

         $c->log->debug( "Body Parameters are:\n" . $t->draw );
      }
   }

Configuration and Environment

Top

Application configuration is in the file lib/app_munchies/app_munchies.xml

Dependencies

Top

Catalyst
Catalyst::Plugin::ConfigComponents
Catalyst::Plugin::InflateMore
CatalystX::Usul

Incompatibilities

Top

Cygwin - Has a wierd gecos field in the passwd file that is a problem for the identity model.

Bugs and Limitations

Top

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Top

Peter Flanigan, <Support at RoxSoft.co.uk>

Acknowledgements

Top

Larry Wall - For the Perl programming language

License and Copyright

Top


App-Munchies documentation  | view source Contained in the App-Munchies distribution.