Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 9fba5d7386914000ae72b27f1957a7d4a396e176 @gfx committed Jan 20, 2011
Showing with 1,170 additions and 0 deletions.
  1. +26 −0 .gitignore
  2. +7 −0 .shipit
  3. +30 −0 Changes
  4. +68 −0 MANIFEST.SKIP
  5. +22 −0 Makefile.PL
  6. +29 −0 README
  7. +10 −0 example/lint-unused.pl
  8. +31 −0 example/simple.pl
  9. +170 −0 lib/warnings/unused.pm
  10. +7 −0 t/00_load.t
  11. +75 −0 t/01_unused.t
  12. +37 −0 t/02_used.t
  13. +27 −0 t/03_in_mod.t
  14. +17 −0 t/04_lexical.t
  15. +32 −0 t/05_eval.t
  16. +105 −0 t/06_multiscope.t
  17. +25 −0 t/07_rt43716.t
  18. +66 −0 t/tlib/Foo.pm
  19. +364 −0 unused.xs
  20. +7 −0 xt/01_pod.t
  21. +9 −0 xt/02_pod-coverage.t
  22. +6 −0 xt/03_synopsis_syntax.t
@@ -0,0 +1,26 @@
+warnings-unused-*
+.*
+!.gitignore
+!.shipit
+*.o
+*.obj
+*.bs
+*.def
+Makefile*
+!Makefile.PL
+*blib
+META.yml
+MYMETA.yml
+inc/
+MANIFEST
+*.out
+*.bak
+ppport.h
+xshelper.h
+nytprof*
+cover_db*
+*.gcda
+*.gcno
+*.gcov
+*.stackdump
+*.c
@@ -0,0 +1,7 @@
+# auto-generated shipit config file.
+steps = FindVersion, ChangeAllVersions, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN
+
+git.tagpattern = %v
+git.push_to = origin
+
+CheckChangeLog.files = Changes
30 Changes
@@ -0,0 +1,30 @@
+Revision history for warnings::unused
+
+TODO:
+ * to be based on PL_peepp?
+
+0.04 Sun Mar 1 11:29:06 2009
+ - fix RT #43716, reported by Kevin Ryde
+
+0.03 Thu Feb 26 16:22:31 2009
+ - fix a multi-scope problem (RT #41639, reported by Kevin Ryde)
+ - update ppport.h
+
+0.021 Sat Oct 4 15:03:44 2008
+ - re-packageing
+ - no code change
+
+0.02 Fri Sep 26 13:14:44 2008
+ - change to work as a lexical pragma (RT #39508, reported by Slaven Rezic)
+ - fix a segv (RT #39563, reported by Kevin Ryde)
+
+0.01 Mon Sep 22 09:09:07 2008
+ - change the warning category from 'unused' to 'once'
+ - fix many bugs
+ - add LIMITATIONS section to the pod
+ - add more tests
+ - internal cleanup
+
+0.001 Sat Sep 20 11:48:25 2008
+ - original version; created by Module::Starter
+
@@ -0,0 +1,68 @@
+
+#!start included /usr/local/lib/perl5/5.10.0/ExtUtils/MANIFEST.SKIP
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\B\.gitignore\b
+\b_darcs\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$ # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+
+# Avoid Devel::Cover files.
+\bcover_db\b
+#!end included /usr/local/lib/perl5/5.10.0/ExtUtils/MANIFEST.SKIP
+
+
+# skip dot files
+^\.
+
+# skip author's files
+\bauthor\b
+
+# skip object files
+Xslate\.c$
+\.o(?:bj)?$
+\.bs$
+\.def$
+
+\.out$
+
+# skip devel-cover stuff
+\.gcda$
+\.gcno$
+\.gcov$
+cover_db/
+
+# skip nytprof stuff
+nytprof/
+\.out$
+
+ppport\.h$
+
+\.c$
+
+\.stackdump$
+
+MYMETA\.yml$
@@ -0,0 +1,22 @@
+use 5.008_001;
+use strict;
+use warnings;
+use inc::Module::Install;
+
+name 'warnings-unused';
+
+all_from 'lib/warnings/unused.pm';
+
+requires 'XSLoader' => 0.06;
+
+test_requires 'Test::More' => 0.62;
+test_requires 'Test::Warn' => 0.11;
+
+author_tests 'xt';
+
+WriteMakefile(
+ clean => {FILES => q{warnings-unused-*
+ *.gcov *.gcda *.gcno
+ *.stackdump cover_db}
+ },
+);
29 README
@@ -0,0 +1,29 @@
+NAME
+
+warnings::unused - Produces warnings when unused variables are detected
+
+SYNOPSIS
+
+ use warnings::unused; # installs the check routine as 'once'
+ use warnings 'once'; # enables the check routine
+
+INSTALLATION
+
+ To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+ Perl 5.8.1 or later, and a C compiler.
+
+COPYRIGHT AND LICENCE
+
+ Copyright (C) 2008, Goro Fuji <gfuji(at)cpan.org>, Some rights reversed.
+
+ This library is free software; you can redistribute it and/or modify
+ it under the same terms as Perl itself.
+
@@ -0,0 +1,10 @@
+#!perl -w
+# A simple module lint program
+# Usage: lint-unused.pl MODULE1, MODULE2 ...
+
+use strict;
+use Module::Load;
+
+use warnings::unused -global;
+
+load($_) for @ARGV;
@@ -0,0 +1,31 @@
+#!perl -w
+use 5.008_001;
+use strict;
+use warnings;
+use warnings::unused;
+
+my $a_unused; # unused
+
+sub foo{
+ our $global = sub{
+ my $a_unused; # shadowing
+ $a_unused++;
+ $a_unused++;
+ };
+
+ my %b_unused;
+
+ my @bar;
+ if(0){
+ my $c_unused = sub{ @bar }; # never reached, but checked
+ }
+
+ return \my $d_unused; # possibly used, but complained
+}
+
+{
+ no warnings 'once';
+ my $xyz; # unused but the warning is disabled
+}
+
+print "done.\n";
Oops, something went wrong.

0 comments on commit 9fba5d7

Please sign in to comment.