---
lib/Pod/POM/Node.pm | 35 +++++++++++++++++------------------
lib/Pod/POM/Node/Begin.pm | 4 ++--
lib/Pod/POM/Node/Code.pm | 4 ++--
lib/Pod/POM/Node/For.pm | 5 +++--
lib/Pod/POM/Node/Head1.pm | 4 ++--
lib/Pod/POM/Node/Head2.pm | 4 ++--
lib/Pod/POM/Node/Head3.pm | 4 ++--
lib/Pod/POM/Node/Head4.pm | 4 ++--
lib/Pod/POM/Node/Item.pm | 4 ++--
lib/Pod/POM/Node/Over.pm | 4 ++--
lib/Pod/POM/Node/Text.pm | 4 ++--
lib/Pod/POM/Node/Verbatim.pm | 4 ++--
t/PodPOMTestLib.pm | 3 ++-
13 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/lib/Pod/POM/Node.pm b/lib/Pod/POM/Node.pm
index 0ea5560..108370a 100644
--- a/lib/Pod/POM/Node.pm
+++ b/lib/Pod/POM/Node.pm
@@ -64,20 +64,20 @@ use overload
#
# Constructor method. Returns a new Pod::POM::Node::* object or undef
# on error. First argument is the Pod::POM parser object, remaining
-# arguments are node attributes as specified in %ATTRIBS in derived class
+# arguments are node attributes as specified in @ATTRIBS in derived class
# package.
#------------------------------------------------------------------------
sub new {
my $class = shift;
my $pom = shift;
- my ($type, $attribs, $accept, $key, $value, $default);
+ my ($type, @attribs, $accept);
$type = $NAMES->{ $class };
{
no strict qw( refs );
- $attribs = \%{"$class\::ATTRIBS"} || [ ];
+ @attribs = @{"$class\::ATTRIBS"};
$accept = \@{"$class\::ACCEPT"} || [ ];
unless (%{"$class\::ACCEPT"}) {
%{"$class\::ACCEPT"} = (
@@ -95,9 +95,8 @@ sub new {
}, $class;
# set attributes from arguments
- keys %$attribs; # reset hash iterator
- while(my ($key, $default) = each %$attribs) {
- $value = shift || $default;
+ while(my ($key, $default) = splice(@attribs, 0, 2)) {
+ my $value = shift || $default;
return $class->error("$type expected a $key")
unless $value;
$self->{ $key } = $value;
@@ -294,7 +293,7 @@ sub dump {
}
else {
no strict 'refs';
- my @attrs = sort keys %{"*${nodepkg}::ATTRIBS"};
+ my @attrs = sort keys %{{ @{"${nodepkg}::ATTRIBS"} }};
$output .= (" " x $depth) . $self->type . "\n";
foreach my $attr (@attrs) {
if (my $value = $self->{$attr}) {
@@ -389,9 +388,9 @@ Pod::POM::Node - base class for a POM node
package Pod::POM::Node::Over;
use base qw( Pod::POM::Node );
- use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+ use vars qw( @ATTRIBS @ACCEPT $EXPECT $ERROR );
- %ATTRIBS = ( indent => 4 );
+ @ATTRIBS = ( indent => 4 );
@ACCEPT = qw( over item begin for text verbatim );
$EXPECT = q( back );
@@ -421,16 +420,16 @@ new node objects.
my $list = Pod::POM::Node::Over->new();
The characteristics of a node can be specified by defining certain
-variables in the derived class package. The C<%ATTRIBS> hash can be
+variables in the derived class package. The C<@ATTRIBS> hash can be
used to denote attributes that the node should accept. In the case of
an C<=over> node, for example, an C<indent> attribute can be specified
which otherwise defaults to 4.
package Pod::POM::Node::Over;
use base qw( Pod::POM::Node );
- use vars qw( %ATTRIBS $ERROR );
+ use vars qw( @ATTRIBS $ERROR );
- %ATTRIBS = ( indent => 4 );
+ @ATTRIBS = ( indent => 4 );
The new() method will now expect an argument to set the indent value,
or will use 4 as the default if no argument is provided.
@@ -442,9 +441,9 @@ If the default value is undefined then the argument is mandatory.
package Pod::POM::Node::Head1;
use base qw( Pod::POM::Node );
- use vars qw( %ATTRIBS $ERROR );
+ use vars qw( @ATTRIBS $ERROR );
- %ATTRIBS = ( title => undef );
+ @ATTRIBS = ( title => undef );
package main;
my $head = Pod::POM::Node::Head1->new('My Title');
@@ -470,9 +469,9 @@ that are permitted as children of a node.
package Pod::POM::Node::Head1;
use base qw( Pod::POM::Node );
- use vars qw( %ATTRIBS @ACCEPT $ERROR );
+ use vars qw( @ATTRIBS @ACCEPT $ERROR );
- %ATTRIBS = ( title => undef );
+ @ATTRIBS = ( title => undef );
@ACCEPT = qw( head2 over begin for text verbatim );
The add() method can then be called against a node to add a new child
@@ -518,9 +517,9 @@ successful termination.
package Pod::POM::Node::Over;
use base qw( Pod::POM::Node );
- use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+ use vars qw( @ATTRIBS @ACCEPT $EXPECT $ERROR );
- %ATTRIBS = ( indent => 4 );
+ @ATTRIBS = ( indent => 4 );
@ACCEPT = qw( over item begin for text verbatim );
$EXPECT = q( back );
diff --git a/lib/Pod/POM/Node/Begin.pm b/lib/Pod/POM/Node/Begin.pm
index e65c50a..b40dfbb 100644
--- a/lib/Pod/POM/Node/Begin.pm
+++ b/lib/Pod/POM/Node/Begin.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Begin;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $EXPECT $ERROR );
-%ATTRIBS = ( format => undef );
+@ATTRIBS = ( format => undef );
@ACCEPT = qw( text verbatim code );
$EXPECT = 'end';
diff --git a/lib/Pod/POM/Node/Code.pm b/lib/Pod/POM/Node/Code.pm
index d9c1d62..9a7c308 100644
--- a/lib/Pod/POM/Node/Code.pm
+++ b/lib/Pod/POM/Node/Code.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Code;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
+use vars qw( @ATTRIBS $ERROR );
-%ATTRIBS = ( text => '' );
+@ATTRIBS = ( text => '' );
sub present {
my ($self, $view) = @_;
diff --git a/lib/Pod/POM/Node/For.pm b/lib/Pod/POM/Node/For.pm
index 68df930..46a347d 100644
--- a/lib/Pod/POM/Node/For.pm
+++ b/lib/Pod/POM/Node/For.pm
@@ -27,14 +27,15 @@ package Pod::POM::Node::For;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
+use vars qw( @ATTRIBS $ERROR );
-%ATTRIBS = ( format => undef, text => '' );
+@ATTRIBS = ( format => undef, text => '' );
sub new {
my $class = shift;
my $pom = shift;
my $text = shift;
+
return $class->SUPER::new($pom, split(/\s+/, $text, 2));
}
diff --git a/lib/Pod/POM/Node/Head1.pm b/lib/Pod/POM/Node/Head1.pm
index fdb0f83..0e942dd 100644
--- a/lib/Pod/POM/Node/Head1.pm
+++ b/lib/Pod/POM/Node/Head1.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Head1;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $ERROR );
-%ATTRIBS = ( title => undef );
+@ATTRIBS = ( title => undef );
@ACCEPT = qw( head2 head3 head4 over begin for text verbatim code );
sub new {
diff --git a/lib/Pod/POM/Node/Head2.pm b/lib/Pod/POM/Node/Head2.pm
index cea7ab5..29e067c 100644
--- a/lib/Pod/POM/Node/Head2.pm
+++ b/lib/Pod/POM/Node/Head2.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Head2;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $ERROR );
-%ATTRIBS = ( title => undef );
+@ATTRIBS = ( title => undef );
@ACCEPT = qw( head3 head4 over begin for text verbatim code );
sub new {
diff --git a/lib/Pod/POM/Node/Head3.pm b/lib/Pod/POM/Node/Head3.pm
index c31a2d5..8078cd2 100644
--- a/lib/Pod/POM/Node/Head3.pm
+++ b/lib/Pod/POM/Node/Head3.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Head3;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $ERROR );
-%ATTRIBS = ( title => undef );
+@ATTRIBS = ( title => undef );
@ACCEPT = qw( head4 over begin for text verbatim code );
sub new {
diff --git a/lib/Pod/POM/Node/Head4.pm b/lib/Pod/POM/Node/Head4.pm
index af79b96..59700af 100644
--- a/lib/Pod/POM/Node/Head4.pm
+++ b/lib/Pod/POM/Node/Head4.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Head4;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $ERROR );
-%ATTRIBS = ( title => undef );
+@ATTRIBS = ( title => undef );
@ACCEPT = qw( over begin for text verbatim code );
sub new {
diff --git a/lib/Pod/POM/Node/Item.pm b/lib/Pod/POM/Node/Item.pm
index e3f0132..5a52904 100644
--- a/lib/Pod/POM/Node/Item.pm
+++ b/lib/Pod/POM/Node/Item.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Item;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $ERROR );
-%ATTRIBS = ( title => '*' );
+@ATTRIBS = ( title => '*' );
@ACCEPT = qw( over begin for text verbatim code );
sub new {
diff --git a/lib/Pod/POM/Node/Over.pm b/lib/Pod/POM/Node/Over.pm
index b4d5897..fb160f2 100644
--- a/lib/Pod/POM/Node/Over.pm
+++ b/lib/Pod/POM/Node/Over.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Over;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS @ACCEPT $EXPECT $ERROR );
+use vars qw( @ATTRIBS @ACCEPT $EXPECT $ERROR );
-%ATTRIBS = ( indent => 4 );
+@ATTRIBS = ( indent => 4 );
@ACCEPT = qw( over item begin for text verbatim code );
$EXPECT = 'back';
diff --git a/lib/Pod/POM/Node/Text.pm b/lib/Pod/POM/Node/Text.pm
index 53badfa..6266ccc 100644
--- a/lib/Pod/POM/Node/Text.pm
+++ b/lib/Pod/POM/Node/Text.pm
@@ -28,9 +28,9 @@ use strict;
use Pod::POM::Constants qw( :all );
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
+use vars qw( @ATTRIBS $ERROR );
-%ATTRIBS = ( text => '' );
+@ATTRIBS = ( text => '' );
sub new {
my $class = shift;
diff --git a/lib/Pod/POM/Node/Verbatim.pm b/lib/Pod/POM/Node/Verbatim.pm
index c8ec52a..f3bbc30 100644
--- a/lib/Pod/POM/Node/Verbatim.pm
+++ b/lib/Pod/POM/Node/Verbatim.pm
@@ -27,9 +27,9 @@ package Pod::POM::Node::Verbatim;
use strict;
use parent qw( Pod::POM::Node );
-use vars qw( %ATTRIBS $ERROR );
+use vars qw( @ATTRIBS $ERROR );
-%ATTRIBS = ( text => '' );
+@ATTRIBS = ( text => '' );
sub present {
my ($self, $view) = @_;
diff --git a/t/PodPOMTestLib.pm b/t/PodPOMTestLib.pm
index 9f447cb..a051e42 100644
--- a/t/PodPOMTestLib.pm
+++ b/t/PodPOMTestLib.pm
@@ -59,7 +59,8 @@ sub run_tests {
local $TODO;
$TODO = $test->options->{todo} || '';
- my $pom = $pod_parser->parse_text($test->input);
+ my $pom = $pod_parser->parse_text($test->input)
+ or die $pod_parser->error;
my $result = $view ? $pom->present($view) : $pom->dump;
$eq->($result, $test->expect, $test->title);
--
1.7.10.4