| 1 | package TPath::Selector::Test::ChildAttribute; | ||
| 2 | $TPath::Selector::Test::ChildAttribute::VERSION = '1.007'; | ||
| 3 | # ABSTRACT: handles C</@foo> where this is not the first step in the path, or C<child::@foo> | ||
| 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 | sub BUILD { | ||
| 16 | my $self = shift; | ||
| 17 | $self->_node_test( TPath::Test::Node::Attribute->new( a => $self->a ) ); | ||
| 18 | } | ||
| 19 | |||
| 20 | sub to_string { | ||
| 21 | my ( $self, $first ) = @_; | ||
| 22 | my $s = $first ? '' : '/'; | ||
| 23 | $s .= '^' if $self->is_inverted; | ||
| 24 | $s .= $self->a->to_string; | ||
| 25 | return $s; | ||
| 26 | } | ||
| 27 | |||
| 28 | __PACKAGE__->meta->make_immutable; | ||
| 29 | |||
| 30 | 1; | ||
| 31 | |||
| 32 | __END__ | ||