use
5.006;
if
($] < 5.010000) {
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
overload
q[""]
=>
sub
{
shift
->to_string };
sub
message {
"An error occurred"
}
sub
to_string {
my
$self
=
shift
;
sprintf
(
"%s at %s line %d.\n"
,
$self
->message,
$self
->file,
$self
->line,
);
}
sub
throw {
my
$class
=
shift
;
my
(
$level
,
%caller
) = 0;
$level
++
until
caller
(
$level
) !~ /\ALINQx?::/;
@caller
{
qw/ package file line /
} =
caller
(
$level
);
die
(
$class
->new(
%caller
,
@_
) );
}
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception )
;
sub
message {
my
$self
=
shift
;
my
$meth
=
$self
->method;
"Method $meth is unimplemented"
;
}
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception )
;
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception )
;
sub
BUILD {
my
$self
=
shift
;
'LINQ::Exception::InternalError'
->throw(
message
=>
'Required attribute "message" not defined'
)
unless
defined
$self
->message;
}
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception )
;
sub
BUILD {
my
$self
=
shift
;
'LINQ::Exception::InternalError'
->throw(
message
=>
'Required attribute "collection" not defined'
)
unless
defined
$self
->collection;
}
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception::CollectionError )
;
sub
message {
"Item not found"
};
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception::CollectionError )
;
sub
message {
"Item not found"
};
}
{
our
$AUTHORITY
=
'cpan:TOBYINK'
;
our
$VERSION
=
'0.000_001'
;
use
parent -norequire,
qw( LINQ::Exception::CollectionError )
;
sub
message {
my
$type
=
shift
->type;
"Not all elements in the collection could be cast to $type"
;
}
sub
BUILD {
my
$self
=
shift
;
'LINQ::Exception::InternalError'
->throw(
message
=>
'Required attribute "type" not defined'
)
unless
defined
$self
->type;
}
}
1;