Merge pull request #1 from letolabs/fix_clang_warnings
Tim Bunce [Thu, 11 Oct 2012 14:02:16 +0000 (07:02 -0700)]
Fix compiler warnings from clang 2.1 thanks to leto

CHANGES
Makefile.PL
SizeMe.xs
bin/sizeme_graph.pl
lib/Devel/SizeMe.pm
t/basic.t

diff --git a/CHANGES b/CHANGES
index 2aabe3c..a627e2e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,15 @@
 Revision history for Perl extension Devel::SizeMe.
 
+0.04 2012-10-05 Tim Bunce
+
+ * Removed Mojolicious::Lite as a prerequisite as it was stoping people
+    using SizeMe with perl 5.8.
+
+0.03 2012-10-04 Tim Bunce
+
+ * Fixup logic and tests to be portable across more perl versions.
+ * Applied some polish to the docs.
+
 0.02 2012-10-02 Tim Bunce
 
  * Renamed to Devel::SizeMe.
index 913270c..679218b 100644 (file)
@@ -23,7 +23,9 @@ WriteMakefile(
         'Test::More' => 0,
         'JSON::XS' => 0,
         'HTML::Entities' => 0,
-        'Mojolicious::Lite' => 0,
+        # Removed for now as it stops people using SizeMe with 5.8
+        # sizeme_graph.pl will eventually become a separate module
+        #'Mojolicious::Lite' => 0,
         'Devel::Dwarn' => 0,
         XSLoader => 0,
         ORLite => 0,
@@ -58,7 +60,7 @@ sub write_header {
     open my $fh, '>', $filename or die $!;
     print { $fh } "#ifndef ${guard_name}\n";
     print { $fh } "#define ${guard_name}\n";
-    print { $fh } $contents or die $!;
+    print { $fh } $contents if defined $contents;
     print { $fh } "#endif /* ${guard_name} */\n";
     close $fh or die $!;
 }
index 823a525..88921fc 100644 (file)
--- a/SizeMe.xs
+++ b/SizeMe.xs
@@ -756,7 +756,7 @@ regex_size(pTHX_ const REGEXP * const baseregex, struct state *st, pPATH) {
   /*ADD_SIZE(st, strlen(SvANY(baseregex)->subbeg));*/
 #endif
   if (st->go_yell && !st->regex_whine) {
-    carp("Devel::Size: Calculated sizes for compiled regexes are incompatible, and probably always will be");
+    carp("Devel::Size: Calculated sizes for compiled regexes are incomplete");
     st->regex_whine = 1;
   }
 }
index 8eef472..b8530d6 100755 (executable)
@@ -1,5 +1,15 @@
 #!/usr/bin/env perl
 
+BEGIN {
+    die qq{$0 requires Mojolicious::Lite, which isn't installed.
+
+    Currently requires Mojolicious::Lite which isn't available for perl 5.8.
+    If this affects you you can run Devel::SizeMe with your normal perl and
+    run sizeme_graph.pl with a different perl, perhaps on a different machine.
+    \n}
+        unless eval "require Mojolicious::Lite";
+}
+
 =head1 NAME
 
 sizeme_graph.pl - web server providing an interactive treemap of Devel::SizeMe data
@@ -17,6 +27,10 @@ Then open a web browser on http://127.0.0.1:3000
 Reads a database created by sizeme_store.pl and provides a web interface with
 an interactive treemap of the data.
 
+Currently requires Mojolicious::Lite which isn't available for perl 5.8.
+If this affects you you can run Devel::SizeMe with your normal perl and
+run sizeme_graph.pl with a different perl, perhaps on a different machine.
+
 =head2 TODO
 
 Current implementation is all very alpha and rather hackish.
@@ -217,6 +231,11 @@ sub _transform_node_tree {  # recurse depth first
 
 app->start;
 
+{   # just to reserve the namespace for future use
+    package Devel::SizeMe::Graph;
+    1;
+}
+
 __DATA__
 @@ index.html.ep
 % layout 'default';
index 2307118..39e2612 100644 (file)
@@ -27,7 +27,7 @@ require 5.005;
 require Exporter;
 require XSLoader;
 
-$VERSION = '0.03';
+$VERSION = '0.04';
 @ISA = qw(Exporter);
 
 @EXPORT_OK = qw(size total_size perl_size heap_size);
index 8ab8c06..c390470 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -10,7 +10,7 @@ can_ok ('Devel::SizeMe', qw/
   /);
 
 die ("Uhoh, test uses an outdated version of Devel::SizeMe")
-    unless is ($Devel::SizeMe::VERSION, '0.03', 'VERSION MATCHES');
+    unless is ($Devel::SizeMe::VERSION, '0.04', 'VERSION MATCHES');
 
 #############################################################################
 # some basic checks: