in reply to Re: Moose 'clone' Constructor
in thread Moose 'clone' Constructor
G'day tobyink,
++ Thanks for pointing me to that module: I hadn't encountered it previously.
I found the way you've used coderefs interesting. I suspect I may have seen something similar in the past but probably wasn't paying close enough attention. I'm certainly familiar with:
$ perl -E 'my $x = sub { say "@_" }; $x->("fred")' fred
And, as expected, this didn't work:
$ perl -E 'my $x = sub { say "@_" }; $x("fred")' syntax error at -e line 1, near "$x(" Execution of -e aborted due to compilation errors.
However, I've never written code like:
$ perl -E 'my $x = sub { say "@_" }; "XYZ"->$x("fred")' XYZ fred
I'll have to look into that further. I've read the "Object::Util - Rationale" section. Can you point me to any documentation that explains this in more detail?
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Moose 'clone' Constructor
by tobyink (Canon) on Jul 05, 2018 at 08:29 UTC | |
by kcott (Archbishop) on Jul 05, 2018 at 08:51 UTC | |
by tobyink (Canon) on Jul 05, 2018 at 17:11 UTC | |
|
Re^3: Moose 'clone' Constructor
by huck (Prior) on Jul 05, 2018 at 06:25 UTC | |
by kcott (Archbishop) on Jul 05, 2018 at 07:34 UTC | |
by Athanasius (Archbishop) on Jul 06, 2018 at 09:44 UTC | |
by kcott (Archbishop) on Jul 06, 2018 at 11:09 UTC | |
by Athanasius (Archbishop) on Jul 06, 2018 at 13:16 UTC | |
|