Data-Tubes
view release on metacpan or search on metacpan
lib/Data/Tubes/Plugin/Parser.pm view on Meta::CPAN
sub parse_by_format {
my %args = normalize_args(@_,
[{%global_defaults, name => 'parse by format'}, 'format']);
identify(\%args);
my $format = $args{format};
LOGDIE "parser of type 'format' needs a definition"
unless defined $format;
my @items = split m{(\W+)}, $format;
return parse_single(key => $items[0]) if @items == 1;
my ($keys, $separators) = unzip(\@items);
# all keys MUST be different, otherwise some fields are just trumping
# on each other
eval { assert_all_different($keys); }
or LOGDIE "'format' parser [$format] "
. "has duplicate key $EVAL_ERROR->{message}";
script/tubergen view on Meta::CPAN
$self->fatal(@_);
$self->_exit();
}
sub logcarp {
my $self = shift;
require Carp;
$Carp::Internal{$_} = 1 for __PACKAGE__;
if ($self->is_warn()) { # avoid unless we're allowed to emit
my $message = Carp::shortmess(@_);
$self->warn($_) for split m{\n}mxs, $message;
}
if ($LOGDIE_MESSAGE_ON_STDERR) {
local $Carp::CarpLevel = $Carp::CarpLevel + 1;
Carp::carp(@_);
}
return;
} ## end sub logcarp
sub logcluck {
my $self = shift;
require Carp;
$Carp::Internal{$_} = 1 for __PACKAGE__;
if ($self->is_warn()) { # avoid unless we're allowed to emit
my $message = Carp::longmess(@_);
$self->warn($_) for split m{\n}mxs, $message;
}
if ($LOGDIE_MESSAGE_ON_STDERR) {
local $Carp::CarpLevel = $Carp::CarpLevel + 1;
Carp::cluck(@_);
}
return;
} ## end sub logcluck
sub logcroak {
my $self = shift;
require Carp;
$Carp::Internal{$_} = 1 for __PACKAGE__;
if ($self->is_fatal()) { # avoid unless we're allowed to emit
my $message = Carp::shortmess(@_);
$self->fatal($_) for split m{\n}mxs, $message;
}
if ($LOGDIE_MESSAGE_ON_STDERR) {
local $Carp::CarpLevel = $Carp::CarpLevel + 1;
Carp::croak(@_);
}
$self->_exit();
} ## end sub logcroak
sub logconfess {
my $self = shift;
require Carp;
$Carp::Internal{$_} = 1 for __PACKAGE__;
if ($self->is_fatal()) { # avoid unless we're allowed to emit
my $message = Carp::longmess(@_);
$self->fatal($_) for split m{\n}mxs, $message;
}
if ($LOGDIE_MESSAGE_ON_STDERR) {
local $Carp::CarpLevel = $Carp::CarpLevel + 1;
Carp::confess(@_);
}
$self->_exit();
} ## end sub logconfess
sub level {
my $self = shift;
script/tubergen view on Meta::CPAN
sub parse_by_format {
my %args = normalize_args(@_,
[{%global_defaults, name => 'parse by format'}, 'format']);
identify(\%args);
my $format = $args{format};
LOGDIE "parser of type 'format' needs a definition"
unless defined $format;
my @items = split m{(\W+)}, $format;
return parse_single(key => $items[0]) if @items == 1;
my ($keys, $separators) = unzip(\@items);
# all keys MUST be different, otherwise some fields are just trumping
# on each other
eval { assert_all_different($keys); }
or LOGDIE "'format' parser [$format] "
. "has duplicate key $EVAL_ERROR->{message}";
( run in 1.012 second using v1.01-cache-2.11-cpan-71847e10f99 )