Assert-Conditional
view release on metacpan or search on metacpan
lib/Assert/Conditional.pm view on Meta::CPAN
241242243244245246247248249250251252253254255256257258259260261262263sub
assert_uppercased ( $ ) ;
sub
assert_void_context ( ) ;
sub
assert_whole_number ( $ ) ;
sub
assert_wide_characters ( $ ) ;
sub
assert_zero ( $ ) ;
############################################################
sub
import
{
my
(
$package
,
@conditional_imports
) =
@_
;
my
@normal_imports
=
$package
->_strip_import_conditions(
@conditional_imports
);
if
(
$Assert_Never
) {
$package
->SUPER::
import
(
@normal_imports
,
-if
=> 0) }
elsif
(
$Assert_Always
) {
$package
->SUPER::
import
(
@normal_imports
,
-if
=> 1) }
else
{
$package
->SUPER::
import
(
@conditional_imports
) }
$package
->_reimport_nulled_code_protos();
}
# This is just pretty extreme, but it's also about the only way to
# make the Exporter shut up about things we sometimes need to do in
# this module.
#
# Well, not quite the only way: there's always local *SIG. :)
#
# Otherwise it dribbles all over your screen when you try more than one
lib/Assert/Conditional.pm view on Meta::CPAN
275276277278279280281282283284285286287288289290291292293294295
qr/^Prototype mismatch:/
,
];
no
warnings
"redefine"
;
local
*Carp::carp
=
sub
{
my
(
$text
) =
@_
;
$text
=~
$_
&&
return
for
@$filters
;
local
$Carp::CarpInternal
{
"Exporter::Heavy"
} = 1;
$old_carp
->(
$text
);
};
$package
->SUPER::export_to_level(
$level
+2,
@export_args
);
}
# You have to do this if you have asserts that take a code
# ref as their first argument and people want to use those
# without parentheses. That's because the constant subroutine
# that gets installed necessarily no longer has the prototype
# needed to support a code ref in the dative slot syntactically.
sub
_reimport_nulled_code_protos {
my
(
$my_pack
) =
@_
;
my
$his_pack
=
caller
(1);
lib/Assert/Conditional/Utils.pm view on Meta::CPAN
735736737738739740741742743744745746747748749750751752753754}
BEGIN {
package
# so PAUSE doesn't index this
Acme::Plural::pl_count;
our
@ISA
=
'Acme::Plural::pl_simple'
;
sub
FETCH {
my
(
$self
,
$key
) =
@_
;
my
$several
=
$self
->SUPER::FETCH(
$key
);
my
(
$noun
,
$count
) = (
split
($; =>
$key
), 2);
return
"$count $several"
;
}
}
BEGIN {
package
# so PAUSE doesn't index this
Acme::Plural;
( run in 0.730 second using v1.01-cache-2.11-cpan-5f2e87ce722 )