NAME
Mojolicious::Plugin::ContentManagement::Source - abstract source base class
DESCRIPTION
A Mojolicious::Plugin::ContentManagement::Source is a thing that can load and write pages. This is an abstract base class.
IMPLEMENTATIONS SHIPPED WITH THIS DISTRIBUTION
- Mojolicious::Plugin::ContentManagement::Source::Filesystem
-
Store content pages in a local directory
- Mojolicious::Plugin::ContentManagement::Source::Dbi
-
Store content pages in a DBI compatible database
ATTRIBUTES
app
my $app = $source->app;
$source = $source->app($app);
The Mojolicious app object
type
my $type = $source->type;
$source = $source->type($type);
The management content type translator object (needed to build pages)
forbidden
my @forbidden = @{ $source->forbidden };
$source = $source->forbidden([ 'foo', qr(foo/.*) ]);
An array ref of paths, that must not be managed. Can contain strings and regular expressions
METHODS
If you want to be a thing that can load and save pages, you need to implement the following methods:
exists
my $truth = $source->exists('/foo/bar.html');
This method gets the path of a page and returns a true value iff such a page exists.
list
my $tree = $source->list;
This method returns a tree of all pages as an array ref of Mojolicious::Plugin::ContentManagement::Page objects.
load
my $page = $source->load('/foo/bar.html');
This method loads a Mojolicious::Plugin::ContentManagement::Page object.
save
$source = $source->save($page);
This method saves a Mojolicious::Plugin::ContentManagement::Page object.