From: Vincent Pit Date: Sun, 25 Jul 2010 19:34:44 +0000 (+0200) Subject: Only load Carp.pm when needed X-Git-Tag: rt63842~10 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4f0a86c2a8beb9f7ab93e890d3835e18649b49ff;p=perl%2Fmodules%2FB-RecDeparse.git Only load Carp.pm when needed --- diff --git a/lib/B/RecDeparse.pm b/lib/B/RecDeparse.pm index 7134f5c..2aac9bb 100644 --- a/lib/B/RecDeparse.pm +++ b/lib/B/RecDeparse.pm @@ -5,7 +5,6 @@ use 5.008; use strict; use warnings; -use Carp qw/croak/; use Config; use base qw/B::Deparse/; @@ -55,8 +54,12 @@ use constant { }; sub _parse_args { - croak 'Optional arguments must be passed as key/value pairs' if @_ % 2; + if (@_ % 2) { + require Carp; + Carp::croak('Optional arguments must be passed as key/value pairs'); + } my %args = @_; + my $deparse = $args{deparse}; if (defined $deparse) { if (!ref $deparse) { @@ -67,9 +70,11 @@ sub _parse_args { } else { $deparse = [ ]; } - my $level = $args{level}; - $level = -1 unless defined $level; - $level = int $level; + + my $level = $args{level}; + $level = -1 unless defined $level; + $level = int $level; + return $deparse, $level; }