| 1 | package TPath::Selector::Test::AnywhereAttribute; | ||
| 2 | $TPath::Selector::Test::AnywhereAttribute::VERSION = '1.007'; | ||
| 3 | # ABSTRACT: handles C<//@foo> expression | ||
| 4 | |||
| 5 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use TPath::Test::Node::Attribute; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 0 | ▶ | use TPath::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 8 | use namespace::autoclean; | ||
| 9 | |||
| 10 | |||
| 11 | with 'TPath::Selector::Test'; | ||
| 12 | |||
| 13 | has a => ( is => 'ro', isa => 'TPath::Attribute', required => 1 ); | ||
| 14 | |||
| 15 | around BUILDARGS => sub { | ||
| 16 | my ( $orig, $class, %args ) = @_; | ||
| 17 | $class->$orig( | ||
| 18 | %args, | ||
| 19 | first_sensitive => 1, | ||
| 20 | axis => 'descendant', | ||
| 21 | ); | ||
| 22 | }; | ||
| 23 | |||
| 24 | sub BUILD { | ||
| 25 | my $self = shift; | ||
| 26 | my $nt = TPath::Test::Node::Attribute->new( a => $self->a ); | ||
| 27 | $self->_node_test($nt); | ||
| 28 | } | ||
| 29 | |||
| 30 | sub to_string { | ||
| 31 | my $self = shift; | ||
| 32 | '//' . ( $self->is_inverted ? '^' : '' ) . $self->a->to_string; | ||
| 33 | } | ||
| 34 | |||
| 35 | __PACKAGE__->meta->make_immutable; | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | __END__ | ||