Lines Matching refs:the

13 # (we use 'our' rather than 'my' here, due to the rather complex and buggy
103 # Devel::SelfStubber would like us to capture the lines after
104 # __END__ so it can write out the entire file
148 This module tells its users that functions in the FOOBAR package are to be
149 autoloaded from after the C<__DATA__> token. See also
154 The C<__DATA__> token tells the perl compiler that the perl code
155 for compilation is finished. Everything after the C<__DATA__> token
156 is available for reading via the filehandle FOOBAR::DATA,
157 where FOOBAR is the name of the current package when the C<__DATA__>
158 token is reached. This works just the same as C<__END__> does in
164 Note that it is possible to have C<__DATA__> tokens in the same package
165 in multiple files, and that the last C<__DATA__> token in a given
166 package that is encountered by the compiler is the one accessible
167 by the filehandle. This also applies to C<__END__> and main, i.e. if
168 the 'main' program has an C<__END__>, but a module 'require'd (_not_ 'use'd)
170 then the C<DATA> filehandle is set to access the data after the C<__DATA__>
171 in the module, _not_ the data after the C<__END__> token in the 'main'
172 program, since the compiler encounters the 'require'd file later.
176 The B<SelfLoader> works by the user placing the C<__DATA__>
182 The B<SelfLoader> will read from the FOOBAR::DATA filehandle to
183 load in the data after C<__DATA__>, and load in any subroutine
184 when it is called. The costs are the one-time parsing of the
185 data after C<__DATA__>, and a load delay for the _first_
191 it encounters the C<__END__> token - just as you would expect.
192 If the C<__END__> token is present, and is followed by the
193 token DATA, then the B<SelfLoader> leaves the FOOBAR::DATA
194 filehandle open on the line after that token.
196 The B<SelfLoader> exports the C<AUTOLOAD> subroutine to the
197 package using the B<SelfLoader>, and this loads the called
201 be called after the C<__DATA__> token.
205 A 'my $pack_lexical' statement makes the variable $pack_lexical
206 local _only_ to the file up to the C<__DATA__> token. Subroutines
208 just as if you declared subroutines in the package but in another
212 lexicals (this applies to both the B<SelfLoader> and the Autoloader).
214 globals that will be visible to autoloaded routines. See the documentation
215 on B<vars> in the pragma section of L<perlmod>.
219 The B<SelfLoader> can replace the AutoLoader - just change 'use AutoLoader'
220 to 'use SelfLoader' (though note that the B<SelfLoader> exports
221 the AUTOLOAD function - but if you have your own AUTOLOAD and
222 are using the AutoLoader too, you probably know what you're doing),
223 and the C<__END__> token to C<__DATA__>. You will need perl version 5.001m
226 There is no need to inherit from the B<SelfLoader>.
228 The B<SelfLoader> works similarly to the AutoLoader, but picks up the
229 subs from after the C<__DATA__> instead of in the 'lib/auto' directory.
230 There is a maintenance gain in not needing to run AutoSplit on the module
233 to parse the code after the C<__DATA__>. Details of the B<AutoLoader> and
237 =head2 __DATA__, __END__, and the FOOBAR::DATA filehandle.
240 the C<FOOBAR::DATA> together with the B<SelfLoader>.
242 Data after the C<__DATA__> token in a module is read using the
243 FOOBAR::DATA filehandle. C<__END__> can still be used to denote the end
244 of the C<__DATA__> section if followed by the token DATA - this is supported
245 by the B<SelfLoader>. The C<FOOBAR::DATA> filehandle is left open if an
246 C<__END__> followed by a DATA is found, with the filehandle positioned at
247 the start of the line after the C<__END__> token. If no C<__END__> token is
248 present, or an C<__END__> token with no DATA token on the same line, then
249 the filehandle is closed.
251 The B<SelfLoader> reads from wherever the current
252 position of the C<FOOBAR::DATA> filehandle is, until the
257 the C<__DATA__> token and put your own data after those
258 declarations, using the C<__END__> token to mark the end
259 of subroutine declarations. You must also ensure that the B<SelfLoader>
265 2. You should read the C<FOOBAR::DATA> filehandle first, leaving
266 the handle open and positioned at the first line of subroutine
281 i.e. it is a subroutine declaration without the body of the
286 stubs are needed to ensure that the method inheritance mechanism works
287 properly. You can load the stubs into the module at 'require' time, by
288 adding the statement 'SelfLoader-E<gt>load_stubs();' to the module to do
291 The alternative is to put the stubs in before the C<__DATA__> token BEFORE
292 releasing the module, and for this purpose the C<Devel::SelfStubber>
293 module is available. However this does require the extra step of ensuring
294 that the stubs are in the module. If this is done I strongly recommend
295 that this is done BEFORE releasing the module - it should NOT be done
300 Subroutines in multiple packages within the same file are supported - but you
301 should note that this requires exporting the C<SelfLoader::AUTOLOAD> to
302 every package which requires it. This is done automatically by the
303 B<SelfLoader> when it first loads the subs into the cache, but you should
304 really specify it in the initialization before the C<__DATA__> by putting
314 will all be loaded correctly by the B<SelfLoader>, and the B<SelfLoader>
315 will ensure that the packages 'foo' and 'baz' correctly have the
316 B<SelfLoader> C<AUTOLOAD> method when the data after C<__DATA__> is first