Refresh CGI to 2.34
[p5sagit/p5-mst-13.2.git] / eg / cgi / RunMeFirst
CommitLineData
54310121 1#!/usr/local/bin/perl
2
3# Make a world-writeable directory for saving state.
4$ww = 'WORLD_WRITABLE';
5unless (-w $ww) {
6 $u = umask 0;
7 mkdir $ww, 0777;
8 umask $u;
9}
10
11# Decode the sample image.
12for $bin (qw(wilogo.gif)) {
13 unless (open UU, "$bin.uu") { warn "Can't open $bin.uu: $!\n"; next }
14 unless (open BIN, "> $bin") { warn "Can't create $bin: $!\n"; next }
15 $_ = <UU>;
16 while (<UU>) {
17 chomp;
18 last if /^end/;
19 print BIN unpack "u", $_;
20 }
21 close BIN;
22 close UU;
23}
24
25# Create symlinks from *.txt to *.cgi for documentation purposes.
26foreach (<*.cgi>) {
27 ($target = $_) =~ s/cgi$/txt/;
28 symlink $_, $target unless -e $target;
29}