Alvis-Convert

 view release on metacpan or  search on metacpan

lib/Alvis/AinoDump.pm  view on Meta::CPAN

package Alvis::AinoDump;

use warnings;
use strict;

use Data::Dumper;

$Alvis::AinoDump::VERSION = '0.1';

##############################################################################
#
#  Error messages
#
#############################################################################

my $ErrStr;
my ($ERR_OK,
    $ERR_BYTE_LENGTH,
    $ERR_TOO_SHORT_DOC,
    $ERR_SPLIT,
    $ERR_PROCESS,
    $ERR_READ
    )=(0..5);
my %ErrMsgs=($ERR_OK=>"",
	     $ERR_BYTE_LENGTH=>"No byte length given for a doc.",
	     $ERR_TOO_SHORT_DOC=>"Too short a document.",
	     $ERR_SPLIT=>"Splitting the doc to text and header failed",
	     $ERR_PROCESS=>"Processing the text and the header failed.",
	     $ERR_READ=>"Reading from the filehandle failed."
   );

sub _set_err_state
{
    my $self=shift;
    my $errcode=shift;
    my $errmsg=shift;

    if (!defined($errcode))
    {
        confess("set_err_state() called with an undefined argument.");
    }

    if (exists($ErrMsgs{$errcode}))
    {
        if ($errcode==$ERR_OK)
        {
            $ErrStr="";
        }
        else
        {
            $ErrStr.=" " . $ErrMsgs{$errcode};
            if (defined($errmsg))
            {
                $ErrStr.=" " . $errmsg;
            }
        }
    }
    else
    {
        confess("Internal error: set_err_state() called with an " .
                "unrecognized argument ($errcode).")
    }
}

sub errmsg
{



( run in 1.809 second using v1.01-cache-2.11-cpan-39bf76dae61 )