Acme-use-strict-with-pride
view release on metacpan or search on metacpan
Revision history for Perl extension Acme::use::strict::with::pride.
0.04 Tue Jul 26 22:05:24 BST 2005
Dave's magnificent variable names in "use of uninitialized..." patch
means that on 5.9.2 and later the error message differs. So adjust the
test's regexp to cope with both variants.
0.03 Wed Sep 24 20:54:40 BST 2003
Turn this file the other way up, so recent changes are at the top
It seems that Test::Harness now turns on warnings everywhere
(not just pre 5.8.0)
I guess I assumed that it was 5.6.x because I'd upgraded T::H on
my 5.6.1 install.
Anyway, bad modules can now be bad, and all the tests pass.
0.02 Mon Oct 14 22:10:26 BST 2002
Inspiration on the way home from work - use a "# line " directive to
force the line numbers in the files, rather than messy $SIG{__WARN__}
and $SIG{__DIE__} handlers to launder the error messages later.
About an hour and a bit later, having discovered that coderef INC
filters (if not all filters - check this carefully) can't return
multiple lines in the same string, finally get the bugger working.
Also add a test to check that we can actually load the modules without
warnings or errors before using Acme::use::strict::with::pride
Break the tiehandle out into a new package GagMe;
(Well, it seemed to be an accurate description of what it is doing to
STDERR)
0.01 Sat Oct 12 17:55:41 2002
- original version; created by h2xs 1.22 with options
-b 5.6.0 -X -n Acme::use::strict::with::pride
=head1 SEE ALSO
L<strict> L<warnings> L<Acme::USIG>
=head1 BUGS
There's no unimport. There's no way to specify an import list to
C<use strict;> or C<use warnings;>. There's no way to exclude specific
modules (eg C<Exporter>) from the clutches C<Acme::use::strict:with::pride>.
The error and warning handling is global, rather than being chained, and it
won't play nicely with error objects. The source filter in coderef C<@INC> is
undocumented, so I shouldn't be using it.
=head1 AUTHOR
Nicholas Clark, E<lt>nick@talking.bollo.cxE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright 2002,2003 by Nicholas Clark
t/naughty_modules.t view on Meta::CPAN
# don't want them?
$^W = 0;
$SIG{__WARN__} = sub {print STDERR $_[0]};
# Test things misbehave as expected without Acme::use::strict::with::pride
my $debug = tie *STDERR, 'GagMe';
is (eval "require Bad; 2", 2, "Should be able to use Bad");
is ($@, "", "without an error");
is ($::loaded{Bad}, 1, "Bad did actually get loaded?");
is ($debug->read, '', "There should be no warnings");
is (eval "use Naughty; 2", 2, "Should be able to use Naughty");
is ($@, "", "without an error");
is ($debug->read, '', "There should be no warnings");
is ($::loaded{Naughty}, 1, "Naughty did actually get loaded?");
undef $debug;
untie *STDERR;
t/whip_them_into_line.t view on Meta::CPAN
$SIG{__WARN__} = sub {print STDERR $_[0]};
use Acme::use::strict::with::pride;
ok(1); # If we made it this far, we're ok.
my $debug = tie *STDERR, 'GagMe';
is (eval "require Bad; 2", 2, "Should be able to use Bad");
is ($@, "", "without an error");
is ($::loaded{Bad}, 1, "Bad did actually get loaded?");
like ($debug->read,
qr!^Use of uninitialized value(?: \$a)? in addition \(\+\) at t/Bad.pm line 6\.$!,
"Is the error properly mangled");
is (eval "use Naughty; 2", undef, "Should not be able to use Naughty");
like ($@, qr!Global symbol "\$what_am_i" requires explicit package name at t/Naughty.pm line 4.!,
"Is the error properly mangled");
is ($debug->read, '', "eval should have caught the error");
is ($::loaded{Naughty}, 1, "Naughty did actually get loaded?");
undef $debug;
untie *STDERR;
( run in 0.252 second using v1.01-cache-2.11-cpan-65fba6d93b7 )