#!/usr/bin/perl use CGI; use XML::XPath; use XML::XPath::XMLParser; my $q = new CGI; my $file = 'newmonk_perlquestions.xml'; my $xpath = XML::XPath->new(filename=>$file); # Find only new perl questions my $nodeset = $xpath->find('//NODE[@nodetype="perlquestion"]'); # Create web page to display matching nodes print $q->header( -type=>'text/html'), $q->start_html(-title=>'New Perl Questions'), "New Perl Questions", $q->br, $q->hr, foreach $node($nodeset->get_nodelist) { $nodeinfo = XML::XPath::XMLParser::as_string($node); $nodeinfo =~ /node_id=\"(\d+)/; print $q->a({-href=>"http://www.perlmonks.org/index.pl?node_id=$1"}, $nodeinfo), $q->br; } print $q->end_html; exit;