Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    fields::aliased 1.05

    Download button

    No screenshots available
    Downloads: 237  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kevin Michael Vail | More programs
    Perl Artistic License / FREE
    May 15th, 2007, 03:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    fields::aliased description

    fields::aliased is a Perl module that can create aliases for object fields.

    fields::aliased is a Perl module that can create aliases for object fields.

    SYNOPSIS

    package MyPackage;
    use strict;
    use fields qw($scalar @array %hash);

    sub new {
    my $class = shift;
    my $self = fields::new($class);

    return $self;
    }

    sub mymethod {
    my MyPackage $self = shift;
    use fields::aliased qw($self $scalar @array %hash);

    $scalar = 1;
    @array = (2 .. 4);
    %hash = ('one' => 1, 'two' => 2);
    }

    This module is a companion to the fields module, which allows efficient handling of instance variables with checking at compile time. It goes one step further and actually creates lexical aliases to the instance values, which can make code not only easier to type, but easier to read as well.

    Declarations

    You declare the fields using the fields pragma, as always.

    use fields qw($scalar @array %hash nosigil);

    Each field name may be preceded by a type sigil to indicate which kind of variable it is. Names without the type sigil are treated as scalars.

    For names beginning with an underscore, see "PRIVATE FIELDS" below.

    Constructors

    You call fields::new to create the object.

    my $self = fields::new($class);

    Usage

    In each method that uses the individual fields, you add a line similar to the following:

    use fields::aliased qw($self $scalar @array %hash nosigil);

    That is, list the variable being used for the object reference, and then the names of the fields that you are going to use in this method. fields::aliased takes care of declaring the appropriate Perl lexical variables and linking them to the appropriate field. You only need to specify the fields you are actually going to use, including any inherited from superclasses.

    Requirements:

    · Perl
    · Tie::IxHash
    · Filter::Util::Call
    · Test::More

    What's New in This Release:

    · Initialize field values at use fields::aliased time rather than when the object is created. Net effect should be identical, but this allows private fields to work.



    Product's homepage

      


    TAGS:

    create aliases | create aliases | Perl module | fields::aliased | object | fields

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM