NAME

WWW::Romeo - Where for art thou?

SYNOPSIS

PerlModule WWW::Romeo
<Location />
   SetHandler perl-script
   PerlHandler WWW::Romeo
</Location>

DESCRIPTION

WWW::Romeo is a web framework distilled from the remains of the BadNews content management system. The overall philosophy of WWW::Romeo is to be as simple as possible, providing only the features that are absolutely necessary to most projects while keeping developers free to innovate the web.

ACCESSOR METHODS

  • start_time - get/set the time this request started processing, by default it will be populated by WWW::Romeo with a Time::HiRes::time() value.

  • theme - get/set the theme this object was instantiated with, themes can come from the URI [% romeo.romeo_location %]/themes/<theme_name>/, the Session (theme value saved because of sticky_themes), HTTP parameters, or from the configuration file (default_theme). You can also set it here before calling render_page.

    $romeo->param('favorite_countries', qw/Spain Portugal Greece/);

  • instance - returns the hostname of this virtual host, and is used internally to figure out which virtual host that WWW::Romeo is serving content for.

  • romeo_location - returns the <Location> that WWW::Romeo is configured to serve.

  • user_agent - returns the client's provided web browser / user agent information.

  • agent_is_robot - returns true if the user agent was determined to be a robot.

  • cgi - returns this request's instantiated Apache2::Request object

  • template - returns this request's instantiated Template object

  • uri - returns this request's full uri as a string

  • uri_components - returns an array of the uri path AFTER romeo_location split by directory delimiter "/"

  • request - returns this request's instantiated Apache2::RequestRec object

  • app_base - returns the beginning of the application, in URL form e.g. http://myapp.com:8080/my/romeo/app/

METHODS THAT DO STUFF

  • param - get/set url parameters from the Apache2::Request object. Since Apache 2.x's APR::Table is populated and made read-only, WWW::Romeo allows you to set parameters here for the lifecycle of the request.

  • new - generic constructor, blesses a hash of passed attirbutes, most of the ACCESSOR METHODS specified above are initially populated here by the handler() method.

  • db - returns an instantiated WWW::Romeo::DB (DBIx::Class::Schema) object.

  • deploy - deploy's WWW::Romeo's schema using the DBIx::Class::Schema deploy method. CAUTION: passes add_drop_table, and will DESTROY any data currently in the tables.

  • user - when passed a username, returns a WWW::Romeo::DB::User object.

    my $user = $romeo->user('mikeyg');

  • user_by_email - similar to user, but takes an email address as a parameter instead.

  • c - returns this instance's instantiated WWW::Romeo::Config object.

  • tc - returns this instance's theme configuration (WWW::Romeo::Config) for the currently selected theme.

  • render_page - renders the page <page_name>.<template_file_ext> using the instantiated Template object, takes arguments page_name (with or without extension), and a hashref containing the template namespace.

    $romeo->render_page('beach_pictures', { title => 'Me and Kriss at the beach!' });

  • render_error - renders error.<template_file_ext> using the instantiated Template object, takes arguments error_string, and a hashref containing the template namespace.

    $romeo->render_error('Lol, nub!');

  • session - returns a session for the user, either the authenticated user_session, or an anon_session if no authenticated session is found.

  • time_taken - returns a %.5f float representing the amount of time since the request started processing.

  • run_extension - when passed the Apache2::RequestRec object, and the uri_components array, run_extension loads and runs a WWW::Romeo::Extension (or other) class's handle_request method, instantiating its class and passing it the Apache2::RequestRec object, and the url_components array. Will search the configured extension_base_class namespace first for the extension, or WWW::Romeo::Extension's namespace by default. If nothing is found there, it will attempt to load the extension literally.

AUTHOR

Michael Gregorowicz, <mike@mg2.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Michael Gregorowicz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.