LINUX CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>

7-DAY TOP DOWNLOAD

#
Program
Chromium OS 0.4.22.8
4,365
BackTrack 3.0 / 4.0
Pre-Final

3,633
Wine 1.0.1 / 1.1.33
2,857
VLC 1.0.3
2,826
Yahoo Messenger
1.0.4

2,420
Chrome OS 0.4.237
Beta

2,095
Ubuntu 9.10
2,095
Thunderbird PST
Import plugin 1.2

1,811
Adobe Flash Player
for Linux 10.0.32.18
/ 10.1 Beta

1,685
Fedora 12
1,643

WEEK'S BEST

  • Ubuntu 9.10
  • Ubuntu Netbook Rem...
  • Pidgin 2.6.3
  • Wine 1.0.1 / 1.1.33
  • Linux Kernel 2.6.3...
  • Mozilla Firefox 3....
  • Fedora 12
  • OpenOffice.org 3.1.1
  • Firestarter 1.0.3
  • The Gimp 2.6.7 / 2...
  • FileZilla 3.3.0.1
  • Transmission 1.76
  • Super Grub Disk 0....
  • Gufw 9.04.2
  • Skype 2.0.072 / 2....
  • openSUSE Linux 11.2
  • Opera 10.10 Final
  • Adobe Flash Player...
  • wine-doors 0.1.3
  • Google Gadgets 0.1...
  • Home / Linux / Programming / Perl Modules

    Class::Clone 0.05

    Download button

    No screenshots available
    Downloads: 202  Add to download basket  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.5/5)
    14 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Tyler MacDonald | More programs
    Perl Artistic License / FREE
    April 17th, 2008, 03:14 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Add a review  Refer to a friend  Subscribe

     

    Class::Clone description

     

    Class::Clone is a Perl module to create a subclass or a copy of a class on-the-fly.

    Class::Clone is a Perl module to create a subclass or a copy of a class on-the-fly.

    SYNOPSIS

    # Another::Package gets its methods from Some::Package,
    # but to SUPER:: in Another::Pacakge will go to Another::Package::Super,
    package Some::Package::Super;
    sub method {
    my $class = shift;
    return "method";
    }

    package Some::Package;
    sub method {
    my $class = shift;
    return $class->SUPER::method . "ical";
    }

    package Another::Package::Super;
    sub method {
    return "naut";
    }

    package main;
    use Class::Clone qw(class_clone);
    use Test::More qw(no_plan);

    @Some::Package::ISA = qw(Some::Package::Super);
    class_clone('Some::Package', 'Another::Package');

    @Another::Package::ISA = qw(Another::Package::Super);

    is(
    Another::Package->method,
    'nautical',
    "Another::Package's namespace is completely independant of Some::Package"
    );

    Class::Clone makes an exact clone of an existing class, whose variables and subroutines are not in any way tied back to the existing class or it's parent classes. If you change any variables in the clone, the changes don't affect the parent class. When a cloned subroutine has a call like

    $self->SUPER::do_something()

    the clone class's parents are traversed. This module is called Class::Clone because this behaviour lends itself well to creating certain types of factory / polymorph classes.

    (This is in contrast to importing variable or subroutine references from other packages, typically via 'Exporter'. When you do that, your copy is the original copy, so changing inherited variables affects your parent packages, and SUPER:: will call the original parent's parent, even if you change your @ISA)

    Requirements:

    · Perl

      


    TAGS:

    subclass creator | class clone | Perl module | Perl | class | subclass



    HTML code for linking to this page:


    Go to top

    Windows tabGames tabDrivers tabMac tabLinux tabScripts tabMobile tabHandheld tabGadgets tabNews tab

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM