Util-Underscore
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Util/Underscore/CallStackFrame.pm view on Meta::CPAN
# This class wraps them so that users don't have to deal with them.
sub of {
my ($class, $level) = @_;
package DB; ## no critic (ProhibitMUltiplePackages)
my @caller = CORE::caller($level + 1);
return if not @caller;
push @caller, [@DB::args]; ## no critic (ProhibitPackageVars)
return bless \@caller => $class;
}
## no critic (ProhibitBuiltinHomonyms)
sub package { shift()->[0] }
sub file { shift()->[1] }
t/01-scalars.t view on Meta::CPAN
package Local::Stringy;
use overload '""' => sub {
my ($self) = @_;
return $$self;
};
sub new {
my ($class, $val) = @_;
return bless \$val => $class;
}
}
my $stringy = Local::Stringy->new("foo");
subtest '_::is_plain' => sub {
plan tests => 7;
ok _::is_plain 42, "positive number";
ok _::is_plain "foo", "positive string";
ok !_::is_plain [], "negative ref";
t/02-numbers.t view on Meta::CPAN
package Local::Numeric;
use overload '0+' => sub {
my ($self) = @_;
return $$self;
};
sub new {
my ($class, $val) = @_;
return bless \$val => $class;
}
}
subtest '_::is_numeric' => sub {
plan tests => 6;
my $numy_good = Local::Numeric->new(42);
my $numy_bad = Local::Numeric->new("foo");
subtest 'positive numbers' => sub {
plan tests => 7;
t/04-objects.t view on Meta::CPAN
}
my %class = (
parent => 'Local::Parent',
child => 'Local::Child',
mock => 'Local::Mock',
unrelated => 'Local::Unrelated',
);
my %object;
$object{$_} = bless [] => $class{$_} for keys %class;
my $zero_object = bless [] => '0';
subtest 'fixtures' => sub {
plan tests => 6;
for (keys %object) {
is ref $object{$_}, $class{$_}, "instantiation for $_ successful";
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.380 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )