perlootut

Created Monday 18 August 2014

http://perldoc.perl.org/perlootut.html

Class

my $hostname = File->new(
path => '/etc/hostname',
content => "foo\n",
last_mod_time => 1204974868,
);

Blessing

use Scalar::Util 'blessed';
print blessed($hash); #undef
print blessed($hostname); # File

Constructor

Methods

sub print_info {
my $self = shift;
my $prefix = shift;
print $prefix, ", ", $self->path, "\n";
}
$file->print_info("The file is located at ");

Inheritance

package File::MP3;
use parent 'File';

Overriding methods and method resolution

package File::MP3;
use parent 'File';
sub print_info {
my $self = shift;
$self->SUPER::print_info();
print "Its title is ", $self->title, "\n";
}

http://perldoc.perl.org/perlobj.html

The complete examples



Backlinks: