Gantry

 view release on metacpan or  search on metacpan

lib/Gantry/Exception.pm  view on Meta::CPAN

 status      - a numeric status code
 status_line - a text line to be placed in a log file
 message     - text to be sent to the browser
 dump        - a dump of whatever

You will also need to write a custom exception handler. For example,
say you want to generate a 402 exception. You would do the following:

=over 4

 ...

 Gantry::Exception->throw(
     status => 402,
     status_line => 'payment required',
     message => 'gimme all your money, and your luvin too...'
 );

 ...

 sub exception_handler {
     my ($self, $X) = @_;

     my $status = $X->status;

     if ($status == 402) {

         # do something useful

    }

    return $status;

 }

=back

=item Fields()

  Inherited accessor method from Exception::Class.
  
=item dump()

  Accessor method for dump attribute.

=item message()

  Accessor method for message attribute.
  
=item status()

  Accessor method for status attribute.
  
= item status_line()

  Accessor method for status_line attribute.

=item Gantry::Exception::Redirect

You can use this to force a HTTP "Found" (302) to the browser. As an alternative 
you can use the relocate() method for existing code.

=over 4

Example:

 Gantry::Exception::Redirect->throw('/login');

 $self->relocate('/login');

=back

=item Gantry::Exception::RedirectPermanently

You can use this to force a HTTP "Moved Permanently" (301) to the browser. As 
an alternative you can use the relocate_permanently() method for existing code.

=over 4

Example:

 Gantry::Exception::RedirectPermanently->throw('/somewhere');

 $self->relocate_permanently('/somewhere');

=back

=item Gantry::Exception::Declined

Primiarily used internally by Gantry. It will produce a status page when a url
is not defined within your controllers.

=back

=head1 SEE ALSO

 Gantry
 Gantry::State::Exceptions
 Exception::Class

=head1 AUTHOR

Kevin L. Esteb <kesteb@wsipc.org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008 Kevin L. Esteb

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.

=cut



( run in 0.415 second using v1.01-cache-2.11-cpan-5511b514fd6 )