Subject: | recognize "our $VERSION" |
The attached patch allows ppi_version to recognize the "our $VERSION" idiom.
Subject: | ppi-powertoy-our-version.patch |
diff --git a/lib/PPI/App/ppi_version.pm b/lib/PPI/App/ppi_version.pm
index 2801843..3f89a7b 100644
--- a/lib/PPI/App/ppi_version.pm
+++ b/lib/PPI/App/ppi_version.pm
@@ -62,7 +62,11 @@ sub show {
$_[1]->content =~ m/^\$(?:\w+::)*VERSION$/ or return '';
# It is the first thing in the statement
- $_[1]->sprevious_sibling and return '';
+ my $decl = $_[1]->sprevious_sibling;
+ if (!$decl or !(
+ $decl->isa('PPI::Token::Word')
+ && $decl->content eq 'our'
+ )) { return ''; }
# Followed by an "equals"
my $equals = $_[1]->snext_sibling or return '';