azuma, kuniyuki > Haineko-0.2.16 > Haineko::E

Download:
Haineko-0.2.16.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Haineko::E - Convert error message to an object

DESCRIPTION ^

Haineko::E provide methods for converting an error message of perl such as "error at /path/to/file.pl line 2." to an object.

SYNOPSIS ^

    use Haineko::E;
    eval { die 'Nyaaaaaaa!!!!' };
    my $e = Haineko::E->new( $@ );

CLASS METHODS ^

new( Error Message )

new() is a constructor of Haineko::E

    use Haineko::E;
    eval { die 'Hardest' };
    my $e = Haineko::E->new( $@ );

    print $e->file;             # /path/to/file.pl
    print $e->line;             # 2
    print for @{ $e->mesg };    # Hardest

INSTANCE METHODS ^

message()

message() returns whole error message as a text (scalar value).

    use Haineko::E;
    eval { die 'Hard 2' };
    my $e = Haineko::E->new( $@ );

    print $e->message;          # Hard 3 at /path/to/file.pl line 2.

text()

text() returns error message part only.

    use Haineko::E;
    eval { die 'Hard 3' };
    my $e = Haineko::E->new( $@ );

    print $e->text;             # Hard 3

REPOSITORY ^

https://github.com/azumakuniyuki/Haineko

AUTHOR ^

azumakuniyuki <perl.org [at] azumakuniyuki.org>

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: