#!/usr/bin/perl -s use strict; use File::Copy; use Data::Dumper; our ($cgi,$h); if($h){ my $f=join("",()); $f=~ s/__END__.*//s; print $f; exit 0;} my $file=shift or die("usage: $0 [-cgi=path] file\n"); my %a=(); open(F,$file); while(){ if(/#-->(cgi|dir|log|local_publish):\s*(\S+)/){ $a{$1}=$2 } if( /\b(cgi|dir|log|local_publish)\b.*?["']([^"'\n]+)["']/){ $a{$1}||=$2 } } close F; $a{cgi} = $cgi if $cgi; $a{dir} = "/tmp" unless $a{tmp}; if(not defined $a{cgi}) { die( "#-->cgi:... expected \n or $0 -cgi=instalation_path file\n");} ## print Dumper(\%a); system("perl -c $file"); mkdir($a{dir}); chmod (0777,$a{dir}); mkdir("$a{dir}/IN"); mkdir("$a{dir}/OUT"); chmod (0777,"$a{dir}/IN"); chmod (0777,"$a{dir}/OUT"); if($a{local_publish}){ mkdir("$a{local_publish}"); chmod(0777,"$a{local_publish}"); } copy($file,$a{cgi}); chmod(0755,$a{cgi}); __DATA__ #!/usr/bin/perl #-->cgi:/home/jj/cgibin/catcgi #-->dir:/tmp/lixo use strict; use CGI::Auto; use encoding "utf8"; #binmode(STDIN,":utf8"); CGI::Auto::auto(title => "title text", command => "echo [%o(options)] [%f(e2)] ", -options => [ long_lines => "-l" ], dir => "/tmp/lixo", debug => 1, # tohtml => "table", # th => ["", "Lines","Words","Chars","Filename"], # fs => qr{\s+}, ); ~ __END__