X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FWeb%2FSimple.pm;h=aba056f706f2d06dde7b45e6da27fb6ae0bbad6c;hb=1d2f4b67ca3f3dedd1a9a1863cee2b01a446baaa;hp=af8b59cd5e6640ccc0613b6472b77578e3dc9253;hpb=b2329322ec21508e5f1a3bec32d774da9715a95e;p=catagits%2FWeb-Simple.git diff --git a/lib/Web/Simple.pm b/lib/Web/Simple.pm index af8b59c..aba056f 100644 --- a/lib/Web/Simple.pm +++ b/lib/Web/Simple.pm @@ -6,7 +6,7 @@ use warnings::illegalproto (); use Moo (); use Web::Dispatch::Wrapper (); -our $VERSION = '0.012'; +our $VERSION = '0.018'; sub import { my ($class, $app_package) = @_; @@ -30,6 +30,8 @@ sub _export_into { $INC{"${name}.pm"} = 'Set by "use Web::Simple;" invocation'; } +1; + =head1 NAME Web::Simple - A quick and easy way to build simple web applications @@ -398,6 +400,26 @@ subdispatchers to scope common activities. For example: You should note the special case path match C which is only meaningful when it is contained in this type of path match. It matches to an empty path. +=head4 Naming your patch matches + +Any */**/*.*/**.* match can be followed with :name to make it into a named +match, so: + + sub (/*:one/*:two/*:three/*:four) { + "I match /1/2/3/4 capturing { one => 1, two => 2, three => 3, four => 4 }" + } + + sub (/**.*:allofit) { + "I match anything capturing { allofit => \$whole_path }" + } + +In the specific case of a simple single-* match, the * may be omitted, to +allow you to write: + + sub (/:one/:two/:three/:four) { + "I match /1/2/3/4 capturing { one => 1, two => 2, three => 3, four => 4 }" + } + =head4 C and C are different specs As you may have noticed with the difference between C and @@ -503,11 +525,7 @@ hashref style, the arrayref and single parameters will appear in C<@_> in the order you defined them in the protoype, but all hashrefs will merge into a single C<$params>, as in the example above. -=head3 Upload matches (EXPERIMENTAL) - -Note: This feature is experimental. This means that it may not remain -100% in its current form. If we change it, notes on updating your code -will be added to the L section below. +=head3 Upload matches sub (*foo=) { # param specifier can be anything valid for query or body @@ -789,5 +807,3 @@ This library is free software and may be distributed under the same terms as perl itself. =cut - -1;