]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | package CUPS; |
2 | ||
3 | use 5.006; | |
4 | use strict; | |
5 | use warnings; | |
6 | use Carp; | |
7 | ||
8 | require Exporter; | |
9 | require DynaLoader; | |
10 | use AutoLoader; | |
11 | ||
12 | our @ISA = qw(Exporter DynaLoader); | |
13 | ||
14 | # Items to export into callers namespace by default. Note: do not export | |
15 | # names by default without a very good reason. Use EXPORT_OK instead. | |
16 | # Do not simply export all your public functions/methods/constants. | |
17 | ||
18 | # This allows declaration use CUPS ':all'; | |
19 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | |
20 | # will save memory. | |
21 | our %EXPORT_TAGS = ( 'all' => [ qw( | |
22 | CUPS_DATE_ANY | |
23 | CUPS_VERSION | |
24 | HTTP_MAX_BUFFER | |
25 | HTTP_MAX_HOST | |
26 | HTTP_MAX_URI | |
27 | HTTP_MAX_VALUE | |
28 | IPP_MAX_NAME | |
29 | IPP_MAX_VALUES | |
30 | IPP_PORT | |
31 | PPD_MAX_LINE | |
32 | PPD_MAX_NAME | |
33 | PPD_MAX_TEXT | |
34 | PPD_VERSION | |
35 | ) ] ); | |
36 | ||
37 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
38 | ||
39 | our @EXPORT = qw( | |
40 | CUPS_DATE_ANY | |
41 | CUPS_VERSION | |
42 | HTTP_MAX_BUFFER | |
43 | HTTP_MAX_HOST | |
44 | HTTP_MAX_URI | |
45 | HTTP_MAX_VALUE | |
46 | IPP_MAX_NAME | |
47 | IPP_MAX_VALUES | |
48 | IPP_PORT | |
49 | PPD_MAX_LINE | |
50 | PPD_MAX_NAME | |
51 | PPD_MAX_TEXT | |
52 | PPD_VERSION | |
53 | ); | |
54 | our $VERSION = '1.2'; | |
55 | ||
56 | sub AUTOLOAD { | |
57 | # This AUTOLOAD is used to 'autoload' constants from the constant() | |
58 | # XS function. If a constant is not found then control is passed | |
59 | # to the AUTOLOAD in AutoLoader. | |
60 | ||
61 | my $constname; | |
62 | our $AUTOLOAD; | |
63 | ($constname = $AUTOLOAD) =~ s/.*:://; | |
64 | croak "& not defined" if $constname eq 'constant'; | |
65 | my $val = constant($constname, @_ ? $_[0] : 0); | |
66 | if ($! != 0) { | |
67 | if ($! =~ /Invalid/ || $!{EINVAL}) { | |
68 | $AutoLoader::AUTOLOAD = $AUTOLOAD; | |
69 | goto &AutoLoader::AUTOLOAD; | |
70 | } | |
71 | else { | |
72 | croak "Your vendor has not defined CUPS macro $constname"; | |
73 | } | |
74 | } | |
75 | { | |
76 | no strict 'refs'; | |
77 | # Fixed between 5.005_53 and 5.005_61 | |
78 | if ($] >= 5.00561) { | |
79 | *$AUTOLOAD = sub () { $val }; | |
80 | } | |
81 | else { | |
82 | *$AUTOLOAD = sub { $val }; | |
83 | } | |
84 | } | |
85 | goto &$AUTOLOAD; | |
86 | } | |
87 | ||
88 | bootstrap CUPS $VERSION; | |
89 | ||
90 | # Preloaded methods go here. | |
91 | ||
92 | # Autoload methods go after =cut, and are processed by the autosplit program. | |
93 | ||
94 | 1; | |
95 | __END__ | |
96 | # Below is stub documentation for your module. You better edit it! | |
97 | ||
98 | =head1 NAME | |
99 | ||
100 | CUPS - Perl extension for blah blah blah | |
101 | ||
102 | =head1 SYNOPSIS | |
103 | ||
104 | use CUPS; | |
105 | blah blah blah | |
106 | ||
107 | =head1 DESCRIPTION | |
108 | ||
109 | Stub documentation for CUPS, created by h2xs. It looks like the | |
110 | author of the extension was negligent enough to leave the stub | |
111 | unedited. | |
112 | ||
113 | Blah blah blah. | |
114 | ||
115 | =head2 EXPORT | |
116 | ||
117 | None by default. | |
118 | ||
119 | =head2 Exportable constants | |
120 | ||
121 | CUPS_DATE_ANY | |
122 | CUPS_VERSION | |
123 | HTTP_MAX_BUFFER | |
124 | HTTP_MAX_HOST | |
125 | HTTP_MAX_URI | |
126 | HTTP_MAX_VALUE | |
127 | IPP_MAX_NAME | |
128 | IPP_MAX_VALUES | |
129 | IPP_PORT | |
130 | PPD_MAX_LINE | |
131 | PPD_MAX_NAME | |
132 | PPD_MAX_TEXT | |
133 | PPD_VERSION | |
134 | ||
135 | ||
136 | =head1 AUTHOR | |
137 | ||
138 | A. U. Thor, E<lt>a.u.thor@a.galaxy.far.far.awayE<gt> | |
139 | ||
140 | =head1 SEE ALSO | |
141 | ||
142 | L<perl>. | |
143 | ||
144 | =cut |