2 # Wanted Pages for Oddmuse Wikis
3 # Copyright (C) 2004 Alex Schroeder <alex@emacswiki.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the
17 # Free Software Foundation, Inc.
18 # 59 Temple Place, Suite 330
19 # Boston, MA 02111-1307 USA
21 use CGI qw
/:standard/;
22 use CGI
::Carp
qw(fatalsToBrowser);
25 if (not param
('url')) {
27 start_html
('Wanted Pages'),
29 p
('$Id: wanted.pl,v 1.3 2004/03/21 00:33:58 as Exp $'),
30 p
('Returns a list of wanted pages based on a dot-file.'),
31 start_form
(-method
=>'GET'),
32 p
('URL for dot-file: ', textfield
('url'), br
(),
33 'Example: http://www.emacswiki.org/cgi-bin/alex?action=links;raw=1'),
34 p
('URL for list of nodes: ', textfield
('nodes'), br
(),
35 'Example: http://www.emacswiki.org/cgi-bin/alex?action=index;raw=1;near=1'),
42 print header
(-type
=>'text/plain; charset=UTF-8');
43 $ua = LWP
::UserAgent
->new;
44 $request = HTTP
::Request
->new('GET', param
('url'));
45 $response = $ua->request($request);
46 $data = $response->content;
48 while ($data =~ m/"(.*?)" -> "(.*?)"/g) {
53 $request = HTTP
::Request
->new('GET', param
('nodes'));
54 $response = $ua->request($request);
55 $data = $response->content;
57 foreach $pg (split(/\n/, $data)) {
59 $page{$pg} = 1 if $pg;
62 foreach $link (sort keys %link) {
63 print $link, "\n" unless $page{$link};