Changeset 17304
- Timestamp:
- 08/10/08 01:04:43 (5 years ago)
- Location:
- lang/perl/MooseX-DOM/trunk
- Files:
-
- 5 modified
-
Changes (modified) (1 diff)
-
lib/MooseX/DOM.pm (modified) (1 diff)
-
lib/MooseX/DOM/LibXML.pm (modified) (1 diff)
-
t/01_simple.t (modified) (2 diffs)
-
t/lib/Test/MxD/Simple.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/MooseX-DOM/trunk/Changes
r17251 r17304 2 2 ======= 3 3 4 0.00002 - 10 Aug 2008 5 * Implement unimport(), so you can do 'no MooseX::DOM' 6 * Refactor get/set operations so you can specify them at declaration time 7 4 8 0.00001 - 08 Aug 2008 5 9 * Initial release -
lang/perl/MooseX-DOM/trunk/lib/MooseX/DOM.pm
r17299 r17304 72 72 73 73 =head1 DECLARATION 74 75 =head2 has_dom_root $tag 76 77 Specifies that the given XML have the specified tag 74 78 75 79 =head2 has_dom_attr $name[, %opts] -
lang/perl/MooseX-DOM/trunk/lib/MooseX/DOM/LibXML.pm
r17299 r17304 112 112 113 113 my %exports = ( 114 has_dom_root => sub { 115 return Class::MOP::subname($subname->('has_dom_attr') => sub ($;%) { 116 my $caller = caller(); 117 my $tag = shift; 118 119 my $assert_root = sub { 120 my $self = shift; 121 my $node = shift || $self->node; 122 if ($node && $node->getName ne $tag) { 123 confess "given node does not have required root node $tag"; 124 } 125 }; 126 127 my $meta = $caller->meta; 128 $meta->add_around_method_modifier(new => sub { 129 my $next = shift; 130 my $self = $next->(@_); 131 $assert_root->($self); 132 return $self; 133 }); 134 $meta->add_after_method_modifier(node => sub { 135 my $self = shift; 136 if (@_) { 137 $assert_root->($self, @_); 138 } 139 }); 140 }); 141 }, 114 142 has_dom_attr => sub { 115 143 return Class::MOP::subname($subname->('has_dom_attr') => sub ($;%) { -
lang/perl/MooseX-DOM/trunk/t/01_simple.t
r17249 r17304 1 1 use strict; 2 2 use lib "t/lib"; 3 use Test::More (tests => 9);3 use Test::More (tests => 10); 4 4 5 5 BEGIN … … 41 41 is($obj->attribute, "fuga"); 42 42 } 43 44 { 45 my $xml = <<EOXML; 46 <food attribute="hoge" xmlns="http://www.w3.org/2005/Atom"> 47 <title>Hoge</title> 48 <multi>multi1</multi> 49 <multi>multi2</multi> 50 <multi>multi3</multi> 51 <multi>multi4</multi> 52 </food> 53 EOXML 54 55 my $obj = eval { Test::MxD::Simple->new(node => $xml) }; 56 like($@, qr/given node does not have required root node/); 57 } -
lang/perl/MooseX-DOM/trunk/t/lib/Test/MxD/Simple.pm
r17299 r17304 5 5 use MooseX::DOM; 6 6 7 has_dom_root 'feed'; 7 8 has_dom_attr 'attribute'; 8 9 has_dom_child 'title';
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)