File: 02simple.t

package info (click to toggle)
libpragmatic-perl 1.7-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 92 kB
  • sloc: perl: 45; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 608 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Emacs, this is -*- perl -*- code.

BEGIN { use Test; plan tests => 4; }

use Test;

# Test 1:
eval join '', <DATA>;
ok (not $@);

# Test 2:
eval { import X qw (-abc); };
ok (not $@);

# Test 3, 4:
eval { import Y qw (-def); };
ok (not $@);
ok ($Y::DEBUG, 1);

# Get rid of "used only once" warning:
do { 1; } if $Y::DEBUG;

__DATA__

package X;

use strict;
use vars qw(@ISA %PRAGMATA);

require Pragmatic;

@ISA = qw(Pragmatic);

%PRAGMATA = (abc => sub { 1; });

1;


package Y;

use strict;
use vars qw ($DEBUG @ISA %PRAGMATA);

$DEBUG = 0;

@ISA = qw(X);

%PRAGMATA = (def => sub { $DEBUG = 1; });

1;