X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FWeb%2FSimple.pm;h=1116d5135e5fc357adadca6afc4e274e9664ded9;hb=4061606f304b183818e175a780c87c5612a5a0ed;hp=a334187e76928d961ecf1833a10ee4e380dbf8bd;hpb=20645c5fa990200aa5e75011113659c4513c4c50;p=catagits%2FWeb-Simple.git diff --git a/lib/Web/Simple.pm b/lib/Web/Simple.pm index a334187..1116d51 100644 --- a/lib/Web/Simple.pm +++ b/lib/Web/Simple.pm @@ -1,12 +1,11 @@ package Web::Simple; use strictures 1; -use 5.008; use warnings::illegalproto (); use Moo (); use Web::Dispatch::Wrapper (); -our $VERSION = '0.020'; +our $VERSION = '0.028'; sub import { my ($class, $app_package) = @_; @@ -245,12 +244,14 @@ route is to provide a Dancer like key-value list: my $self = shift; ( '.html' => sub { response_filter { $self->render_zoom($_[0]) } }, - '/user/*' => sub { $self->users->get($_[1]) }< + '/user/*' => sub { $self->users->get($_[1]) }, + 'POST + %*' => 'handle_post', ) } This can be useful in situations where you are generating a dispatch table -programmatically, where setting a subroutines protoype is difficult. +programmatically, where setting a subroutines protoype is difficult. Note that +in the example above, C is a method that would be called. to render a user object to HTML, if there is an incoming URL such as: @@ -264,7 +265,7 @@ This user object 'bubbles up' through all the wrapping middleware until it hits the C we defined, after which the return is converted to a true html response. -However, two types of object are treated specially - a C object +However, two types of objects are treated specially - a C object will have its C method called and be used as a dispatcher: sub dispatch_request { @@ -515,9 +516,9 @@ would write: sub (?page=&order_by~) { my ($self, $page, $order_by) = @_; return unless $page =~ /^\d+$/; - $page ||= 'id'; + $order_by ||= 'id'; response_filter { - $_[1]->search_rs({}, $p); + $_[1]->search_rs({}, { page => $page, order_by => $order_by }); } } @@ -860,6 +861,10 @@ Andrew Rodland (hobbs) Robert Sedlacek (phaylon) +Hakim Cassimally (osfameron) + +Karen Etheridge (ether) + =head1 COPYRIGHT Copyright (c) 2011 the Web::Simple L and L