Alien-Selenium

 view release on metacpan or  search on metacpan

inc/Locale/Maketext/Simple.pm  view on Meta::CPAN

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    $args{Class}    ||= caller;
    $args{Style}    ||= 'maketext';
    $args{Export}   ||= 'loc';
    $args{Subclass} ||= 'I18N';
 
    my ($loc, $loc_lang) = $class->load_loc(%args);
    $loc ||= $class->default_loc(%args);
 
    no strict 'refs';
    *{caller(0) . "::$args{Export}"} = $loc if $args{Export};
    *{caller(0) . "::$args{Export}_lang"} = $loc_lang || sub { 1 };
}
 
my %Loc;
 
sub reload_loc { %Loc = () }
 
sub load_loc {
    my ($class, %args) = @_;
 
    my $pkg = join('::', $args{Class}, $args{Subclass});

inc/Module/Load.pm  view on Meta::CPAN

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    ### because of [perl #19213], see caveats ###
    my $file = $^O eq 'MSWin32'
                    ? join "/", @parts
                    : File::Spec->catfile( @parts );
 
    $file   .= '.pm' if $pm;
 
    return $file;
}
 
sub _who { (caller(1))[0] }
 
sub _is_file {
    local $_ = shift;
    return  /^\./               ? 1 :
            /[^\w:']/           ? 1 :
            undef
    #' silly bbedit..
}

inc/My/Tests/Below.pm  view on Meta::CPAN

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
=head1 NAME
 
B<My::Tests::Below> - invoke a test suite at the end of a module.
 
=head1 SYNOPSIS
 
 package MyPackage;
 
 <the text of the package goes here>
 
 require My::Tests::Below unless caller();
 
 1;
 
 __END__
 
 use MyPackage;
 
 
 # And there you go with your test suite

inc/My/Tests/Below.pm  view on Meta::CPAN

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 
use strict;
use File::Temp ();
 
our $VERSION = 2.0;
 
## This is done at the top level, not in a sub, as "require
## My::Tests::Below" is what gets the ball rolling:
our $singleton = __PACKAGE__->_parse(\*main::DATA, caller(0));
unless (defined $singleton) {
    die "My::Tests::Below invoked, but no tests were found below!";
}
close(main::DATA);
$singleton->run();
 
## Creates an instance of My::Tests::Below from a source file
## that has tests at the bottom.
sub _parse {
    my ($class, $fd, $package, $packfilename, $packline) = @_;

inc/My/Tests/Below.pm  view on Meta::CPAN

515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
package Fake::Module;
use strict;
 
our @EXPORT = qw(zoinx);
 
sub zoinx {1}
 
 
require My::Tests::Below unless (caller());
 
1;
 
__END__
 
use Fake::Module;
 
print "1..2\n";
if (__PACKAGE__ eq "main") {
   print "ok 1 # In package 'main' for tests\n";

inc/My/Tests/Below.pm  view on Meta::CPAN

550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
like($result, qr/ok 2/, "Test result #2");
 
write_file($fakemodule, <<'BUGGY_MODULE_WITH_TEST_MORE');
#!perl -Tw
 
package Fake::Module;
use strict;
 
1;
 
require My::Tests::Below unless (caller());
 
__END__
 
use Test::More no_plan => 1;
 
ok(1);
die;
BUGGY_MODULE_WITH_TEST_MORE
 
$result = run_perl($fakemodule);

inc/Params/Check.pm  view on Meta::CPAN

327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
### check if the key exists in $data ###
sub _iskey {
    my ($key, $tmpl) = @_;
    return $tmpl->{$key} ? 1 : undef;
}
 
sub _who_was_it {
    my $level = shift || 0;
 
    return (caller(2 + $level))[3] || 'ANON'
}
 
sub _safe_eq {
    my($a, $b) = @_;
 
    if ( defined($a) && defined($b) ) {
        return $a eq $b;
    }
    else {
        return defined($a) eq defined($b);



( run in 0.387 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )