NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
I'm convinced! (Score:1)
BTW, s/on/an/ in my name.
Re: (Score:1)
The great thing about multitasking is that several things can go wrong at once.
Looks great! (Score:2)
Regrettably, it still requires a blessed hashref, but that's a small price to pay for a prototyping tool.
Passing hashref to constructor (Score:1)
and
Speed is not the only reason, and I believe its no
life is short
Re: (Score:1)
line number where I made the mistake, and not the line inside your
constructor where you assign @_ to an hash (the common approach).
That's what Perl Best Practices recommends too, I think,
although it looks terrible.
Object::Tiny accessors are read-only (Score:1)
Unfortunately, Object::Tiny accessors are read-only.
So there's one little thing that Class::Accessor has over Object::Tiny. (For about 30 seconds until Adam goes and adds it.)
Otherwise, Object::Tiny++
Re: (Score:1)
Frankly, I don't get this obsession people have with mutators.
90% of the time, you want to make a data object of some sort with the attributes fixed at create-time.
90% of the time, it makes little to no sense to have values changing after the object is created.
This sort of thing is silly.
my $object = Foo->new;
$object->param1('foo');
$object->param2('bar');
It leaves the code in a transitional state that may will be illegal.
FAR better to just provide it to the constructor, en
Re: (Score:1)
It’s not like it’s hard to write them manually. What O::T provides is just a simple hash-bashed object after all.
Re: (Score:1)
Re: (Score:2)
Re: (Score:1)
> Frankly, I don't get this obsession people have with mutators.
> 90% of the time, you want to make a data object of some sort with the attributes fixed at create-time.
> 90% of the time, it makes little to no sense to have values changing after the object is created.
I strongly disagree.
Accessors are invented to get control over accessing the object attributes. From where did you derive the restriction to read-only or write-only? I have never read such res
Re: (Score:2)
I would actually to so far as to that the initialization should use the accessors too (encapsulation of validation, rocket engine startup, etc.).
Object::Tiny should be renamed Object::Immutable::Tiny
Re: (Score:2)
abuse of import (Score:1)
Re: (Score:1)
Re: (Score:1)
Does it matter?
In fact, since O::T creates accessors with the given names, it’s arguable whether it’s even abuse in the first place.
Re: (Score:1)
Re: (Score:2)
Re: (Score:1)
To be clear, the abuse in import is the @ISA manipulation.
Otherwise, the import is passed a list of methods and Object::Tiny creates them in the caller's namespace. That they happen to be created on the fly instead of mapped to subroutines defined in Object::Tiny doesn't really matter, in my opinion.
Re: (Score:1)
POD (Score:2)
The document is a few kilobytes but apparently that would be a bit siginificant for your
Re: (Score:2)
Re: (Score:1)
Spelling/etc mistakes (Score:1)
There's a cleaned up revised version in my actual journal page.
accessors.pm (Score:1)