summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Tree/Transform/XSLTish.pm6
-rw-r--r--lib/Tree/Transform/XSLTish/Context.pm2
-rw-r--r--lib/Tree/Transform/XSLTish/Transformer.pm23
-rw-r--r--lib/Tree/Transform/XSLTish/Utils.pm2
4 files changed, 17 insertions, 16 deletions
diff --git a/lib/Tree/Transform/XSLTish.pm b/lib/Tree/Transform/XSLTish.pm
index e489992..4eb047f 100644
--- a/lib/Tree/Transform/XSLTish.pm
+++ b/lib/Tree/Transform/XSLTish.pm
@@ -8,7 +8,7 @@ use Tree::Transform::XSLTish::Transformer;
use Carp::Clan qw(^Tree::Transform::XSLTish);
use 5.006;
-our $VERSION='0.2';
+our $VERSION='0.3';
my @DEFAULT_EXPORTS=('tree_rule',
'default_rules',
@@ -242,8 +242,8 @@ This function declares that the
L<Tree::Transform::XSLTish::Transformer> object returned by L</new>
should call the passed code-ref to get its engine.
-C<engine_class $classname> is equivalent to C<engine_factory {
-$classname->new }>.
+C<engine_class $classname> is equivalent to C<< engine_factory {
+$classname->new } >>.
This function is not exported by default: you have to use the module as:
diff --git a/lib/Tree/Transform/XSLTish/Context.pm b/lib/Tree/Transform/XSLTish/Context.pm
index bb7c9de..9ef7062 100644
--- a/lib/Tree/Transform/XSLTish/Context.pm
+++ b/lib/Tree/Transform/XSLTish/Context.pm
@@ -2,7 +2,7 @@ package Tree::Transform::XSLTish::Context;
use Moose;
use Carp::Clan qw(^Tree::Transform::XSLTish);
-our $VERSION='0.2';
+our $VERSION='0.3';
has 'current_node' => ( is => 'rw', isa => 'Object' );
has 'node_list' => ( is => 'rw', isa => 'ArrayRef[Object]' );
diff --git a/lib/Tree/Transform/XSLTish/Transformer.pm b/lib/Tree/Transform/XSLTish/Transformer.pm
index d5ad6ec..16e27bd 100644
--- a/lib/Tree/Transform/XSLTish/Transformer.pm
+++ b/lib/Tree/Transform/XSLTish/Transformer.pm
@@ -1,14 +1,11 @@
package Tree::Transform::XSLTish::Transformer;
use Moose;
-use MooseX::AttributeHelpers;
use Moose::Util::TypeConstraints;
-use Params::Validate ':all';
use Tree::Transform::XSLTish::Utils;
use Tree::Transform::XSLTish::Context;
-use Tree::XPathEngine;
use Carp::Clan qw(^Tree::Transform::XSLTish);
-our $VERSION='0.2';
+our $VERSION='0.3';
subtype 'Tree::Transform::XSLTish::Engine'
=> as 'Object'
@@ -19,18 +16,19 @@ subtype 'Tree::Transform::XSLTish::Engine'
has 'rules_package' => (is => 'ro', isa => 'ClassName');
has 'context_stack' => (
- metaclass => 'Collection::Array',
+ traits => ['Array'],
is => 'rw',
isa => 'ArrayRef[Tree::Transform::XSLTish::Context]',
default => sub { [] },
- provides => {
- last => 'context',
- push => 'enter',
- pop => 'leave',
- empty => 'has_context',
+ handles => {
+ enter => 'push',
+ leave => 'pop',
+ has_context => 'count',
},
);
+sub context { return $_[0]->context_stack->[-1] }
+
has 'engine' => (
is => 'ro',
isa => 'Tree::Transform::XSLTish::Engine',
@@ -47,6 +45,7 @@ sub _build_engine {
return $factory->();
}
}
+ require Tree::XPathEngine;
return Tree::XPathEngine->new();
}
@@ -164,6 +163,8 @@ sub find_rule_by_name_in_package {
if (exists $rules->{$name}) {
return $rules->{$name};
}
+
+ return;
}
sub rule_matches {
@@ -296,7 +297,7 @@ L<find_rule_in_package> and returns the first defined result.
=head2 C<find_rule_in_package>
Gets all the rules having a C<match> attribute, filters those for
-which L<rule_matches> returns true, sorts them priority, and returns
+which L<rule_matches> returns true, sorts them by priority, and returns
the one with the highest priority.
Dies if there is more than one rule with the highest priority; returns
diff --git a/lib/Tree/Transform/XSLTish/Utils.pm b/lib/Tree/Transform/XSLTish/Utils.pm
index c760585..77746d8 100644
--- a/lib/Tree/Transform/XSLTish/Utils.pm
+++ b/lib/Tree/Transform/XSLTish/Utils.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Class::MOP;
-our $VERSION='0.2';
+our $VERSION='0.3';
my $RULES_NAME='%_tree_transform_rules';