config root man

Current Path : /usr/opt/perl530/man/man3/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/perl530/man/man3/SelfLoader.3

.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SelfLoader 3"
.TH SelfLoader 3 "2019-10-24" "perl v5.30.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
SelfLoader \- load functions only on demand
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\&    package FOOBAR;
\&    use SelfLoader;
\&
\&    ... (initializing code)
\&
\&    _\|_DATA_\|_
\&    sub {....
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module tells its users that functions in the \s-1FOOBAR\s0 package are to be
autoloaded from after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token.  See also
\&\*(L"Autoloading\*(R" in perlsub.
.SS "The _\|_DATA_\|_ token"
.IX Subsection "The __DATA__ token"
The \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token tells the perl compiler that the perl code
for compilation is finished. Everything after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token
is available for reading via the filehandle \s-1FOOBAR::DATA,\s0
where \s-1FOOBAR\s0 is the name of the current package when the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR
token is reached. This works just the same as \f(CW\*(C`_\|_END_\|_\*(C'\fR does in
package 'main', but for other modules data after \f(CW\*(C`_\|_END_\|_\*(C'\fR is not
automatically retrievable, whereas data after \f(CW\*(C`_\|_DATA_\|_\*(C'\fR is.
The \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token is not recognized in versions of perl prior to
5.001m.
.PP
Note that it is possible to have \f(CW\*(C`_\|_DATA_\|_\*(C'\fR tokens in the same package
in multiple files, and that the last \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token in a given
package that is encountered by the compiler is the one accessible
by the filehandle. This also applies to \f(CW\*(C`_\|_END_\|_\*(C'\fR and main, i.e. if
the 'main' program has an \f(CW\*(C`_\|_END_\|_\*(C'\fR, but a module 'require'd (_not_ 'use'd)
by that program has a 'package main;' declaration followed by an '\f(CW\*(C`_\|_DATA_\|_\*(C'\fR',
then the \f(CW\*(C`DATA\*(C'\fR filehandle is set to access the data after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR
in the module, _not_ the data after the \f(CW\*(C`_\|_END_\|_\*(C'\fR token in the 'main'
program, since the compiler encounters the 'require'd file later.
.SS "SelfLoader autoloading"
.IX Subsection "SelfLoader autoloading"
The \fBSelfLoader\fR works by the user placing the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR
token \fIafter\fR perl code which needs to be compiled and
run at 'require' time, but \fIbefore\fR subroutine declarations
that can be loaded in later \- usually because they may never
be called.
.PP
The \fBSelfLoader\fR will read from the \s-1FOOBAR::DATA\s0 filehandle to
load in the data after \f(CW\*(C`_\|_DATA_\|_\*(C'\fR, and load in any subroutine
when it is called. The costs are the one-time parsing of the
data after \f(CW\*(C`_\|_DATA_\|_\*(C'\fR, and a load delay for the _first_
call of any autoloaded function. The benefits (hopefully)
are a speeded up compilation phase, with no need to load
functions which are never used.
.PP
The \fBSelfLoader\fR will stop reading from \f(CW\*(C`_\|_DATA_\|_\*(C'\fR if
it encounters the \f(CW\*(C`_\|_END_\|_\*(C'\fR token \- just as you would expect.
If the \f(CW\*(C`_\|_END_\|_\*(C'\fR token is present, and is followed by the
token \s-1DATA,\s0 then the \fBSelfLoader\fR leaves the \s-1FOOBAR::DATA\s0
filehandle open on the line after that token.
.PP
The \fBSelfLoader\fR exports the \f(CW\*(C`AUTOLOAD\*(C'\fR subroutine to the
package using the \fBSelfLoader\fR, and this loads the called
subroutine when it is first called.
.PP
There is no advantage to putting subroutines which will _always_
be called after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token.
.SS "Autoloading and package lexicals"
.IX Subsection "Autoloading and package lexicals"
A 'my \f(CW$pack_lexical\fR' statement makes the variable \f(CW$pack_lexical\fR
local _only_ to the file up to the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token. Subroutines
declared elsewhere _cannot_ see these types of variables,
just as if you declared subroutines in the package but in another
file, they cannot see these variables.
.PP
So specifically, autoloaded functions cannot see package
lexicals (this applies to both the \fBSelfLoader\fR and the Autoloader).
The \f(CW\*(C`vars\*(C'\fR pragma provides an alternative to defining package-level
globals that will be visible to autoloaded routines. See the documentation
on \fBvars\fR in the pragma section of perlmod.
.SS "SelfLoader and AutoLoader"
.IX Subsection "SelfLoader and AutoLoader"
The \fBSelfLoader\fR can replace the AutoLoader \- just change 'use AutoLoader'
to 'use SelfLoader' (though note that the \fBSelfLoader\fR exports
the \s-1AUTOLOAD\s0 function \- but if you have your own \s-1AUTOLOAD\s0 and
are using the AutoLoader too, you probably know what you're doing),
and the \f(CW\*(C`_\|_END_\|_\*(C'\fR token to \f(CW\*(C`_\|_DATA_\|_\*(C'\fR. You will need perl version 5.001m
or later to use this (version 5.001 with all patches up to patch m).
.PP
There is no need to inherit from the \fBSelfLoader\fR.
.PP
The \fBSelfLoader\fR works similarly to the AutoLoader, but picks up the
subs from after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR instead of in the 'lib/auto' directory.
There is a maintenance gain in not needing to run AutoSplit on the module
at installation, and a runtime gain in not needing to keep opening and
closing files to load subs. There is a runtime loss in needing
to parse the code after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR. Details of the \fBAutoLoader\fR and
another view of these distinctions can be found in that module's
documentation.
.SS "_\|_DATA_\|_, _\|_END_\|_, and the \s-1FOOBAR::DATA\s0 filehandle."
.IX Subsection "__DATA__, __END__, and the FOOBAR::DATA filehandle."
This section is only relevant if you want to use
the \f(CW\*(C`FOOBAR::DATA\*(C'\fR together with the \fBSelfLoader\fR.
.PP
Data after the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token in a module is read using the
\&\s-1FOOBAR::DATA\s0 filehandle. \f(CW\*(C`_\|_END_\|_\*(C'\fR can still be used to denote the end
of the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR section if followed by the token \s-1DATA\s0 \- this is supported
by the \fBSelfLoader\fR. The \f(CW\*(C`FOOBAR::DATA\*(C'\fR filehandle is left open if an
\&\f(CW\*(C`_\|_END_\|_\*(C'\fR followed by a \s-1DATA\s0 is found, with the filehandle positioned at
the start of the line after the \f(CW\*(C`_\|_END_\|_\*(C'\fR token. If no \f(CW\*(C`_\|_END_\|_\*(C'\fR token is
present, or an \f(CW\*(C`_\|_END_\|_\*(C'\fR token with no \s-1DATA\s0 token on the same line, then
the filehandle is closed.
.PP
The \fBSelfLoader\fR reads from wherever the current
position of the \f(CW\*(C`FOOBAR::DATA\*(C'\fR filehandle is, until the
\&\s-1EOF\s0 or \f(CW\*(C`_\|_END_\|_\*(C'\fR. This means that if you want to use
that filehandle (and \s-1ONLY\s0 if you want to), you should either
.PP
1. Put all your subroutine declarations immediately after
the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token and put your own data after those
declarations, using the \f(CW\*(C`_\|_END_\|_\*(C'\fR token to mark the end
of subroutine declarations. You must also ensure that the \fBSelfLoader\fR
reads first by  calling 'SelfLoader\->\fBload_stubs()\fR;', or by using a
function which is selfloaded;
.PP
or
.PP
2. You should read the \f(CW\*(C`FOOBAR::DATA\*(C'\fR filehandle first, leaving
the handle open and positioned at the first line of subroutine
declarations.
.PP
You could conceivably do both.
.SS "Classes and inherited methods."
.IX Subsection "Classes and inherited methods."
For modules which are not classes, this section is not relevant.
This section is only relevant if you have methods which could
be inherited.
.PP
A subroutine stub (or forward declaration) looks like
.PP
.Vb 1
\&  sub stub;
.Ve
.PP
i.e. it is a subroutine declaration without the body of the
subroutine. For modules which are not classes, there is no real
need for stubs as far as autoloading is concerned.
.PP
For modules which \s-1ARE\s0 classes, and need to handle inherited methods,
stubs are needed to ensure that the method inheritance mechanism works
properly. You can load the stubs into the module at 'require' time, by
adding the statement 'SelfLoader\->\fBload_stubs()\fR;' to the module to do
this.
.PP
The alternative is to put the stubs in before the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR token \s-1BEFORE\s0
releasing the module, and for this purpose the \f(CW\*(C`Devel::SelfStubber\*(C'\fR
module is available.  However this does require the extra step of ensuring
that the stubs are in the module. If this is done I strongly recommend
that this is done \s-1BEFORE\s0 releasing the module \- it should \s-1NOT\s0 be done
at install time in general.
.SH "Multiple packages and fully qualified subroutine names"
.IX Header "Multiple packages and fully qualified subroutine names"
Subroutines in multiple packages within the same file are supported \- but you
should note that this requires exporting the \f(CW\*(C`SelfLoader::AUTOLOAD\*(C'\fR to
every package which requires it. This is done automatically by the
\&\fBSelfLoader\fR when it first loads the subs into the cache, but you should
really specify it in the initialization before the \f(CW\*(C`_\|_DATA_\|_\*(C'\fR by putting
a 'use SelfLoader' statement in each package.
.PP
Fully qualified subroutine names are also supported. For example,
.PP
.Vb 4
\&   _\|_DATA_\|_
\&   sub foo::bar {23}
\&   package baz;
\&   sub dob {32}
.Ve
.PP
will all be loaded correctly by the \fBSelfLoader\fR, and the \fBSelfLoader\fR
will ensure that the packages 'foo' and 'baz' correctly have the
\&\fBSelfLoader\fR \f(CW\*(C`AUTOLOAD\*(C'\fR method when the data after \f(CW\*(C`_\|_DATA_\|_\*(C'\fR is first
parsed.
.SH "AUTHOR"
.IX Header "AUTHOR"
\&\f(CW\*(C`SelfLoader\*(C'\fR is maintained by the perl5\-porters. Please direct
any questions to the canonical mailing list. Anything that
is applicable to the \s-1CPAN\s0 release can be sent to its maintainer,
though.
.PP
Author and Maintainer: The Perl5\-Porters <perl5\-porters@perl.org>
.PP
Maintainer of the \s-1CPAN\s0 release: Steffen Mueller <smueller@cpan.org>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This package has been part of the perl core since the first release
of perl5. It has been released separately to \s-1CPAN\s0 so older installations
can benefit from bug fixes.
.PP
This package has the same copyright and license as the perl core:
.PP
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006 by Larry Wall and others
.PP
All rights reserved.
.PP
This program is free software; you can redistribute it and/or modify
it under the terms of either:
.IP "a)" 4
.IX Item "a)"
the \s-1GNU\s0 General Public License as published by the Free Software Foundation;
either version 1, or (at your option) any later version, or
.IP "b)" 4
.IX Item "b)"
the \*(L"Artistic License\*(R" which comes with this Kit.
.PP
This program is distributed in the hope that it will be useful,
but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of
\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0  See either
the \s-1GNU\s0 General Public License or the Artistic License for more details.
.PP
You should have received a copy of the Artistic License with this
Kit, in the file named \*(L"Artistic\*(R".  If not, I'll be glad to provide one.
.PP
You should also have received a copy of the \s-1GNU\s0 General Public License
along with this program in the file named \*(L"Copying\*(R". If not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
\&\s-1MA 02110\-1301, USA\s0 or visit their web page on the internet at
http://www.gnu.org/copyleft/gpl.html.
.PP
For those of you that choose to use the \s-1GNU\s0 General Public License,
my interpretation of the \s-1GNU\s0 General Public License is that no Perl
script falls under the terms of the \s-1GPL\s0 unless you explicitly put
said script under the terms of the \s-1GPL\s0 yourself.  Furthermore, any
object code linked with perl does not automatically fall under the
terms of the \s-1GPL,\s0 provided such object code only adds definitions
of subroutines and variables, and does not otherwise impair the
resulting interpreter from executing any standard Perl script.  I
consider linking in C subroutines in this manner to be the moral
equivalent of defining subroutines in the Perl language itself.  You
may sell such an object file as proprietary provided that you provide
or offer to provide the Perl source, as specified by the \s-1GNU\s0 General
Public License.  (This is merely an alternate way of specifying input
to the program.)  You may also sell a binary produced by the dumping of
a running Perl script that belongs to you, provided that you provide or
offer to provide the Perl source as specified by the \s-1GPL.\s0  (The
fact that a Perl interpreter and your code are in the same binary file
is, in this case, a form of mere aggregation.)  This is my interpretation
of the \s-1GPL.\s0  If you still have concerns or difficulties understanding
my intent, feel free to contact me.  Of course, the Artistic License
spells all this out for your protection, so you may prefer to use that.

Man Man