Jim Schueler
- Website: pl2sql.tqis.com/
- About: NoSQL::PL2SQL is everything I've got.
Recent Actions
-
Commented on function return in scalar context
package Function::ReturnScalar ; use strict ; use warnings ; use Attribute::Handlers ; no warnings 'redefine' ; my $function_code_ref ; my %behavior_of ; $behavior_of{first} = sub { $_[0] } ; $behavior_of{last} = sub { $_[-1] } ; $behavior_of{count} = sub...
-
Commented on function return in scalar context
I've always assumed the Don't be clever caveat meant that if it was a good idea, Damian would've thought of it first. Seems like you're making the same point as Aristotle did at 3:22am. But his response included a recommendation....
-
Commented on function return in scalar context
rob.kinyon- Please don't tell me I'm wrong without some elaboration. I'm wrong because the code gives me the wrong answer? Well yeah. If this were truly a question in a tech forum, I'd hope most would avoid responding simply...
-
Posted function return in scalar context to Jim Schueler
sub lowercase { } $jim = lowercase('jim') ; print "$jim\n" ;
Naturally that this snippet of code prints 1. I understand the explanation of "an array in scalar context blah blah blah". But it's so counter-intuitive because m…
-
Commented on JQuery and Moose
Thanks for all the great responses. I expected a bit more come-uppance for my generalizations about Moose. I understand that "modern perl" specifically refers to the MOP paradigm and generally means Moose. But results on a google search for "modern...
-
Posted JQuery and Moose to Jim Schueler
In the spirt of re-usability, I'm sharing something I posted elsewhere last week:
http://www.amazon.com/gp/cdp/member-reviews/APW5UB68563TV/ref=pd_ys_sf_lf_rev?ie=UTF8&s…
-
Posted MVC - A Personal History to Jim Schueler
I shared this story with a potential employer a couple weeks ago, who apparently was unimpressed. Notwithstanding, it's all true. Literary criticism might be the next best step.
In 2001, Arthur Andersen Business Consulting went out of business. And I lost the best job I ever ha…
-
Posted detroit.pm.org to Jim Schueler
There used to be a detroit.pm.org. And after Stevan Little's keynote last week, Perl- The Detroit of Scripting Languages, I made some inquiries about resurrecting it... Maybe specifically with the intention of hosting YAPC :).
So far, the local response has been positive. As lon…
- Posted Austin Question to Jim Schueler
Comment Threads
-
Aristotle commented on
function return in scalar context
Joel: In larger projects I paste a
sub listify { @_[0..$#_] }
for that purpose. Then you can saysub lower { listify map { lc } @_ }
. -
Shawn H Corey commented on
function return in scalar context
I don't like it because it changes the behaviour of Perl by placing two relevant items far apart. As far as programmers go, out of sight is out of mind. The `use Function::ScalarReturn` has to be place near where the sub is called, or programmers are going to forget it has special behaviour.
Or as Damian Conway put it in Perl Best Practices, "Don't be clever."
-
Nova Patch commented on
function return in scalar context
perlfunc on
map
: In scalar context, returns the total number of elements so generated.perlfunc on
grep
: In scalar context, returns the number of times the expression was true. -
Ether commented on
function return in scalar context
Please don't monkeypatch UNIVERSAL. If you want to make a pragma, then make a real pragma, but you'll probably need to patch core.
-
Olivier Mengué (dolmen) commented on
function return in scalar context
There is of course « more than one way to to it ». But some are more idiomatic than others.
map { _replace_package_symbols( @$_ ) } @callers ;
would be better written like that:
_replace_package_symbols( @$_ ) for @callers;
In general, using map in void context is a wrong usage of the divertisty of Perl syntax.
(That is not an endorsement for the rest of the post)
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.