Assert-Conditional

 view release on metacpan or  search on metacpan

lib/Assert/Conditional.pm  view on Meta::CPAN

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
sub  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

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
        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

735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
}
 
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 )