Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r17255: Mkaing this script work without Devel::S...

Committer: gariev
Mkaing this script work without Devel::Size module
U   trunk/bin/upgrading/wurfl/bin/wurfl_update.pl
Modified: trunk/bin/upgrading/wurfl/bin/wurfl_update.pl
===================================================================
--- trunk/bin/upgrading/wurfl/bin/wurfl_update.pl	2010-09-01 18:16:57 UTC (rev 17254)
+++ trunk/bin/upgrading/wurfl/bin/wurfl_update.pl	2010-09-01 19:06:38 UTC (rev 17255)
@@ -5,17 +5,12 @@
 
 use LJ::WURFL;
 use LJ::WURFL::Parser;
-
 use FindBin;
 use File::Spec::Functions qw(catfile);
-
 use Getopt::Long;
 
-use Devel::Size qw(total_size);
-
 my $wurfl_file = "wurfl.xml";
 my $store_file = "wireless.stor";
-
 my $datadir = catfile($FindBin::Bin, '..', 'data');
 
 my ($noparse, $test, $verbose) = 3 x 0;
@@ -35,6 +30,12 @@
 }
 
 if ($test) {
+    if (eval {require "Devel/Size.pm"}) {
+        *total_size = \&Devel::Size::total_size;
+    } else {
+        *total_size = sub { "unknown" };
+    }
+
 	print "Load wireless data.\n";
 	my $wurfl = new LJ::WURFL;
 	print "Cannot load data file.\n" unless $wurfl->load(catfile($datadir,$store_file));

Tags: gariev, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments