Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Best practices for warnings about wrong context

by Your Mother (Archbishop)
on Oct 05, 2015 at 16:50 UTC ( [id://1143836]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Best practices for warnings about wrong context
in thread Best practices for warnings about wrong context

It does not. The body expects a string/scalar. $c->response->body(defined wantarray); prints "1". Maybe I am missing the point because a setter like ->body expects a value and is therefore never going to be a void context call; it's a strange question / concept to want to demonstrate.

Replies are listed 'Best First'.
Re^4: Best practices for warnings about wrong context
by vsespb (Chaplain) on Oct 05, 2015 at 16:55 UTC
    In this example wantarray returns context in which the action called, not related to what body expects, so
    $c->response->body(wantarray)
    same as
    my $x = wantarray; $c->response->body($x)

      Sorry, you are quite right about that. I was talking crazy. It still does not print "1" though, as you're right, same wantarray context so nothing could be different, but returns false but defined.

        hm, in my case it prints "1", and wantarray+1 prints "2". strange. maybe different Catalyst version/plugins/setup. Anyway, defined but false, does not change whole topic idea.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1143836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found