This shows you the differences between two versions of the page.
— |
kurs:moose_inheritence [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | ## Bla.pm | ||
+ | package Bla; | ||
+ | use Moose; | ||
+ | |||
+ | |||
+ | sub foo { | ||
+ | my ($self) = shift; | ||
+ | print "se foo\n"; | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | ## BlaExt.pm | ||
+ | package Bla; | ||
+ | use Moose; | ||
+ | |||
+ | |||
+ | sub foo { | ||
+ | my ($self) = shift; | ||
+ | print "se foo\n"; | ||
+ | } | ||
+ | |||
+ | 1; | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | ## use_bla.pl | ||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | use BlaExt; | ||
+ | |||
+ | my $bla = BlaExt->new(); | ||
+ | $bla->foo; | ||
+ | |||
+ | ## BlaExt::foo(); # won't work because Class Methods arent't inherited | ||
+ | |||
+ | </code> | ||
+ | |||
+ | |||