#_______________________________________________________________________ 'export=s, filename=i' => [ "export parameter [--file=]\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; } } } }], #_______________________________________________________________________