Commit | Line | Data |
8565c31a |
1 | ################################################################################ |
2 | ## |
bfc37ff7 |
3 | ## $Revision: 4 $ |
8565c31a |
4 | ## $Author: mhx $ |
bfc37ff7 |
5 | ## $Date: 2010/03/07 13:15:44 +0100 $ |
8565c31a |
6 | ## |
7 | ################################################################################ |
8 | ## |
bfc37ff7 |
9 | ## Version 3.x, Copyright (C) 2004-2010, Marcus Holland-Moritz. |
8565c31a |
10 | ## Version 2.x, Copyright (C) 2001, Paul Marquess. |
11 | ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski. |
12 | ## |
13 | ## This program is free software; you can redistribute it and/or |
14 | ## modify it under the same terms as Perl itself. |
15 | ## |
16 | ################################################################################ |
17 | |
18 | =provides |
19 | |
20 | __UNDEFINED__ |
21 | |
22 | =implementation |
23 | |
24 | __UNDEFINED__ GvSVn(gv) GvSV(gv) |
25 | __UNDEFINED__ isGV_with_GP(gv) isGV(gv) |
bfc37ff7 |
26 | __UNDEFINED__ gv_fetchpvn_flags(name, len, flags, svt) gv_fetchpv(name, flags, svt) |
27 | __UNDEFINED__ gv_fetchsv(name, flags, svt) gv_fetchpv(SvPV_nolen_const(name), flags, svt) |
28 | |
29 | __UNDEFINED__ get_cvn_flags(name, namelen, flags) get_cv(name, flags) |
8565c31a |
30 | |
31 | =xsubs |
32 | |
33 | int |
34 | GvSVn() |
35 | PREINIT: |
36 | GV* gv; |
37 | CODE: |
38 | RETVAL = 0; |
39 | gv = gv_fetchpvs("Devel::PPPort::GvTest", GV_ADDMULTI, SVt_PVGV); |
40 | if (GvSVn(gv) != NULL) |
41 | { |
42 | RETVAL++; |
43 | } |
44 | OUTPUT: |
45 | RETVAL |
46 | |
47 | int |
48 | isGV_with_GP() |
49 | PREINIT: |
50 | GV* gv; |
51 | CODE: |
52 | RETVAL = 0; |
53 | gv = gv_fetchpvs("Devel::PPPort::GvTest", GV_ADDMULTI, SVt_PVGV); |
54 | if (isGV_with_GP(gv)) |
55 | { |
56 | RETVAL++; |
57 | } |
58 | if (!isGV(&PL_sv_undef)) |
59 | { |
60 | RETVAL++; |
61 | } |
62 | OUTPUT: |
63 | RETVAL |
64 | |
bfc37ff7 |
65 | int |
66 | get_cvn_flags() |
67 | PREINIT: |
68 | CV* xv; |
69 | CODE: |
70 | RETVAL = 0; |
71 | xv = get_cvn_flags("Devel::PPPort::foobar", sizeof("Devel::PPPort::foobar")-1, 0); |
72 | if(xv == NULL) RETVAL++; |
73 | xv = get_cvn_flags("Devel::PPPort::foobar", sizeof("Devel::PPPort::foobar")-1, GV_ADDMULTI); |
74 | if(xv && SvTYPE(xv) == SVt_PVCV) RETVAL++; |
75 | xv = get_cvn_flags("Devel::PPPort::get_cvn_flags", sizeof("Devel::PPPort::get_cvn_flags")-1, 0); |
76 | if(xv && SvTYPE(xv) == SVt_PVCV) RETVAL++; |
77 | OUTPUT: |
78 | RETVAL |
79 | |
80 | SV* |
81 | gv_fetchpvn_flags() |
82 | CODE: |
83 | RETVAL = newRV_inc((SV*)gv_fetchpvn_flags("Devel::PPPort::VERSION", sizeof("Devel::PPPort::VERSION")-1, 0, SVt_PV)); |
84 | OUTPUT: |
85 | RETVAL |
86 | |
87 | SV* |
88 | gv_fetchsv(name) |
89 | SV *name |
90 | CODE: |
91 | RETVAL = newRV_inc((SV*)gv_fetchsv(name, 0, SVt_PV)); |
92 | OUTPUT: |
93 | RETVAL |
8565c31a |
94 | |
bfc37ff7 |
95 | =tests plan => 5 |
8565c31a |
96 | |
97 | ok(Devel::PPPort::GvSVn(), 1); |
98 | |
bfc37ff7 |
99 | ok(Devel::PPPort::isGV_with_GP(), 2); |
100 | |
101 | ok(Devel::PPPort::get_cvn_flags(), 3); |
102 | |
103 | ok(Devel::PPPort::gv_fetchpvn_flags(), \*Devel::PPPort::VERSION); |
104 | |
105 | ok(Devel::PPPort::gv_fetchsv("Devel::PPPort::VERSION"), \*Devel::PPPort::VERSION); |