=cut
###----------------------------------------------------------------###
-# Copyright 2006 - Paul Seamons #
+# Copyright 2007 - Paul Seamons #
# Distributed under the Perl Artistic License without warranty #
###----------------------------------------------------------------###
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION
$CALL_LEVEL
- $ON $SUB $QR1 $QR2 $full_filename);
+ $ON $SUB $QR1 $QR2 $full_filename $DEPARSE);
use strict;
use Exporter;
-$VERSION = '2.01';
+$VERSION = '2.21';
@ISA = qw(Exporter);
@EXPORT = qw(dex dex_warn dex_text dex_html ctrace dex_trace);
@EXPORT_OK = qw(dex dex_warn dex_text dex_html ctrace dex_trace debug);
### is on or off
sub on { $ON = 1 };
sub off { $ON = 0; }
-&on();
-sub set_deparse {
- $Data::Dumper::Deparse = eval {require B::Deparse};
-}
+sub set_deparse { $DEPARSE = 1 }
###----------------------------------------------------------------###
BEGIN {
- ### setup the Data::Dumper usage
- $Data::Dumper::Sortkeys = 1 if ! defined $Data::Dumper::Sortkeys; # not avail pre 5.8
- $Data::Dumper::Useqq = 1 if ! defined $Data::Dumper::Useqq;
- $Data::Dumper::Quotekeys = 0 if ! defined $Data::Dumper::Quotekeys;
- $Data::Dumper::Pad = ' ' if ! defined $Data::Dumper::Pad;
- #$Data::Dumper::Deparse = 1 if ! defined $Data::Dumper::Deparse; # very useful
+ on();
+
$SUB = sub {
+ ### setup the Data::Dumper usage
+ local $Data::Dumper::Deparse = $DEPARSE && eval {require B::Deparse};
+ local $Data::Dumper::Pad = ' ';
+ local $Data::Dumper::Sortkeys = 1;
+ local $Data::Dumper::Useqq = 1;
+ local $Data::Dumper::Quotekeys = 0;
+
require Data::Dumper;
return Data::Dumper->Dumpperl(\@_);
};
### dump it out
my @dump = map {&$SUB($_)} @_;
my @var = ('$VAR') x ($#dump + 1);
- if ($line =~ s/^ .*\b \Q$called\E ( \(?\s* | \s+ )//x
- && $line =~ s/(?:\s+if\s+.+)? ;? \s*$//x) {
- $line =~ s/ \s*\) $ //x if $1 && $1 =~ /\(/;
+ my $hold;
+ if ($line =~ s/^ .*\b \Q$called\E ( \s* \( \s* | \s+ )//x
+ && ($hold = $1)
+ && ( $line =~ s/ \s* \b if \b .* \n? $ //x
+ || $line =~ s/ \s* ; \s* $ //x
+ || $line =~ s/ \s+ $ //x)) {
+ $line =~ s/ \s*\) $ //x if $hold =~ /^\s*\(/;
my @_var = map {/^[\"\']/ ? 'String' : $_} split (/\s*,\s*/, $line);
@var = @_var if $#var == $#_var;
}
=back
+=head1 LICENSE
+
+This module may distributed under the same terms as Perl itself.
+
=head1 AUTHORS
-Paul Seamons <perlspam at seamons dot com>
+Paul Seamons <perl at seamons dot com>
=cut