Skip to content

Instantly share code, notes, and snippets.

@robinedwards
Created October 14, 2010 09:24
Show Gist options
  • Save robinedwards/625928 to your computer and use it in GitHub Desktop.
Save robinedwards/625928 to your computer and use it in GitHub Desktop.
use Class::MOP;
use Config::ApacheFormat;
my $meta Class::MOP::Class->initialize(
'Config::ApacheFormat',
);
$meta->add_around_method_modifier('get', sub {
my $meth = shift;
my $self = shift;
my @var = $self->$meth(@_);
return unless scalar @var;
return @var if wantarray;
return $var[0] if scalar @var == 1;
\@var;
}
);
$meta->make_immutable(inline_constructor => 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment