This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[differences between cumulative patch application and perl-5.003_96]
[perl5.git] / eg / cgi / RunMeFirst
1 #!/usr/local/bin/perl
2
3 # Make a world-writeable directory for saving state.
4 $ww = 'WORLD_WRITABLE';
5 unless (-w $ww) {
6     $u = umask 0;
7     mkdir $ww, 0777;
8     umask $u;
9 }
10
11 # Decode the sample image.
12 for $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.
26 foreach (<*.cgi>) {
27     ($target = $_) =~ s/cgi$/txt/;
28     symlink $_, $target unless -e $target;
29 }