Skip to content

Instantly share code, notes, and snippets.

@preaction
Created July 14, 2011 04:07
Show Gist options
  • Select an option

  • Save preaction/1081918 to your computer and use it in GitHub Desktop.

Select an option

Save preaction/1081918 to your computer and use it in GitHub Desktop.
package Foo::Graph;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {
template => undef,
};
bless( $self, $class );
#my $template = shift || confess "missing template";
#$self->{template} = $template;
$self->{warnings} = [];
return $self;
}
sub foo() {
return "abc123";
}
# ======================================
package Foo::ImageGraph;
use base qw( Foo::Graph );
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless( $self, $class );
return $self;
}
# ======================================
package Foo::TimeGraph;
use base qw( Foo::ImageGraph );
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless( $self, $class );
return $self;
}
sub bar {
my $self = shift;
#print Dumper( our @ISA ); => Foo::ImageGraph
print $self->foo();
}
#==============================
package main;
my $obj = Foo::TimeGraph->new;
$obj->bar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment