bless({
ACT => "Purchase",
ACTIVITIES => {
Purchase => { datefield => "date_bought", func => "total_bought" },
Sale => { datefield => "date_sold", func => "total_sold" },
},
}, "EOYStats")
####
#! perl
use strict;
use warnings;
#------------------------------------------------------------------------------
package EOYStats;
#------------------------------------------------------------------------------
sub new
{
my ($class) = @_;
my $this = bless {}, $class;
use Data::Dump;
dd $this;
return $this;
}
sub do_something
{
my ($this, $arg) = @_;
print "EOYStats::do_something($arg)\n";
}
#------------------------------------------------------------------------------
package EOYStats::Sale;
#------------------------------------------------------------------------------
use parent -norequire, 'EOYStats';
sub get_stats
{
my ($this, $arg) = @_;
print "EOYStats::Sale::get_stats()\n";
$this->do_something($arg);
}
#------------------------------------------------------------------------------
package EOYStats::Purchase;
#------------------------------------------------------------------------------
use parent -norequire, 'EOYStats';
sub get_stats
{
my ($this, $arg) = @_;
print "EOYStats::Purchase::get_stats($arg)\n";
$this->do_something($arg);
}
#------------------------------------------------------------------------------
package main;
#------------------------------------------------------------------------------
my $obj = EOYStats::Purchase->new();
$obj->get_stats('abc');
####
12:59 >perl 1034_SoPW.pl
bless({}, "EOYStats::Purchase")
EOYStats::Purchase::get_stats(abc)
EOYStats::do_something(abc)
13:09 >