summaryrefslogtreecommitdiff
path: root/ext/Data/Dumper/Dumper.pm
diff options
context:
space:
mode:
authorJos I. Boumans <kane@dwim.org>2005-01-18 16:12:03 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-01-19 11:20:10 +0000
commit907e51147bc707de302c94d14addc54fdb84d588 (patch)
tree5f17b7f751bdbad619054d1991b4451cfc09280b /ext/Data/Dumper/Dumper.pm
parent70c68212ed57a5a044505a3d22a9a10e9a272055 (diff)
downloadperl-907e51147bc707de302c94d14addc54fdb84d588.tar.gz
Make Data::Dumper work when dynamic extensions are not available
From: "Jos I. Boumans" <kane@xs4all.net> Message-Id: <ED6BA2C4-695A-11D9-B09C-000A95EF62E2@xs4all.net> p4raw-id: //depot/perl@23820
Diffstat (limited to 'ext/Data/Dumper/Dumper.pm')
-rw-r--r--ext/Data/Dumper/Dumper.pm57
1 files changed, 33 insertions, 24 deletions
diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm
index a0611f5733..3f2d8c9181 100644
--- a/ext/Data/Dumper/Dumper.pm
+++ b/ext/Data/Dumper/Dumper.pm
@@ -9,41 +9,50 @@
package Data::Dumper;
-$VERSION = '2.121_03';
+$VERSION = '2.121_04';
#$| = 1;
use 5.006_001;
require Exporter;
-use XSLoader ();
require overload;
use Carp;
-@ISA = qw(Exporter);
-@EXPORT = qw(Dumper);
-@EXPORT_OK = qw(DumperX);
-
-XSLoader::load 'Data::Dumper';
+BEGIN {
+ @ISA = qw(Exporter);
+ @EXPORT = qw(Dumper);
+ @EXPORT_OK = qw(DumperX);
+
+ # if run under miniperl, or otherwise lacking dynamic loading,
+ # XSLoader should be attempted to load, or the pure perl flag
+ # toggled on load failure.
+ eval {
+ require XSLoader;
+ XSLoader::load( 'Data::Dumper' );
+ 1;
+ };
+ $Useperl = 1 if $@;
+}
# module vars and their defaults
-$Indent = 2 unless defined $Indent;
-$Purity = 0 unless defined $Purity;
-$Pad = "" unless defined $Pad;
-$Varname = "VAR" unless defined $Varname;
-$Useqq = 0 unless defined $Useqq;
-$Terse = 0 unless defined $Terse;
-$Freezer = "" unless defined $Freezer;
-$Toaster = "" unless defined $Toaster;
-$Deepcopy = 0 unless defined $Deepcopy;
-$Quotekeys = 1 unless defined $Quotekeys;
-$Bless = "bless" unless defined $Bless;
-#$Expdepth = 0 unless defined $Expdepth;
-$Maxdepth = 0 unless defined $Maxdepth;
-$Pair = ' => ' unless defined $Pair;
-$Useperl = 0 unless defined $Useperl;
-$Sortkeys = 0 unless defined $Sortkeys;
-$Deparse = 0 unless defined $Deparse;
+$Indent = 2 unless defined $Indent;
+$Purity = 0 unless defined $Purity;
+$Pad = "" unless defined $Pad;
+$Varname = "VAR" unless defined $Varname;
+$Useqq = 0 unless defined $Useqq;
+$Terse = 0 unless defined $Terse;
+$Freezer = "" unless defined $Freezer;
+$Toaster = "" unless defined $Toaster;
+$Deepcopy = 0 unless defined $Deepcopy;
+$Quotekeys = 1 unless defined $Quotekeys;
+$Bless = "bless" unless defined $Bless;
+#$Expdepth = 0 unless defined $Expdepth;
+$Maxdepth = 0 unless defined $Maxdepth;
+$Pair = ' => ' unless defined $Pair;
+$Useperl = 0 unless defined $Useperl;
+$Sortkeys = 0 unless defined $Sortkeys;
+$Deparse = 0 unless defined $Deparse;
#
# expects an arrayref of values to be dumped.