A package is a wonderful object. It can be an actual physical object in which things are placed, or it can be a metaphorical object exisiting only in the mind or on a computer. Physical packages include boxes, bags, and envelopes; metaphorical packages include things like zip files, RPMs, Unix tape archives, and many methods of combining multiple files into one file.

Male genitalia; i.e., the cock and balls.

It is in a man's best interest to keep his package clean.

In Perl, packages are in effect namespaces, each with its own symbol table. They can also be used as classes in an OO context; see bless. When a package declaration is made, code from that declaration until the end of the innermost block, file, or eval will be carried out in that package. It is also possible to declare no package, in which case no relationship between the (nonexistent) package symbol table and the current variable-name mapping exists, and therefore variables must be either lexical, or with a specific package name given.

local, our, and use vars (and my, sort of) all affect the package symbol table's relationship with the current variable-name mapping, by locally assigning (our) a variable or typeglob name from/to the entry of the same name in the package symbol table, or globally assigning a variable name dynamically to the entry of the same name in whatever package happens to be current (use vars), or saving the state of a package variable and restoring it at the end of the block, file, or eval (local). my is a special case in that it assigns an unqualified variable name to a lexical variable, outside any package; this does not, strictly speaking, deal with the package's symbol table, but the distinction between lexical and package variables can be a source of confusion and is included here for completeness. Variables can also be explicitly specified as being from/in a certain package using a double-colon (::) or single quote (', highly deprecated and about to disappear in Perl 6).

If no package is declared, or given before the double-colon, package main is used.

Usage example:

use strict;               # Currently in package main
package Foo;              # Now in package Foo
use vars qw($u $v);       # Causes $u or $v at any
                          # given point to refer to 
                          # the $u or $v in the current
                          # package
$u = 5;                   # Sets $Foo::u
$Bar::u = 6;              # Sets $Bar::u
$::u = 0;                 # Sets $main::u
{    
    package Bar;          # Now in package Bar
    {
        our ($u);         # Locally alias $u to $Bar::u
        $u++;             # Increments $Bar::u
    }
    $u++;                 # Error!  The use vars
                          # does not carry across packages.
}
$u++;                     # Increments $Foo::u
                          #   (block containing Bar has
                          #    terminated)
my $u;                    # Lexical variable
{                         #   overshadows use vars
    our ($u);             # $u => $Foo::u (inner block
                          #                overshadows
                          #                outer block)
    $u++;                 # Increments $Foo::u
}
$u++;                     # Increments lexical $u
package;                  # Null-package declaration
$v++;                     # Error!  No package!
                          #   (see use vars above)
$w++;                     # Error!  No declaration!
                          #   (see use strict above)
$Bar::v++                 # This is qualified, so okay
my $w;
$w++;                     # This is now lexical, so okay
package Baz;
our ($w);
$w = 0;
sub w { $w }
w                         # Returns 0
{
    local $w = 1;         # Localizes entry
    w                     # Returns 1; note dynamic scoping
}
w                         # Returns 0; block has terminated
{
    my $w = 1;            # Lexical declaration;
                          #   does not affect $Baz::w
    w                     # Returns 0, for that reason
}

Update: fixed an error, and another error (thanks, ariels).

Package
In television news, a package is the full treatment of a story, generally a minute or two in length, and featuring multiple sound bites and the reporter's commentary. Generally, a photographer accompanies the reporter on the story, shooting video of the event or interviews. Afterwards, the reporter edits the video and lays down a voice track to describe what's going on, interspersing sound bites from interview subjects. Generally, when you hear the reporter's voice or see him or her on video (as opposed to the anchor doing all the talking), it's a package you're watching.

Frequently, packages are introduced by the anchor, and may include a live shot of the reporter. ("We now have confirmed reports that the two separate incidents of family pet abuse are indeed linked. Live from the scene, here's KBBL cub reporter Humbabba Jurgowaasix with our top story." "Thanks Phil. Police say these incidents are the work of a desperate mutant on the loose.") After the live intro, the taped package is run, featuring all the details the reporter can cram into a minute twenty and whatever video is most likely to tell the tale, peppered with sound bites from city officials, victim's family, or what have you. Often after the package, they cut back to a live shot of the reporter summing up and bantering with the anchor. ("Just awful down here, Phil. Police are clueless and neighbors are totally freaked out." "Thanks, Humbabba. Keep us posted.")

The package is the staple of TV news, the big treatment given to the big stories. In most markets, reporters are responsible for at least one package a show in addition to various VOs and VO-SOTs.

See also VO and VO-SOT.

Pack"age (?), n.

1.

Act or process of packing.

2.

A bundle made up for transportation; a packet; a bale; a parcel; as, a package of goods.

3.

A charge made for packing goods.

4.

A duty formerly charged in the port of London on goods imported or exported by aliens, or by denizens who were the sons of aliens.

 

© Webster 1913.

Log in or registerto write something here or to contact authors.