1 ################################################################################
5 ## $Date: 2010/03/07 13:15:45 +0100 $
7 ################################################################################
9 ## Version 3.x, Copyright (C) 2004-2010, Marcus Holland-Moritz.
10 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
11 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
13 ## This program is free software; you can redistribute it and/or
14 ## modify it under the same terms as Perl itself.
16 ################################################################################
28 __UNDEFINED__ WARN_ALL 0
29 __UNDEFINED__ WARN_CLOSURE 1
30 __UNDEFINED__ WARN_DEPRECATED 2
31 __UNDEFINED__ WARN_EXITING 3
32 __UNDEFINED__ WARN_GLOB 4
33 __UNDEFINED__ WARN_IO 5
34 __UNDEFINED__ WARN_CLOSED 6
35 __UNDEFINED__ WARN_EXEC 7
36 __UNDEFINED__ WARN_LAYER 8
37 __UNDEFINED__ WARN_NEWLINE 9
38 __UNDEFINED__ WARN_PIPE 10
39 __UNDEFINED__ WARN_UNOPENED 11
40 __UNDEFINED__ WARN_MISC 12
41 __UNDEFINED__ WARN_NUMERIC 13
42 __UNDEFINED__ WARN_ONCE 14
43 __UNDEFINED__ WARN_OVERFLOW 15
44 __UNDEFINED__ WARN_PACK 16
45 __UNDEFINED__ WARN_PORTABLE 17
46 __UNDEFINED__ WARN_RECURSION 18
47 __UNDEFINED__ WARN_REDEFINE 19
48 __UNDEFINED__ WARN_REGEXP 20
49 __UNDEFINED__ WARN_SEVERE 21
50 __UNDEFINED__ WARN_DEBUGGING 22
51 __UNDEFINED__ WARN_INPLACE 23
52 __UNDEFINED__ WARN_INTERNAL 24
53 __UNDEFINED__ WARN_MALLOC 25
54 __UNDEFINED__ WARN_SIGNAL 26
55 __UNDEFINED__ WARN_SUBSTR 27
56 __UNDEFINED__ WARN_SYNTAX 28
57 __UNDEFINED__ WARN_AMBIGUOUS 29
58 __UNDEFINED__ WARN_BAREWORD 30
59 __UNDEFINED__ WARN_DIGIT 31
60 __UNDEFINED__ WARN_PARENTHESIS 32
61 __UNDEFINED__ WARN_PRECEDENCE 33
62 __UNDEFINED__ WARN_PRINTF 34
63 __UNDEFINED__ WARN_PROTOTYPE 35
64 __UNDEFINED__ WARN_QW 36
65 __UNDEFINED__ WARN_RESERVED 37
66 __UNDEFINED__ WARN_SEMICOLON 38
67 __UNDEFINED__ WARN_TAINT 39
68 __UNDEFINED__ WARN_THREADS 40
69 __UNDEFINED__ WARN_UNINITIALIZED 41
70 __UNDEFINED__ WARN_UNPACK 42
71 __UNDEFINED__ WARN_UNTIE 43
72 __UNDEFINED__ WARN_UTF8 44
73 __UNDEFINED__ WARN_VOID 45
74 __UNDEFINED__ WARN_ASSERTIONS 46
76 __UNDEFINED__ packWARN(a) (a)
80 # define ckWARN(a) (PL_dowarn & G_WARN_ON)
82 # define ckWARN(a) PL_dowarn
86 #if { VERSION >= 5.004 } && !defined(warner)
90 warner(U32 err, const char *pat, ...)
98 sv = vnewSVpvf(pat, &args);
101 warn("%s", SvPV_nolen(sv));
104 #define warner Perl_warner
106 #define Perl_warner_nocontext Perl_warner
120 #if { VERSION >= 5.004 }
121 warner(packWARN(WARN_MISC), "warner %s:%d", "bar", 42);
127 #if { VERSION >= 5.004 }
128 Perl_warner(aTHX_ packWARN(WARN_MISC), "Perl_warner %s:%d", "bar", 42);
132 Perl_warner_nocontext()
134 #if { VERSION >= 5.004 }
135 Perl_warner_nocontext(packWARN(WARN_MISC), "Perl_warner_nocontext %s:%d", "bar", 42);
141 #if { VERSION >= 5.004 }
142 if (ckWARN(WARN_MISC))
143 Perl_warner_nocontext(packWARN(WARN_MISC), "ckWARN %s:%d", "bar", 42);
152 $SIG{'__WARN__'} = sub { $warning = $_[0] };
155 Devel::PPPort::warner();
156 ok($] >= 5.004 ? $warning =~ /^warner bar:42/ : $warning eq '');
159 Devel::PPPort::Perl_warner();
160 ok($] >= 5.004 ? $warning =~ /^Perl_warner bar:42/ : $warning eq '');
163 Devel::PPPort::Perl_warner_nocontext();
164 ok($] >= 5.004 ? $warning =~ /^Perl_warner_nocontext bar:42/ : $warning eq '');
167 Devel::PPPort::ckWARN();
173 Devel::PPPort::ckWARN();
174 ok($] >= 5.004 ? $warning =~ /^ckWARN bar:42/ : $warning eq '');