| 1 | package WWW::USF::Directory::Exception; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.008001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | ########################################################################### | ||||||||||
| 8 | # METADATA | ||||||||||
| 9 | 2 | our $AUTHORITY = 'cpan:DOUGDUDE'; | |||||||||
| 10 | 2 | our $VERSION = '0.003001'; | |||||||||
| 11 | |||||||||||
| 12 | ########################################################################### | ||||||||||
| 13 | # MOOSE | ||||||||||
| 14 | 2 | ▶ | use Moose 0.89; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 2 | ▶ | use MooseX::StrictConstructor 0.08; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | ########################################################################### | ||||||||||
| 18 | # MOOSE TYPES | ||||||||||
| 19 | 2 | ▶ | use MooseX::Types::Moose qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | Str | ||||||||||
| 21 | 2 | ); | |||||||||
| 22 | |||||||||||
| 23 | ########################################################################### | ||||||||||
| 24 | # MODULE IMPORTS | ||||||||||
| 25 | 2 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 2 | ▶ | use Class::Load qw(load_class); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | ########################################################################### | ||||||||||
| 29 | # ALL IMPORTS BEFORE THIS WILL BE ERASED | ||||||||||
| 30 | 2 | ▶ | use namespace::clean 0.04 -except => [qw(meta)]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | ########################################################################### | ||||||||||
| 33 | # OVERLOADED FUNCTIONS | ||||||||||
| 34 | 2 | ▶ | __PACKAGE__->meta->add_package_symbol(q{&()} => sub { }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||
| 35 | 2 | ▶ | __PACKAGE__->meta->add_package_symbol(q{&(""} => sub { shift->stringify }); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 36 | |||||||||||
| 37 | ########################################################################### | ||||||||||
| 38 | # ATTRIBUTES | ||||||||||
| 39 | 2 | has message => ( | |||||||||
| 40 | is => 'ro', | ||||||||||
| 41 | isa => Str, | ||||||||||
| 42 | |||||||||||
| 43 | documentation => q{The error message}, | ||||||||||
| 44 | required => 1, | ||||||||||
| 45 | ); | ||||||||||
| 46 | |||||||||||
| 47 | ########################################################################### | ||||||||||
| 48 | # METHODS | ||||||||||
| 49 | 2 | ▶ | sub stringify { | ||||||||
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 50 | 2 | my ($self) = @_; | |||||||||
| 51 | |||||||||||
| 52 | # The default stringify method just returns the contents of the message | ||||||||||
| 53 | # attribute. | ||||||||||
| 54 | 2 | return $self->message; | |||||||||
| 55 | } | ||||||||||
| 56 | 2 | ▶ | sub throw { | ||||||||
|
Subroutine
throw: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||
| 57 | 2 | my ($class, %args) = @_; | |||||||||
| 58 | |||||||||||
| 59 | 2 | ▶ | if (blessed $class) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | # Since $class is blessed, this was probably called as a method, so | ||||||||||
| 61 | # make $class the class name. | ||||||||||
| 62 | 0 | $class = blessed $class; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | # Get the class to make the exception in | ||||||||||
| 66 | 2 | my $exception_class = delete $args{class}; | |||||||||
| 67 | |||||||||||
| 68 | 2 | ▶ | if (!defined $exception_class) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | # The class was not specified, so just make it in our class | ||||||||||
| 70 | 0 | croak $class->new(%args); | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | # Prefix this class to the beginning of the exception class | ||||||||||
| 74 | 2 | $exception_class = sprintf '%s::%s', $class, $exception_class; | |||||||||
| 75 | |||||||||||
| 76 | # Load the exception class | ||||||||||
| 77 | 2 | load_class($exception_class); | |||||||||
| 78 | |||||||||||
| 79 | 2 | croak $exception_class->new(%args); | |||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | ########################################################################### | ||||||||||
| 83 | # MAKE MOOSE OBJECT IMMUTABLE | ||||||||||
| 84 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 85 | |||||||||||
| 86 | 2 | 1; | |||||||||
| 87 | |||||||||||
| 88 | __END__ | ||||||||||