X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=eg%2Fcgi%2FRunMeFirst;h=018b11b7184972b286dfdcbfbd227c8b7be9a624;hb=424ec8fa43885c75adde62690957af43a6537c02;hp=c96d79eb62802cb901a0a344cc6fa8a00c353840;hpb=eab60bb1f2e96e200fbded3694574d80930d568e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/eg/cgi/RunMeFirst b/eg/cgi/RunMeFirst index c96d79e..018b11b 100755 --- a/eg/cgi/RunMeFirst +++ b/eg/cgi/RunMeFirst @@ -9,10 +9,17 @@ unless (-w $ww) { } # Decode the sample image. -for $bin (qw(wilogo.gif)) { - unless (open UU, "$bin.uu") { warn "Can't open $bin.uu: $!\n"; next } +for $uu (<*.uu>) { + unless (open UU, "<$uu") { warn "Can't open $uu: $!\n"; next } + while () { + chomp; + if (/^begin\s+\d+\s+(.+)$/) { + $bin = $1; + last; + } + } unless (open BIN, "> $bin") { warn "Can't create $bin: $!\n"; next } - $_ = ; + binmode BIN; while () { chomp; last if /^end/; @@ -24,6 +31,6 @@ for $bin (qw(wilogo.gif)) { # Create symlinks from *.txt to *.cgi for documentation purposes. foreach (<*.cgi>) { - ($target = $_) =~ s/cgi$/txt/; + ($target = $_) =~ s/cgi$/txt/i; symlink $_, $target unless -e $target; }