Dancer
view release on metacpan or search on metacpan
lib/Dancer/Deployment.pod view on Meta::CPAN
acl is-haproxy-stats path_beg /stats
# uncomment if you'd like to get haproxy usage statistics
# use_backend haproxy if is-haproxy-stats
default_backend dynamic
# haproxy statistics (available at http://app.example.com/stats)
backend haproxy
stats uri /stats
stats refresh 180s
stats realm app.example.com\ haproxy\ statistics
# change credentials
stats auth admin1:password1
stats auth admin2:password2
stats hide-version
stats show-legends
# application backends
backend dynamic
# change path_info to check and value of the Host header sent to application server
option httpchk HEAD / HTTP/1.1\r\nHost:\ app.example.com
server app1 app-be1.example.com:3000 check inter 30s
lib/Dancer/Exception.pm view on Meta::CPAN
equivalent. Be careful, C<'MyException'> can't be written C<'myexception'>, as
it would be camelized into C<'Myexception'>.
=head2 register_exception
This method allows one to register custom exceptions, usable by Dancer users in
their route code (actually pretty much everywhere).
# simple exception
register_exception ('InvalidCredentials',
message_pattern => "invalid credentials : %s",
);
This registers a new custom exception. To use it, do:
raise InvalidCredentials => "user Herbert not found";
The exception message can be retrieved with the C<$exception-E<gt>message> method, and we'll be
C<"invalid credentials : user Herbert not found"> (see methods in L<Dancer::Exception::Base>)
# complex exception
register_exception ('InvalidLogin',
composed_from => [qw(Fatal InvalidCredentials)],
message_pattern => "wrong login or password",
);
In this example, the C<InvalidLogin> is built as a composition of the C<Fatal>
and C<InvalidCredentials> exceptions. See the C<does> method in
L<Dancer::Exception::Base>.
lib/Dancer/Logger.pm view on Meta::CPAN
# logging to file
set logger => 'file';
The log format can also be configured,
please see L<Dancer::Logger::Abstract/"logger_format"> for details.
=head2 Auto-serializing
The loggers allow auto-serializing of all inputs:
debug( 'User credentials: ', \%creds );
Will provide you with an output in a single log message of the string and the
reference dump.
=head1 AUTHORS
This module has been written by Alexis Sukrieh. See the AUTHORS file that comes
with this distribution for details.
=head1 LICENSE
t/25_exceptions/02_exceptions.t view on Meta::CPAN
)
]);
}
register_exception ('Test',
message_pattern => "test - %s",
);
register_exception ('InvalidCredentials',
message_pattern => "invalid credentials : %s",
);
register_exception ('InvalidPassword',
composed_from => [qw(Test InvalidCredentials)],
message_pattern => "wrong password",
);
register_exception ('InvalidLogin',
composed_from => [qw(Test InvalidCredentials)],
message_pattern => "wrong login (login was %s)",
( run in 0.298 second using v1.01-cache-2.11-cpan-4d50c553e7e )