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 > Perl Modules

    Alter 0.07

    Download button

    No screenshots available
    Downloads: 753  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.9/5)
    20 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Anno Siegel | More programs
    Perl Artistic License / FREE
    April 1st, 2008, 13:40 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Alter description

    Alter Perl class offers Alter Ego Objects.

    Alter Perl class offers Alter Ego Objects.

    Synopsis

    package MyClass;
    use Alter ego => {}; # Alter ego of type hash

    # Put data in it
    my $obj = do { my $o };
    ego( $obj)->{a} = 1;
    ego( $obj)->{b} = 2;

    # Retrieve it again
    print ego( $obj)->{ b}, "n"; # prints 2

    package OtherClass;
    defined( ego $obj) or die; # dies, OtherClass hasn't set an alter ego

    # Direct access to the corona of alter egos
    my $crown = Alter::corona $obj;

    Functions
    Basic Functions

    The functions described here accept a first argument named $obj. Despite the name, $obj can be any reference, it doesn't have to be blessed (though it usually will be). It is a fatal error if it is not a reference or if the reference points to a read-only value.

    ego($obj)

    Retrieves the class-specific alter ego assigned to $obj by alter() or by autovivification if that is enabled. If neither is the case, an undefined value is returned. The class is the package into which the call to ego() is compiled.
    alter($obj, $val)

    Assigns $val to the reference $obj as an alter ego for the caller's class. The class is the package into which the call to alter is compiled. Returns $obj (not the value assigned).
    Alter::corona( $obj)

    Direct access to the corona of alter ego's of $obj. The corona is a hash keyed by class name in which the alter ego's of an object are stored. Unlike alter() and ego(), this function is not caller-sensitive. Returns a reference to the corona hash, which is created if necessary. This function is not exported, if needed it must be called fully qualified.
    Alter::is_xs

    Returns a true value if the XS implementation of Alter is active, false if the pure Perl fallback is in place.

    Product's homepage

      


    TAGS:

    Alter Ego | Perl objects | Perl module | Alter | Ego | Objects

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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