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

Clarify what it does

by Boldra (Deacon)
on May 31, 2012 at 08:48 UTC ( #973467=note: print w/replies, xml ) Need Help??


in reply to What operator should perl5porters use for safe dereferencing?

It would make $bar-XX>method() safe if $bar is undefined, but what if $bar is a scalar? Or an unblessed reference? Or an array ref? or a coderef? Would the same operator work for fetching elements of array refs and or keys of hashrefs, or only for methods?


- Boldra

Replies are listed 'Best First'.
Re: Clarify what it does
by dsheroh (Prior) on May 31, 2012 at 13:35 UTC
    It would make $bar-XX>method() safe if $bar is undefined, but what if $bar is a scalar? Or an unblessed reference? Or an array ref? or a coderef?
    The poll question specifically states it's for attempting to call methods on undef. I'm fairly certain that it's not intended to gloss over attempts to call methods on arbitrary scalars and especially not on references of the incorrect type. Those should definitely remain errors.
    Would the same operator work for fetching elements of array refs and or keys of hashrefs, or only for methods?
    Interesting thought... It would make sense to me, at least, that if an arrayref/hashref is undef, then all of its elements are implicitly undef as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973467]
help
Chatterbox?
[Corion]: erix: But that makes for fun bug hunting. "What version of Chrome are you running?" "v62". "I also run v62 and it works on my machine". :-(
[Corion]: marto: Great, looking forward to the PR!
LanX wonders, do we have a rule against systematic down voting?
[erix]: we frown :)
[marto]: Does the command line arg --product-version@ help?
[LanX]: xD
[erix]: 'systematic' is going to be hard to define I think
[marto]: Err no @
LanX Much enemy much ore

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2017-12-12 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (335 votes). Check out past polls.

    Notices?