Re: [PATCHv5 03/17] gitweb/lib - Very simple file based cache
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Oct 6, 2010, 23:46 UTC
- Message-ID
- <201010070146.35858.jnareb@gmail.com>
- In-Reply-To
- <AANLkTi=DYHQLftyafoijzagTLmy76Uxsa0fiZ1ZO2wc=@mail.gmail.com>
On Thu, 7 Oct 2010, Ævar Arnfjörð Bjarmason wrote:
Show 26 quoted lines
> On Wed, Oct 6, 2010 at 22:01, Jakub Narebski <jnareb@gmail.com> wrote:
>
> > +sub new {
> > + my ($proto, $p_options_hash_ref) = @_;
> > +
> > + my $class = ref($proto) || $proto;
> > + my $self = {};
> > + $self = bless($self, $class);
>
> You use:
>
> my $class = ref($proto) || $proto;
>
> Throughout the new class definitions. Presumably that's just
> copy/pasted from some old docs and you don't actually want to support:
>
> my $obj = Class->new;
> my $obj2 = $obj->new;
>
> It's better just to:
>
> sub new {
> my ($class, $options) = @_:
> my $self = bless {}, $class;
>
> Unless there's some reason for the ref($proto) that I've missed.You are right, the 'my $class = ref($proto) || $proto;' dance is not necessary; we would be always using Class->new().
Will fix.
-- Jakub Narebski Poland