Thread (41 messages) flat view 41 messages, 4 authors, 2016-06-15

Re: [PATCHv5 03/17] gitweb/lib - Very simple file based cache

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:43

On Wed, Oct 6, 2010 at 22:01, Jakub Narebski [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help