1. Toby Inkster
  2. p5-web-magic

Commits

Toby Inkster  committed ec8b378

Integrate X:LX:QuerySelector.

  • Participants
  • Parent commits 3986966
  • Branches default

Comments (0)

Files changed (3)

File lib/Web/Magic.pm

View file
 
 BEGIN {
 	$Web::Magic::AUTHORITY = 'cpan:TOBYINK';
-	$Web::Magic::VERSION   = '0.004';
+	$Web::Magic::VERSION   = '0.005';
 }
 
 use Acme::24 0.03                  qw//; 
 use URI 0                          qw//;
 use URI::Escape 0                  qw//;
 use XML::LibXML 1.70               qw//;
+use XML::LibXML::QuerySelector 0   qw//;
 use YAML::Any 0                    qw/Load Dump/;
 
 use overload
 		foreach qw/getElementsByTagName getElementsByTagNameNS
 			getElementsByLocalName getElementsById documentElement
 			cloneNode firstChild lastChild findnodes find findvalue
-			exists childNodes attributes getNamespaces/;
+			exists childNodes attributes getNamespaces
+			querySelector querySelectorAll/;
 	$F{$_} = 'to_hashref'
 		foreach qw/findNodes/;
 	$F{$_} = 'to_model'
 call C<to_dom>: getElementsByTagName getElementsByTagNameNS
 getElementsByLocalName getElementsById documentElement
 cloneNode firstChild lastChild findnodes find findvalue
-exists childNodes attributes getNamespaces. So, for example, the
-following are equivalent:
+exists childNodes attributes getNamespaces querySelector
+querySelectorAll. So, for example, the following are equivalent:
 
-  W('http://example.com/')->to_dom->getElementsByTagName('title');
-  W('http://example.com/')->getElementsByTagName('title');
+  my @titles = W('http://example.com/')
+    ->to_dom->getElementsByTagName('title');
+  
+  my @titles = W('http://example.com/')
+    ->getElementsByTagName('title');
+
+I'll just draw your attention to C<querySelector> and C<querySelectorAll>
+which were mentioned in the previous paragraph, but are hidden gems.
+See L<XML::LibXML::QuerySelector> for details.
 
 =item C<< to_model >>
 

File meta/changes.ttl

View file
 		dcs:item   [ rdfs:label "Preparation for an asynchronous implementation of Web::Magic. The current implementation is synchronous and likely to remain so - any async version will be a subclass."@en ]
 		] .
 
+dist:project :release dist:v_0-005 .
+dist:v_0-005
+	a               :Version ;
+	dc:issued       "2012-01-06"^^xsd:date ; ???
+	:revision       "0.005"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Web-Magic-0.005.tar.gz> ;
+	dcs:changeset [
+		dcs:versus dist:v_0-004 ;
+		dcs:item   [ rdfs:label "'querySelector' and 'querySelectorAll' methods."@en ; a dcs:Addition ]
+		] .
+

File meta/makefile.ttl

View file
 		"URI 0",
 		"URI::Escape 0",
 		"XML::LibXML 1.70",
+		"XML::LibXML::QuerySelector 0",
 		"YAML::Any 0".
 
 _:main <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName> "lib/Web/Magic.pm" .