.\" Automatically generated by Pod::Man 4.10 (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 .\" ======================================================================== .\" .IX Title "PPI::Statement::Include 3pm" .TH PPI::Statement::Include 3pm "2019-07-21" "perl v5.28.1" "User Contributed Perl Documentation" .\" 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" PPI::Statement::Include \- Statements that include other code .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 9 \& # The following are all includes \& use 5.006; \& use strict; \& use My::Module; \& use constant FOO => \*(AqFoo\*(Aq; \& require Foo::Bar; \& require "Foo/Bar.pm"; \& require $foo if 1; \& no strict \*(Aqrefs\*(Aq; .Ve .SH "INHERITANCE" .IX Header "INHERITANCE" .Vb 4 \& PPI::Statement::Include \& isa PPI::Statement \& isa PPI::Node \& isa PPI::Element .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Despite its name, the \f(CW\*(C`PPI::Statement::Include\*(C'\fR class covers a number of different types of statement that cover all statements starting with \&\f(CW\*(C`use\*(C'\fR, \f(CW\*(C`no\*(C'\fR and \f(CW\*(C`require\*(C'\fR. .PP But basically, they cover three situations. .PP Firstly, a dependency on a particular version of perl (for which the \&\f(CW\*(C`version\*(C'\fR method returns true), a pragma (for which the \f(CW\*(C`pragma\*(C'\fR method returns true), or the loading (and unloading via no) of modules. .SH "METHODS" .IX Header "METHODS" \&\f(CW\*(C`PPI::Statement::Include\*(C'\fR has a number of methods in addition to the standard PPI::Statement, PPI::Node and PPI::Element methods. .SS "type" .IX Subsection "type" The \f(CW\*(C`type\*(C'\fR method returns the general type of statement (\f(CW\*(Aquse\*(Aq\fR, \f(CW\*(Aqno\*(Aq\fR or \f(CW\*(Aqrequire\*(Aq\fR). .PP Returns the type as a string, or \f(CW\*(C`undef\*(C'\fR if the type cannot be detected. .SS "module" .IX Subsection "module" The \f(CW\*(C`module\*(C'\fR method returns the module name specified in any include statement. This \f(CW\*(C`includes\*(C'\fR pragma names, because pragma are implemented as modules. (And lets face it, the definition of a pragma can be fuzzy at the best of times in any case) .PP This covers all of these... .PP .Vb 4 \& use strict; \& use My::Module; \& no strict; \& require My::Module; .Ve .PP \&...but does not cover any of these... .PP .Vb 3 \& use 5.006; \& require 5.005; \& require "explicit/file/name.pl"; .Ve .PP Returns the module name as a string, or \f(CW\*(C`undef\*(C'\fR if the include does not specify a module name. .SS "module_version" .IX Subsection "module_version" The \f(CW\*(C`module_version\*(C'\fR method returns the minimum version of the module required by the statement, if there is one. .SS "pragma" .IX Subsection "pragma" The \f(CW\*(C`pragma\*(C'\fR method checks for an include statement's use as a pragma, and returns it if so. .PP Or at least, it claims to. In practice it's a lot harder to say exactly what is or isn't a pragma, because the definition is fuzzy. .PP The \f(CW\*(C`intent\*(C'\fR of a pragma is to modify the way in which the parser works. This is done though the use of modules that do various types of internals magic. .PP For now, \s-1PPI\s0 assumes that any \*(L"module name\*(R" that is only a set of lowercase letters (and perhaps numbers, like \f(CW\*(C`use utf8;\*(C'\fR). This behaviour is expected to change, most likely to something that knows the specific names of the various \*(L"pragmas\*(R". .PP Returns the name of the pragma, or false ('') if the include is not a pragma. .SS "version" .IX Subsection "version" The \f(CW\*(C`version\*(C'\fR method checks for an include statement that introduces a dependency on the version of \f(CW\*(C`perl\*(C'\fR the code is compatible with. .PP This covers two specific statements. .PP .Vb 2 \& use 5.006; \& require 5.006; .Ve .PP Currently the version is returned as a string, although in future the version may be returned as a version object. If you want a numeric representation, use \f(CW\*(C`version_literal()\*(C'\fR. Returns false if the statement is not a version dependency. .SS "version_literal" .IX Subsection "version_literal" The \f(CW\*(C`version_literal\*(C'\fR method has the same behavior as \f(CW\*(C`version()\*(C'\fR, but the version is returned as a numeric literal. Returns false if the statement is not a version dependency. .SS "arguments" .IX Subsection "arguments" The \f(CW\*(C`arguments\*(C'\fR method gives you the rest of the statement after the module/pragma and module version, i.e. the stuff that will be used to construct what gets passed to the module's \f(CW\*(C`import()\*(C'\fR subroutine. This does include the comma, etc. operators, but doesn't include non-significant direct children or any final semicolon. .SH "TO DO" .IX Header "TO DO" \&\- Write specific unit tests for this package .SH "SUPPORT" .IX Header "SUPPORT" See the support section in the main module. .SH "AUTHOR" .IX Header "AUTHOR" Adam Kennedy .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2001 \- 2011 Adam Kennedy. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module.