view release on metacpan or search on metacpan
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm view on Meta::CPAN
my $class = "ExtUtils::MM_$OS";
eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; ## no critic
die $@ if $@;
unshift @ISA, $class;
sub _assert {
my $sanity = shift;
die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity;
return;
}
cpan/Filter-Util-Call/Call.pm view on Meta::CPAN
sub filter_add($)
{
my($obj) = @_ ;
# Did we get a code reference?
my $coderef = (ref $obj eq 'CODE');
# If the parameter isn't already a reference, make it one.
if (!$coderef and (!ref($obj) or ref($obj) =~ /^ARRAY|HASH$/)) {
$obj = bless (\$obj, (caller)[0]);
}
# finish off the installation of the filter in C.
Filter::Util::Call::real_import($obj, (caller)[0], $coderef) ;
}
XSLoader::load('Filter::Util::Call');
1;
__END__
=head1 NAME
Filter::Util::Call - Perl Source Filter Utility Module
cpan/Getopt-Long/lib/Getopt/Long.pm view on Meta::CPAN
# Shift in default array.
unshift(@_, \@ARGV);
# Try to keep caller() and Carp consistent.
goto &GetOptionsFromArray;
}
sub GetOptionsFromString(@) {
my ($string) = shift;
require Text::ParseWords;
my $args = [ Text::ParseWords::shellwords($string) ];
$caller ||= (caller)[0]; # current context
my $ret = GetOptionsFromArray($args, @_);
return ( $ret, $args ) if wantarray;
if ( @$args ) {
$ret = 0;
warn("GetOptionsFromString: Excess data \"@$args\" in string \"$string\"\n");
}
$ret;
}
sub GetOptionsFromArray(@) {
my ($argv, @optionlist) = @_; # local copy of the option descriptions
my $argend = '--'; # option list terminator
my %opctl = (); # table of option specs
my $pkg = $caller || (caller)[0]; # current context
# Needed if linkage is omitted.
my @ret = (); # accum for non-options
my %linkage; # linkage
my $userlinkage; # user supplied HASH
my $opt; # current option
my $prefix = $genprefix; # current prefix
$error = '';
if ( $debug ) {
cpan/Getopt-Long/lib/Getopt/Long/Parser.pm view on Meta::CPAN
# Getopt::Long has a stub for Getopt::Long::Parser::new.
use Getopt::Long ();
no warnings 'redefine';
sub new {
my $that = shift;
my $class = ref($that) || $that;
my %atts = @_;
# Register the callers package.
my $self = { caller_pkg => (caller)[0] };
bless ($self, $class);
my $default_config = Getopt::Long::_default_config();
# Process config attributes.
if ( defined $atts{config} ) {
my $save = Getopt::Long::Configure ($default_config, @{$atts{config}});
$self->{settings} = Getopt::Long::Configure ($save);
delete ($atts{config});
cpan/IO-Compress/lib/IO/Compress/Base.pm view on Meta::CPAN
if $outType eq 'buffer' && Scalar::Util::readonly(${ $_[0] });
return 1;
}
sub _def
{
my $obj = shift ;
my $class= (caller)[0] ;
my $name = (caller(1))[3] ;
$obj->croakError("$name: expected at least 1 parameters\n")
unless @_ >= 1 ;
my $input = shift ;
my $haveOut = @_ ;
my $output = shift ;
my $x = IO::Compress::Base::Validator->new($class, *$obj->{Error}, $name, $input, $output)
cpan/IO-Compress/lib/IO/Compress/Base/Common.pm view on Meta::CPAN
# {
# return $self->saveErrorString("hash value not ok") ;
# }
# }
#
# return $self ;
#}
sub createSelfTiedObject
{
my $class = shift || (caller)[0] ;
my $error_ref = shift ;
my $obj = bless Symbol::gensym(), ref($class) || $class;
tie *$obj, $obj if $] >= 5.005;
*$obj->{Closed} = 1 ;
$$error_ref = '';
*$obj->{Error} = $error_ref ;
my $errno = 0 ;
*$obj->{ErrorNo} = \$errno ;
cpan/IO-Compress/lib/IO/Uncompress/Base.pm view on Meta::CPAN
# }
return 1;
}
sub _inf
{
my $obj = shift ;
my $class = (caller)[0] ;
my $name = (caller(1))[3] ;
$obj->croakError("$name: expected at least 1 parameters\n")
unless @_ >= 1 ;
my $input = shift ;
my $haveOut = @_ ;
my $output = shift ;
cpan/IO-Compress/t/011-streamzip.t view on Meta::CPAN
$aok &= is $?, 0, " exit status is 0" ;
$aok &= is readFile($stderr), '', " no stderr" ;
$aok &= is $stdout, $expected, " expected content is ok"
if defined $expected ;
if (! $aok) {
diag "Command line: $cmd";
my ($file, $line) = (caller)[1,2];
diag "Test called from $file, line $line";
}
1 while unlink $stderr;
}
# streamzip
# #########
cpan/Pod-Checker/t/pod/testcmp.pl view on Meta::CPAN
#use strict;
#use diagnostics;
use Carp;
use Exporter;
use File::Basename;
use File::Spec;
use FileHandle;
@ISA = qw(Exporter);
@EXPORT = qw(&testcmp);
$MYPKG = eval { (caller)[0] };
##--------------------------------------------------------------------------
=head1 NAME
testcmp -- compare two files line-by-line
=head1 SYNOPSIS
$is_diff = testcmp($file1, $file2);
cpan/Pod-Checker/t/pod/testpchk.pl view on Meta::CPAN
use vars qw(@ISA @EXPORT @EXPORT_OK $MYPKG);
#use strict;
#use diagnostics;
use Carp;
use Exporter;
#use File::Compare;
@ISA = qw(Exporter);
@EXPORT = qw(&testpodchecker);
@EXPORT_OK = qw(&testpodcheck);
$MYPKG = eval { (caller)[0] };
sub stripname( $ ) {
local $_ = shift;
return /(\w[.\w]*)\s*$/ ? $1 : $_;
}
sub msgcmp( $ $ ) {
## filter out platform-dependent aspects of error messages
my ($line1, $line2) = @_;
for ($line1, $line2) {
cpan/Pod-Usage/t/pod/testcmp.pl view on Meta::CPAN
#use strict;
#use diagnostics;
use Carp;
use Exporter;
use File::Basename;
use File::Spec;
use FileHandle;
@ISA = qw(Exporter);
@EXPORT = qw(&testcmp);
$MYPKG = eval { (caller)[0] };
##--------------------------------------------------------------------------
=head1 NAME
testcmp -- compare two files line-by-line
=head1 SYNOPSIS
$is_diff = testcmp($file1, $file2);
cpan/Test-Harness/t/spool.t view on Meta::CPAN
$useOrigOpen = $useOrigClose = 1;
# taken from http://www.perl.com/pub/a/2002/06/11/threads.html?page=2
*CORE::GLOBAL::open = \&my_open;
sub my_open (*@) {
if ($useOrigOpen) {
if ( defined( $_[0] ) ) {
use Symbol qw();
my $handle = Symbol::qualify( $_[0], (caller)[0] );
no strict 'refs';
if ( @_ == 1 ) {
return CORE::open($handle);
}
elsif ( @_ == 2 ) {
return CORE::open( $handle, $_[1] );
}
else {
die "Can't open with more than two args";
}
cpan/Test-Simple/t/Legacy/overload.t view on Meta::CPAN
num => shift,
stringify => 0,
numify => 0,
}, $class;
}
package main;
local $SIG{__DIE__} = sub {
my($call_file, $call_line) = (caller)[1,2];
fail("SIGDIE accidentally called");
diag("From $call_file at $call_line");
};
my $obj = Overloaded->new('foo', 42);
isa_ok $obj, 'Overloaded';
cmp_ok $obj, 'eq', 'foo', 'cmp_ok() eq';
is $obj->{stringify}, 0, ' does not stringify';
is $obj, 'foo', 'is() with string overloading';
cpan/Test-Simple/t/Test2/modules/API/Context.t view on Meta::CPAN
);
ok($ctx != $snap, "snapshot is a new instance");
};
my $end_ctx;
{ # Simulate an END block...
local *END = sub { local *__ANON__ = 'END'; context() };
my $ctx = END();
$frame = [ __PACKAGE__, __FILE__, __LINE__ - 1, 'main::END' ];
# "__LINE__ - 1" on the preceding line forces the value to be an IV
# (even though __LINE__ on its own is a PV), just as (caller)[2] is.
$end_ctx = $ctx->snapshot;
$ctx->release;
}
delete $end_ctx->trace->frame->[4];
is_deeply( $end_ctx->trace->frame, $frame, 'context is ok in an end block');
# Test event generation
{
package My::Formatter;
cpan/autodie/lib/Fatal.pm view on Meta::CPAN
sub unimport {
my $class = shift;
# Calling "no Fatal" must start with ":lexical"
if ($_[0] ne LEXICAL_TAG) {
croak(sprintf(ERROR_NO_LEX,$class));
}
shift @_; # Remove :lexical
my $pkg = (caller)[0];
# If we've been called with arguments, then the developer
# has explicitly stated 'no autodie qw(blah)',
# in which case, we disable Fatalistic behaviour for 'blah'.
my @unimport_these = @_ ? @_ : ':all';
my (%uninstall_subs, %reinstall_subs);
for my $symbol ($class->_translate_import_args(@unimport_these)) {
dist/Exporter/lib/Exporter/Heavy.pm view on Meta::CPAN
}
}
sub heavy_require_version {
my($self, $wanted) = @_;
my $pkg = ref $self || $self;
return ${pkg}->VERSION($wanted);
}
sub heavy_export_tags {
_push_tags((caller)[0], "EXPORT", \@_);
}
sub heavy_export_ok_tags {
_push_tags((caller)[0], "EXPORT_OK", \@_);
}
1;
dist/Exporter/t/Exporter.t view on Meta::CPAN
# Can't use Test::Simple/More, they depend on Exporter.
my $test;
sub ok ($;$) {
my($ok, $name) = @_;
# You have to do it this way or VMS will get confused.
printf "%sok %d%s\n", ($ok ? '' : 'not '), $test,
(defined $name ? " - $name" : '');
printf "# Failed test at line %d\n", (caller)[2] unless $ok;
$test++;
return $ok;
}
BEGIN {
$test = 1;
print "1..34\n";
require Exporter;
dist/Exporter/t/warn.t view on Meta::CPAN
# Can't use Test::Simple/More, they depend on Exporter.
my $test;
sub ok ($;$) {
my($ok, $name) = @_;
# You have to do it this way or VMS will get confused.
printf "%sok %d%s\n", ($ok ? '' : 'not '), $test,
(defined $name ? " - $name" : '');
printf "# Failed test at line %d\n", (caller)[2] unless $ok;
$test++;
return $ok;
}
BEGIN {
$test = 1;
print "1..2\n";
require Exporter;
dist/SelfLoader/lib/SelfLoader.pm view on Meta::CPAN
if ($@) {
$@ =~ s/ at .*\n//;
croak $@;
}
$@ = $save;
defined(&$AUTOLOAD) || die "SelfLoader inconsistency error";
delete $Cache{$AUTOLOAD};
goto &$AUTOLOAD
}
sub load_stubs { shift->_load_stubs((caller)[0]) }
sub _load_stubs {
# $endlines is used by Devel::SelfStubber to capture lines after __END__
my($self, $callpack, $endlines) = @_;
no strict "refs";
my $fh = \*{"${callpack}::DATA"};
use strict;
my $currpack = $callpack;
my($line,$name,@lines, @stubs, $protoype);
dist/Test/lib/Test.pm view on Meta::CPAN
sub plan {
croak "Test::plan(%args): odd number of arguments" if @_ & 1;
croak "Test::plan(): should not be called more than once" if $planned;
local($\, $,); # guard against -l and other things that screw with
# print
_reset_globals();
_read_program( (caller)[1] );
my $max=0;
while (@_) {
my ($k,$v) = splice(@_, 0, 2);
if ($k =~ /^test(s)?$/) { $max = $v; }
elsif ($k eq 'todo' or
$k eq 'failok') { for (@$v) { $todo{$_}=1; }; }
elsif ($k eq 'onfail') {
ref $v eq 'CODE' or croak "Test::plan(onfail => $v): must be CODE";
$ONFAIL = $v;
dist/XSLoader/t/XSLoader.t view on Meta::CPAN
# Break out of the calling subs
goto the_test;
};
eval <<END;
#line 1 $name
package Foo::Bar;
XSLoader::load("Foo::Bar");
END
the_test:
ok $fell_back,
'XSLoader will not load relative paths based on (caller)[1]';
File::Path::rmtree($name);
}
dist/threads-shared/t/av_refs.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..14\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/av_simple.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..47\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/blessed.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..37\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/clone.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..40\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/cond.t view on Meta::CPAN
my $Base = 0;
sub ok {
my ($id, $ok, $name) = @_;
$id += $Base;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..32\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/hv_refs.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..20\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/hv_simple.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..16\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/no_share.t view on Meta::CPAN
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..6\n"); ### Number of tests that will be run ###
};
dist/threads-shared/t/object.t view on Meta::CPAN
my ($ok, $name) = @_;
lock($TEST);
my $id = $TEST++;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
ok(1, 'Loaded');
### Start of Testing ###
{ package Jar;