Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: How to use class

#!/usr/local/bin/perl -w
package Person ;
sub new{                   
    my $class = shift;
    my $person = {
        "Name"  => undef,
        "Occ

Perl: How to Initialize Attributes In The Constructor

#!/usr/local/bin/perl -w
package Person;
sub new {
    my $self = { };
    bless($self);
    # Initialize two attributes
    $self->{Name} = "";

Perl: Manipulate class attributes using the ‘set’ and ‘get’ methods

#!/usr/local/bin/perl -w
package person;
use strict;
sub Person {
    my $self = { };
    bless($self);
    $self->{Name} = "";
    $self->{AGE}   = 0

Perl: Create an Inheritable Class

#!/usr/local/bin/perl -w
# création d'une classe 
package Person;
sub new {
    my $class = shift;
    my $self  = { };
    return bless $self, $clas

Perl: Destroying an Object

#!/usr/local/bin/perl -w
package Person;
use strict;
sub new {
    my $self = { };
    bless($self);
    $self->{Name} = "";
    $self->{AGE}   = 0;

Perl: Using Classes as Structs

#!/usr/local/bin/perl -w
use Class::Struct;          # load struct module
# create a definition for a "Person" class
struct Person => {        
    f