Content deleted Content added
let's just suppose that a collection contains several items |
m re-link "namespace" |
||
Line 1:
A '''Perl module''' is a discrete component of software for the [[Perl]] programming language. Technically, it is a particular set of conventions for using Perl's [[#Perl packages and namespaces|package]] mechanism that has become universally adopted.{{discuss|Packages and modules}}
A module defines its source code to be in a '''[[package]]''', the Perl mechanism for defining [[
A collection of modules, with accompanying documentation, build scripts, and usually a test suite, compose a '''distribution'''. The Perl community has a sizable library of distributions available for search and download via [[CPAN]].
Line 270:
==Perl packages and namespaces==
A running Perl program has a built-in [[Namespace (computer science)|namespace]] called "<code>main</code>", which is the default name. For example a subroutine called <code>Sub1</code> can be called as <code>Sub1()</code> or <code>main::Sub1()</code>. With a variable the appropriate sigil is placed in front of the namespace; so a scalar variable called <code>$var1</code> can also be referred to as <code>$main::var1</code>, or even <code>$::var1</code>. Other namespaces can be created at any time.
<source lang="perl">
package Namespace1;
|