constructor documentation
Dan Book [Sat, 7 Nov 2015 05:52:55 +0000 (00:52 -0500)]
README.pod
lib/DOM/Tiny.pm
lib/DOM/Tiny/CSS.pm
lib/DOM/Tiny/HTML.pm

index 2f6ea69..85a448a 100644 (file)
@@ -95,6 +95,14 @@ XML detection can also be disabled with the L</"xml"> method.
 
 L<DOM::Tiny> implements the following methods.
 
+=head2 new
+
+  my $dom = DOM::Tiny->new;
+  my $dom = DOM::Tiny->new('<foo bar="baz">I ♥ DOM::Tiny!</foo>');
+
+Construct a new scalar-based L<DOM::Tiny> object and L</"parse"> HTML/XML
+fragment if necessary.
+
 =head2 all_text
 
   my $trimmed   = $dom->all_text;
@@ -324,14 +332,6 @@ Find this element's namespace or return C<undef> if none could be found.
   # Find namespace for an element that may or may not have a namespace prefix
   my $namespace = $dom->at('svg > circle')->namespace;
 
-=head2 new
-
-  my $dom = DOM::Tiny->new;
-  my $dom = DOM::Tiny->new('<foo bar="baz">I ♥ DOM::Tiny!</foo>');
-
-Construct a new scalar-based L<DOM::Tiny> object and L</"parse"> HTML/XML
-fragment if necessary.
-
 =head2 next
 
   my $sibling = $dom->next;
index 8c208c7..5e20917 100644 (file)
@@ -18,6 +18,12 @@ use Scalar::Util qw(blessed weaken);
 
 our $VERSION = '0.001';
 
+sub new {
+  my $class = shift;
+  my $self = bless \DOM::Tiny::HTML->new, ref $class || $class;
+  return @_ ? $self->parse(@_) : $self;
+}
+
 sub all_text { shift->_all_text(1, @_) }
 
 sub ancestors { _select($_[0]->_collect($_[0]->_ancestors), $_[1]) }
@@ -97,12 +103,6 @@ sub namespace {
   return undef;
 }
 
-sub new {
-  my $class = shift;
-  my $self = bless \DOM::Tiny::HTML->new, ref $class || $class;
-  return @_ ? $self->parse(@_) : $self;
-}
-
 sub next      { $_[0]->_maybe($_[0]->_siblings(1, 0)->[1]) }
 sub next_node { $_[0]->_maybe($_[0]->_siblings(0, 0)->[1]) }
 
@@ -480,6 +480,14 @@ XML detection can also be disabled with the L</"xml"> method.
 
 L<DOM::Tiny> implements the following methods.
 
+=head2 new
+
+  my $dom = DOM::Tiny->new;
+  my $dom = DOM::Tiny->new('<foo bar="baz">I ♥ DOM::Tiny!</foo>');
+
+Construct a new scalar-based L<DOM::Tiny> object and L</"parse"> HTML/XML
+fragment if necessary.
+
 =head2 all_text
 
   my $trimmed   = $dom->all_text;
@@ -709,14 +717,6 @@ Find this element's namespace or return C<undef> if none could be found.
   # Find namespace for an element that may or may not have a namespace prefix
   my $namespace = $dom->at('svg > circle')->namespace;
 
-=head2 new
-
-  my $dom = DOM::Tiny->new;
-  my $dom = DOM::Tiny->new('<foo bar="baz">I ♥ DOM::Tiny!</foo>');
-
-Construct a new scalar-based L<DOM::Tiny> object and L</"parse"> HTML/XML
-fragment if necessary.
-
 =head2 next
 
   my $sibling = $dom->next;
index dbe552a..becedc6 100644 (file)
@@ -544,7 +544,8 @@ carefully since it is very dynamic.
 
 =head1 METHODS
 
-L<DOM::Tiny::CSS> implements the following methods.
+L<DOM::Tiny::CSS> inherits a constructor from L<Class::Tiny::Object|Class::Tiny/"Object construction">,
+and implements the following methods.
 
 =head2 matches
 
index e58aff6..042ae5f 100644 (file)
@@ -311,7 +311,8 @@ auto detection based on processing instructions.
 
 =head1 METHODS
 
-L<DOM::Tiny::HTML> implements the following methods.
+L<DOM::Tiny::HTML> inherits a constructor from L<Class::Tiny::Object|Class::Tiny/"Object construction">,
+and implements the following methods.
 
 =head2 parse