Guest User

Untitled

a guest
Jul 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. {
  2. package Test;
  3.  
  4. use strict;
  5. use warnings;
  6.  
  7. our $count;
  8.  
  9. sub new {
  10. my $class = shift;
  11. my %self = map { $_ } @_;
  12.  
  13. $count++;
  14. return \%self,$class;
  15. }
  16.  
  17. sub g {
  18. my $self = shift;
  19. return $count;
  20. }
  21. }
  22. {
  23. package Omg;
  24. use base qw/ Test /;
  25.  
  26. my $lol = Test->new;
  27. }
  28.  
  29. {
  30. package LOL;
  31. use base qw/ Test /;
  32. my $lol = Test->new;
  33. print $lol->g;
  34. }
  35.  
  36.  
  37. ## returns 2
Add Comment
Please, Sign In to add comment