[Catalyst] Patch for Devel::Nextalyzer

Brian Cooke mrkoffee at saltedsnail.com
Tue Aug 23 21:32:10 CEST 2005


Not strictly related to Catalyst, but posting it here since
Devel::Nextalyzer is in Catalyst trunk.

I was using Devel::Nextalyzer and noticed that it was reporting methods
that were really just occurrences of "sub some_method" in the Pod embedded
in the superclass.  For example, it reports methods "foo", "bar" and
"email" as coming from Class::Accessor, while these are just part of the
examples in the documentation.

I've included a patch against trunk (revision 1062) to skip checking for
subs if the current line of the module is Pod.  Basically just turns
$is_pod on and off according to a couple regexes.  I believe my
understanding of the Pod spec is correct with respect to starting and
ending Pod sections, but let me know if not.

Cheers,

Brian
-------------- next part --------------
Index: Nextalyzer.pm
===================================================================
--- Nextalyzer.pm (revision 1062)
+++ Nextalyzer.pm (working copy)
@@ -71,7 +71,11 @@
         my $uses_next;
         my @provides;
         my @overloads;
+        my $is_pod = 0;
         while ( my $line = <IN> ) {
+            $is_pod = 1 if $line =~ /^=(?!cut)/;
+            $is_pod = 0 if $line =~ /^=cut/;
+            next if $is_pod;
             unless ($in_sub) {
                 ( $ws, $in_sub ) = ( $line =~ /^(\s*)sub (\S+)/ );
                 next unless $in_sub;


More information about the Catalyst mailing list