source: for-distributions/trunk/bin/windows/perl/lib/CGI/eg/RunMeFirst@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 754 bytes
Line 
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 $uu (<*.uu>) {
13 unless (open UU, "<$uu") { warn "Can't open $uu: $!\n"; next }
14 while (<UU>) {
15 chomp;
16 if (/^begin\s+\d+\s+(.+)$/) {
17 $bin = $1;
18 last;
19 }
20 }
21 unless (open BIN, "> $bin") { warn "Can't create $bin: $!\n"; next }
22 binmode BIN;
23 while (<UU>) {
24 chomp;
25 last if /^end/;
26 print BIN unpack "u", $_;
27 }
28 close BIN;
29 close UU;
30}
31
32# Create symlinks from *.txt to *.cgi for documentation purposes.
33foreach (<*.cgi>) {
34 ($target = $_) =~ s/cgi$/txt/i;
35 symlink $_, $target unless -e $target;
36}
Note: See TracBrowser for help on using the repository browser.