diff options
author | J Pipkin <j@dawnrazor.net> | 2013-01-12 04:14:03 -0600 |
---|---|---|
committer | J Pipkin <j@dawnrazor.net> | 2013-01-12 04:14:03 -0600 |
commit | be2bb2b27d61a39bff6efd890c3d519c39db321e (patch) | |
tree | 387f0c14a12526c6eb1668b3d588ded1a0472212 /t/prep.pl | |
parent | b2a26f795d32e398bfc3dbfc13882419bd3ba929 (diff) | |
download | sbotools2-be2bb2b27d61a39bff6efd890c3d519c39db321e.tar.xz |
implement failure-dependent exit statuses, ask to proceed if a failure is encountered during the process
Diffstat (limited to 't/prep.pl')
-rwxr-xr-x | t/prep.pl | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -69,15 +69,15 @@ while (my $line = <$file_h>) { } seek $file_h, 0, 0; -my @not_exported; -FIRST: for my $sub (@subs) { - my $found = 'FALSE'; - my $has = 'FALSE'; +my @not_exported; +FIRST: for my $sub (@subs) { + my $found = 'FALSE'; + my $has = 'FALSE'; SECOND: while (my $line = <$file_h>) { - if ($found eq 'FALSE') { + if ($found eq 'FALSE') { $found = 'TRUE', next SECOND if $line =~ /\@EXPORT/; - } else { - last SECOND if $line =~ /^\);$/; + } else { + last SECOND if $line =~ /^\);$/; $has = 'TRUE', last SECOND if $line =~ /$sub/; } } @@ -91,7 +91,20 @@ FIRST: for my $line (@file) { if ($line =~ /\@EXPORT/) { $line = "our \@EXPORT = qw(". join ' ', @not_exported; } - $line = "#$line" if $line =~ /root privileges/; + $line =~ s/^/#/ if $line =~ /^read_config;$/; } - +my $found = 0; +FIRST: for my $line (@file) { + unless ($found) { + if ($line =~ /^unless\s+\(\$<\s+==/) { + $found++; + $line =~ s/^/#/; + } + } else { + $line =~ s/^/#/; + if ($line =~ /^#}$/) { + last FIRST; + } + } +} |