Thread wer hat lust auf ein Spiel?
(61 answers)
Opened by conray at 2010-02-19 20:31 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 #_______________________________________________________________________ 'export=s, filename=i' => [ "export parameter [--file=<filename>]\t\texports a part of this script into a standalonescript", sub { my ($com, $file) = @_; my $line; open my $handle, '>>', $file or die "$file: $!\n"; print $handle '#!/usr/bin/perl'; print $handle 'use strict;'; print $handle 'use warnings;'; print $handle 'use FindBin;'; print $handle 'use Net::Ping;'; print $handle 'use LWP::UserAgent;'; print $handle 'use HTTP::Cookies;'; print $handle 'use File::Basename;'; close $handle; if ($com == "assimilate" || $com == "get_country") { while($line = <__FILE__> ) { if ($line =~ /^\Q\#exmark-$com-start\E/ .. $line =~ /^\Q\#exmark-$com-start\E/) { open $handle, ">>", $file; print $handle $line; close $handle; } if ($line =~ /^\Q\#exmark-$com-part-start\E/ .. $line =~ /^\Q\#exmark-$com-part-start\E/) { open $handle, ">>", $file; print $handle $line; close $handle; } } } else { while($line = <__FILE__> ) { if ($line =~ /^\Q\#exmark-$com-start\E/ .. $line =~ /^\Q\#exmark-$com-start\E/) { open $handle, ">>", $file; print $handle '#!/usr/bin/perl'; print $handle $line; close $handle; } } } }], #_______________________________________________________________________ so kommen keine errors mehr aber das mit der parameter übergabe haut noch nicht ganz hin. habe das $file durch $com ersetzt und jetzt kommt Quote |