- improved exception handling
- now uses File::MMagic::XS to guess mime type of output unless already set
- new component method provides Maypole::Component functionality
- improved exception handling
- now uses File::MMagic::XS to guess mime type of output unless already set
- new component method provides Maypole::Component functionality
+ - new object method gets/sets first/only object in objects
Maypole::Model
- do_delete, do_search in place of delete/search actions
Maypole::View::TT:
Maypole::Model
- do_delete, do_search in place of delete/search actions
Maypole::View::TT:
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Maypole
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Maypole
version_from: lib/Maypole.pm
installdirs: site
requires:
version_from: lib/Maypole.pm
installdirs: site
requires:
Class::DBI::SQLite: 0
Digest::MD5: 0
File::MMagic::XS: 0.08
Class::DBI::SQLite: 0
Digest::MD5: 0
File::MMagic::XS: 0.08
HTTP::Body: 0.5
HTTP::Headers: 1.59
Template: 0
HTTP::Body: 0.5
HTTP::Headers: 1.59
Template: 0
class, it will be removed from C<args> and the retrieved object will be added to
the C<objects> list. See L<Maypole::Model> for more information.
class, it will be removed from C<args> and the retrieved object will be added to
the C<objects> list. See L<Maypole::Model> for more information.
+
+=item object
+
+Alias to get/set the first/only model object. The object will be accessible
+in the view templates.
+
+When used to set the object, will overwrite the request objects
+with a single object.
+
+=cut
+
+sub object {
+ my ($r,$object) = @_;
+ $r->objects([$object]) if ($object);
+ return undef unless $r->objects();
+ return $r->objects->[0];
+}
+
=item template_args
$self->template_args->{foo} = 'bar';
=item template_args
$self->template_args->{foo} = 'bar';
-A place to put custom application data. Not used by Maypole itself.
+A place to put custom application data. Not used by Maypole itself.
request => $r,
objects => $r->objects,
base => $base,
request => $r,
objects => $r->objects,
base => $base,
+ config => $r->config,
+ object => $r->object,
}
if ($tt->process(\$error_template,
{ err_type => $type, error => $error,
}
if ($tt->process(\$error_template,
{ err_type => $type, error => $error,
- config => { (%{$r->{config}}) },
- request => $r, # We have that at least
+ config => $r->{config},
+ request => $r,
eval{$self->vars($r)} }, \$output )) {
$r->{output} = $output;
if ($tt->error) { $r->{output} = "<html><body>Even the error template
eval{$self->vars($r)} }, \$output )) {
$r->{output} = $output;
if ($tt->error) { $r->{output} = "<html><body>Even the error template
<h2> Request details </h2>
<h2> Request details </h2>
-<table>
- [% FOR thing = ["model_class", "table", "template", "path",
+<table>
+ [% FOR attribute = ["model_class", "table", "template", "path",
"content_type", "document_encoding", "action", "args", "objects"] %]
"content_type", "document_encoding", "action", "args", "objects"] %]
- <tr> <td class="lhs"> [%thing %] </td> <td class="rhs"> [%
- request.$thing.list.join(" , ") %] </td></tr>
+ <tr> <td class="lhs"> [% attribute %] </td> <td class="rhs"> [%
+ request.$attribute.list.join(" , ") %] </td></tr>
[% END %]
</table>
<h2> Application configuration </h2>
[% END %]
</table>
<h2> Application configuration </h2>
-<table>
- [% FOR thing = config.keys %]
- <tr> <td class="lhs"> [%thing %] </td> <td class="rhs"> [%
- config.$thing.list.join(" , ") %] </td></tr>
+<table>
+ [% FOR field IN config %]
+ <tr> <td class="lhs"> [% field.key %] </td> <td class="rhs"> [%
+ $field.value.list.join(" , ") %] </td></tr>