Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- package Test;
- use strict;
- use warnings;
- our $count;
- sub new {
- my $class = shift;
- my %self = map { $_ } @_;
- $count++;
- return \%self,$class;
- }
- sub g {
- my $self = shift;
- return $count;
- }
- }
- {
- package Omg;
- use base qw/ Test /;
- my $lol = Test->new;
- }
- {
- package LOL;
- use base qw/ Test /;
- my $lol = Test->new;
- print $lol->g;
- }
- ## returns 2
Add Comment
Please, Sign In to add comment