Statocles::App - Base role for Statocles applications
version 0.085
package MyApp; use Statocles::Base 'Class'; with 'Statocles::App'; sub pages { return Statocles::Page::Content->new( path => '/index.html', content => 'Hello, World', ); }
A Statocles App creates a set of pages that can then be written to the filesystem (or served directly, if desired).
Pages can be created from documents stored in a store (see Statocles::Page::Document), files stored in a store (see Statocles::Page::File), lists of content (see Statocles::Page::List), or anything at all (see Statocles::Page::Content).
The site this app is part of.
A hash of arbitrary data available to theme templates. This is a good place to put extra structured data like social network links or make easy customizations to themes like header image URLs.
The URL root of this application. All pages from this app will be under this root. Use this to ensure two apps do not try to write the same path.
The templates to use for this application. A mapping of template names to template paths (relative to the theme root directory).
Developers should get application templates using the template method.
template
The directory (inside the theme directory) to use for this app's templates.
my @pages = $app->pages;
Get the pages for this app. Must return a list of Statocles::Page objects.
my $app_url = $app->url( $path );
Get a URL to a page in this application. Prepends the app's url_root attribute if necessary. Strips "index.html" if possible.
my $link = $app->link( %args )
Create a link to a page in this application. %args are attributes to be given to Statocles::Link constructor. The app's url_root attribute is prepended, if necessary.
%args
my $template = $app->template( $tmpl_name );
Get a template object for the given template name. The default template is determined by the app's class name and the template name passed in.
Applications should list the templates they have and describe what page class they use.
All apps by default expose the following events:
This event is fired after the app pages have been prepares and are ready to be rendered. This event allows for modifying the pages before they are rendered.
The event will be a Statocles::Event::Pages object containing all the pages prepared by the app.
These applications are included with the core Statocles distribution.
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Statocles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Statocles
CPAN shell
perl -MCPAN -e shell install Statocles
For more information on module installation, please visit the detailed CPAN module installation guide.