Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^4: blessed confusion

by perl-diddler (Hermit)
on Sep 09, 2010 at 21:35 UTC ( #859571=note: print w/replies, xml ) Need Help??

in reply to Re^3: blessed confusion
in thread blessed confusion

<quote> conditional (on a command line option), which is surely better... </quote> Not for me. I want it on all the time during development (a phase in which something may stay for the life of the program!). So having to type in anything extra on a command line just once wouldn't be worth it. The command may be in my path, but may not be in the current directory -- so I'd also have to use the -S switch if I ran it using 'perl xxx'.

Problem was addressed by first response -- the error message can be interpreted ambiguously and talks about the "errors" effect on a particular model rather than what the error *is*. So I was looking at the 'blessed' statement's target rather than what was being used to bless the target -- problem was that the RH operand of the bless wasn't a "value", due to the stack being confused. The error message was trying to interpret the effect of what was going on, saying: 'error: you are trying to bless into a <insert random type from stack>', where random value was a hash.

Once I knew it was complaining about the RH of the bless and not the LH, the error was obvious: the constructor was called as PKG::new instead of PKG->new.

I figured it had to be something basic I was missing (like never having seen that particular error before, and misinterpreting it), cuz, I really thought I had at least a passing understanding of the objects -- and that led to the 'lame mistake' of me using the wrong calling convention.

The rest of the suggestions were things that were pretty much already covered in my code, in some perlish fashion (different but equal...:-) ).

Thanks much for all the suggestions!

Replies are listed 'Best First'.
Re^5: blessed confusion
by ikegami (Pope) on Sep 09, 2010 at 23:14 UTC

    If you want it in the code instead of as an option, you can use use Carp::Always;.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://859571]
[Lady_Aleena]: What?! Can't stat ~/Music: No such file or directory? The ~/ doesn't expand?
[Lady_Aleena]: And the env variable $HOME doesn't work either. !@#$
[shmem]: no, that's a shell feature. Use $ENV{HOME}
[marioroy]: my $ans = qx{ find \$HOME -name "*.pl" -exec ls -l {} \\; };
[marioroy]: must backslash $ inside qx
[Lady_Aleena]: I haven't written perl for a while, I've been trying to do things at the command line. I'm having to relearn a lot.
[marioroy]: LA can you post the qx find again
[Lady_Aleena]: Things I would have written a script for while I was on Windows, I can run simply on the command line.
[Lady_Aleena]: marioroy, my @music_times = qx(find ~/Music/Albums/ -type f -iname '*.mp3' -exec mp3info -p "%S\n" {} \;); #unfixed

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2017-04-23 21:05 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.