FACTOID # 116: More than a third of the world's airports are in the United States of America.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Perl module

A Perl module is a discrete component of software for the Perl programming language. A module is distinguished by a unique namespace, e.g. "CGI" or "Net::FTP" or "XML::Parser". By conventions, there is typically one module per file with a .pm extension. A collection of one or more modules, with accompanying documentation and build scripts, compose a package. The Perl community has a sizable library of packages available for search and download via CPAN.


It is common for Perl modules to have embedded documentation in Perl's Plain Old Documentation format. Many modules favor an object-oriented style, but many are procedural instead, especially old modules.


Below is an example of a very simple object-oriented Perl module and a short program which makes use of the module. It is implemented in a dialect of Perl5 which is compatible with Perl 5.6.0 and higher.


helloworld.pl


 #!/usr/bin/perl -w use Hello::World; my $hello = Hello::World->new(); $hello->print(); 

Hello/World.pm


 # The 'package' command gives the name of the module or class. package Hello::World; use strict; use warnings; # By convention, a module's version number is stored in # $ModuleName::VERSION; certain forms of the "use" built-in depend # on this variable being defined. our $VERSION = "1.0"; # Lines starting with an equal sign indicate embedded POD # documentation. POD sections end with an =cut directive, and can # be intermixed almost freely with normal code. =head1 NAME Hello::World - An encapsulation of a commonly output message =head1 SYNOPSIS use Hello::World; my $hw = new Hello::World(); $hw->print(); =head1 DESCRIPTION This is an object-oriented library which can print the famous "H.W." message. =head1 METHODS =over =item new Instantiates an object which holds a greeting message. =cut sub new { my $pkg = shift; my $self = bless({ message => "Hello, world!", }, $pkg); return $self; } =item to_string Returns the greeting as a string =cut sub to_string { my $self = shift; return $self->{message}; } =item print Outputs the greeting to STDOUT =cut sub print { my $self = shift; print $self->toString(),"\n"; } =back =head1 AUTHOR Joe Hacker <joe@joehacker.org> =cut # The lone "1;" at the end of the file indicates that the module # has been successfully initialized. Some modules contain code # that runs as soon as the module is compiled, before the program # that included it is finished compiling; they can arrange to return # a non-true value if something goes wrong. 1; 


  Results from FactBites:
 
Perl - Wikipedia, the free encyclopedia (5007 words)
Perl is widely used in finance and bioinformatics, where it is valued for rapid application development, ability to handle large data sets, and the availability of many standard and 3rd-party modules.
Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. The source distribution is, as of 2005, 12 MB when packaged in a tar file and compressed.
Perl developers rely on the functional tests to ensure that changes to the interpreter do not introduce bugs; conversely, Perl users who see the interpreter pass its functional tests on their system can have a high degree of confidence that it is working properly.
Perl/Tk Tutorial - Create GUI with Perl's Tk Module (794 words)
Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.
Perl finds many applications as a glue language, tying together systems and interfaces that were not specifically designed to interoperate.
Perl is free software, and may be distributed under either the Artistic or the GPL License.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.