[Dbix-class] Re: Use of ->resultset mandatory?

A. Pagaltzis pagaltzis at gmx.de
Tue Oct 31 05:29:18 GMT 2006


* Mike Friedman <friedo at friedo.com> [2006-10-31 05:45]:
> You have to turn strict references off to do that, of course.
> (You _DO_ have strict on, right? :) )

Yes, I just didn’t add it to this oneliner because I haven’t
found a good way to turn strict off *only* for the dereference.

Something like this won’t work:

    do { no strict "refs"; *$_ } = sub { ... };

`do` blocks aren’t lvalues. Closest I can seem to get is this:

    my $glob = do { no strict "refs"; \*$_ };
    *$glob = sub { ... };

The temporary seems unavoidable; apparently Perl’s grammar rules
(or even its semantics) are non-orthogonal here, in that it won’t
permit this:

    *{ do { no strict "refs"; \*$_ } } = sub { ... };

That just throws an unspecified complaint about `{ no strict `.

Sigh.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hacker;
#Aristotle



More information about the DBIx-Class mailing list