9 use Data::Validate::URI qw(is_uri);
13 print "$0: [-f] url_to_pukiwikiplus_page\n";
18 if ($ARGV[0] eq '-f') {
23 die "$0: '$url' is not URI" unless is_uri($url);
25 if ($url !~ /cmd=source/ ) {
26 $url =~ s#\?(.+)#\?cmd=source&page=$1#;
28 $file = wikifile($1) . '.txt';
32 print STDERR "getting: '$url'\n";
34 my $source = scraper {
35 process "pre#source", "source" => "TEXT";
39 my $text = $source->scrape( URI->new($url) );
42 print STDERR "saving: '$file'\n";
43 open STDOUT, ">$file";
45 print encode('utf8', $text);
49 my $pagename = shift @_;
51 $pagename =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack('H2', $1)/eg;
52 return uc unpack("H*", $pagename);