ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/staticperl/perl/lib/CGI/eg/RunMeFirst
Revision: 1.1
Committed: Thu Jun 30 14:27:09 2005 UTC (21 years, 4 months ago) by root
Branch: MAIN
CVS Tags: PERL-5-8-7, HEAD
Branch point for: PERL
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.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 $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.
33     foreach (<*.cgi>) {
34     ($target = $_) =~ s/cgi$/txt/i;
35     symlink $_, $target unless -e $target;
36     }