Catalyst::Controller::Constraints 0.10_02
Sponsored Links
Catalyst::Controller::Constraints 0.10_02 Ranking & Summary
File size:
0.025 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
821
Date added:
2007-07-27
Publisher:
Robert Sedlacek
Catalyst::Controller::Constraints 0.10_02 description
Catalyst::Controller::Constraints contains Constraint Signatures for Controller Actions.
SYNOPSIS
package MyApp::Controller::Foo;
...
use base qw(Catalyst::Controller::Constraints);
__PACKAGE__->config(
constraints => {
# allow only digits for type Integer
Integer => qr/^d+$/,
# allow only word chars for type Word
Word => sub { /^w+$/ },
# validate user id and inflate to object
User => {
# check the user id
check => sub {
my ( $self, $c, $id ) = @_;
return $c->is_valid_user_id( $id );
},
# forward to this action if the validation failed
on_fail => invalid_user,
# if value is valid, run it through this filter
# afterwards
post_filter => sub {
my ( $self, $c, $id ) = @_;
$c->fetch_user_by_id( $id );
},
}
# inheritance
HighInteger => {
inherit_from => Integer,
check => sub { $_ > 22 },
},
# collapse multiple arguments
MyDate => {
# take three integers and return one value
takes => 3,
gives => 1,
# inflate to a datetime object
post_filter => sub {
my ( $self, $c, $y, $m, $d ) = @_;
DateTime->new(
year => $y, month => $m, day => $d );
}
}
}
);
# add two integers, just throws exception on constraint failure
sub add : Local Args(2) Constraints(Integer a, Integer b) {
my ( $self, $c ) = @_;
$c->res->body( $_{a} + $_{b} );
}
# puts the word into the stash, under the key foo
sub stashword : Local Args(1) Constraints( Word foo* ) { }
# user_obj ends as a user object in the stash
sub view_user : Local Args(1) Constraints( User user_obj* ) { }
sub invalid_user : Private {
# handle invalid userid
}
1;
SYNOPSIS
package MyApp::Controller::Foo;
...
use base qw(Catalyst::Controller::Constraints);
__PACKAGE__->config(
constraints => {
# allow only digits for type Integer
Integer => qr/^d+$/,
# allow only word chars for type Word
Word => sub { /^w+$/ },
# validate user id and inflate to object
User => {
# check the user id
check => sub {
my ( $self, $c, $id ) = @_;
return $c->is_valid_user_id( $id );
},
# forward to this action if the validation failed
on_fail => invalid_user,
# if value is valid, run it through this filter
# afterwards
post_filter => sub {
my ( $self, $c, $id ) = @_;
$c->fetch_user_by_id( $id );
},
}
# inheritance
HighInteger => {
inherit_from => Integer,
check => sub { $_ > 22 },
},
# collapse multiple arguments
MyDate => {
# take three integers and return one value
takes => 3,
gives => 1,
# inflate to a datetime object
post_filter => sub {
my ( $self, $c, $y, $m, $d ) = @_;
DateTime->new(
year => $y, month => $m, day => $d );
}
}
}
);
# add two integers, just throws exception on constraint failure
sub add : Local Args(2) Constraints(Integer a, Integer b) {
my ( $self, $c ) = @_;
$c->res->body( $_{a} + $_{b} );
}
# puts the word into the stash, under the key foo
sub stashword : Local Args(1) Constraints( Word foo* ) { }
# user_obj ends as a user object in the stash
sub view_user : Local Args(1) Constraints( User user_obj* ) { }
sub invalid_user : Private {
# handle invalid userid
}
1;
Catalyst::Controller::Constraints 0.10_02 Screenshot
Advertisements
Catalyst::Controller::Constraints 0.10_02 Keywords
Constraints 0.10
Constraint Signatures Controller Actions
Constraint Signatures
Local Args
Actions
user
sub
id
0.10
constraint
02
Catalyst::Controller::Constraints 0.10_02
CatalystControllerConstraints
Catalyst::Controller::Constraints 0.10_02
Libraries
Programming
Bookmark Catalyst::Controller::Constraints 0.10_02
Catalyst::Controller::Constraints 0.10_02 Copyright
WareSeeker periodically updates pricing and software information of Catalyst::Controller::Constraints 0.10_02 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Catalyst::Controller::Constraints 0.10_02 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
constraint logic programming
subway coupons
theory of constraints
sub zero
constraint theory
suburban
constraints
subway
constraint satisfaction problems
triple constraint
subway restaurant
subwoofers
constraint induced therapy cerebral palsy
ethyl benzene constraints
constraint solving
budget constraint
subscribe tags
submit url
Related Software
Catalyst::Example::Controller::InstantCRUD is a Catalyst CRUD example Controller. Free Download
Data::FormValidator::Constraints is a Perl module with basic sets of constraints on input profile. Free Download
Catalyst::Example::InstantCRUD is a CRUD scaffolding for Catalyst. Free Download
Koalog Constraint Solver is a powerful constraint solver written in Java. Free Download
DBIx::EnumConstraints is a Perl module that generates enum-like SQL constraints. Free Download
Catalyst::Helper::Doc is a documentation page generator. Free Download
Solving Constraint Integer Programs is a framework for constraint integer programming. Free Download
PHP-Controller implements the controller for building MVC applications. Free Download
Latest Software
Popular Software
Favourite Software