1: (The one that doesn't work...see [Stranger and Stranger...])<P>
2: (<I>Begin <TT>/cgi-bin/printnode4.pl</TT>)</I>
3:
4: <CODE>
5: #!/usr/bin/perl
6:
7: #Printnode version 4
8:
9: #Called from basedir/cgi-bin
10: #options: ?node=x
11: #result prints basedir/nodes/x if exists and is arg
12: #or basedir/err404loc if not
13: #or basedir/nodes/$nonodespec if no arg named node
14:
15: #(C) me 1999
16:
17: $nonodespec = "default.html";
18: $err404loc = "404.html";
19:
20: $data_from_get_method = $ENV{'QUERY_STRING'};
21:
22: # break up the answer into field value pairs
23: @GET_FIELD_PAIRS = split(/&/,$data_from_get_method);
24:
25: # determine the exact name and value for each pair
26:
27: foreach $pair (@GET_FIELD_PAIRS)
28: {
29: # split field name from value on =
30: ($field_name, $field_value) = split (/=/, $pair);
31:
32: # translate '+' to ' ' --- convert + back to spaces
33: $field_value =~ tr/+/ /; # translate string in place
34:
35: # decode the &nn values
36: $field_value =~ s/%([a-fA-F0-9][a-f-A-F0-9])/pack("C",hex($1))/eg;
37:
38: # put all of the values into an associative array
39: # for use later
40: $GETFORMDATA{$field_name} = $field_value;
41:
42: }
43:
44: #set nodedisp to $GETFORMDATA("node") and read file into $data
45: #or default if none
46:
47: if (defined $GETFORMDATA{"node"}) {
48: $nodedisp= $GETFORMDATA{"node"};
49: }
50: else {
51: $nodedisp= $nonodespec;
52: }
53: my $baquux= join "", "../nodes/$nodedisp";
54: if ( -e $baquux) {
55: </CODE>