Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Created April 5, 2020 15:42
Show Gist options
  • Save jjn1056/5cb238b3295994085cf62a3b00022e12 to your computer and use it in GitHub Desktop.
Save jjn1056/5cb238b3295994085cf62a3b00022e12 to your computer and use it in GitHub Desktop.
my @test;
sub test {
my ($class, $arg) = @_;
my $varname = "${class}::test";
no strict "refs";
push @$varname, $arg if defined($arg);
return @$varname,
map { $_->test }
grep { $_->can('test') }
$class->ancestors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment