Digest-SHA

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


	# 'use warnings' if possible, but stay portable

my($use_warnings, @EDITs);
my $warn_1 = 'BEGIN { $^W = 1 }';
my $warn_0 = 'BEGIN { $^W = 0 }';
{
	eval "require warnings; import warnings";
	$use_warnings = $@ ? 0 : 1;

	local(@ARGV) = ($PM, $SHASUM);
	while (<>) {
		if (
		(!$use_warnings && /^(use|no) warnings\b/) ||
		( $use_warnings && /^\Q$warn_1\E # use warnings\b/) ||
		( $use_warnings && /^\Q$warn_0\E # no warnings\b/)) {
			push @EDITs, $ARGV;
			close ARGV;
		}
	}
}

if (@EDITs) {
	local($^I, @ARGV) = ('', @EDITs);
	while (<>) {
		if ($use_warnings) {
			s/^\Q$warn_1\E # (.*)$/$1/;
			s/^\Q$warn_0\E # (.*)$/$1/;
		}
		else {
			s/^(use warnings\b.*)$/$warn_1 # $1/;
			s/^(no warnings\b.*)$/$warn_0 # $1/;
		}
		print;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.137 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )