So let me explain this error for you since it is pretty darn confusing, and then I have a few more suggestions.
Can't locate object method "blessed" via package "Can't locate object
+method "update" via package "Class::MOP::Class::__ANON__::SERIAL::2"
+at thread_test.pl line 115.
To start with, "Class::MOP::Class::__ANON__::SERIAL::2" is the name Moose/Class::MOP will give to an anon class. Exactly how or why this anon class was created I don't know, you will need to dig into the guts of Net::Twitter for that. I suspect it was runtime role composition, it is the most common usage of anon-classes.
So the next part is
Can't locate object method "update" via package "Class::MOP::Class::__
+ANON__::SERIAL::2
Which is just saying that it cannot find the "update" method on that anon-class. Which I suspect is from your code right here:
my $result = $thread_hash{'twit'}->update('Hello, world!');
which makes sense because we figured out earlier that %thread_hash is either not being shared properly or at the very least the value stored in the 'twit' key is not what you expect it to be.
This then brings us back to where we started ...
Can't locate object method "blessed" via package "Can't locate object
+method "update" via package "Class::MOP::Class::__ANON__::SERIAL::2"
+at thread_test.pl line 115.
So here is looks like someone is attempting to call the "blessed" method on an error ($@). But that actually is not the case since I suspect this is actually caused by your code here:
die $@ unless blessed $err && $err->isa('Net::Twitter::Error');
and basically Perl is interpretting "blessed" as a method call since you have not actually imported the Scalar::Util::blessed method into your package. What makes this really confusing is that your error ($@) is actually a string ("Can't locate object method "update" via package "Class::MOP::Class::__ANON__::SERIAL::2") and since Perl classes are really just strings Perl is thinking that this string is a class name, when in fact it is just an error string.
So, if we look at all that this, I would suggest you try a couple things.
- Make sure you are importing Scalar::Util::blessed into MyFrame since it is being called in there.
- Dump the value (using Data::Dumper) of $thread_hash{'twit'} to see what it actually is (the class name is not given you enough details)
Post the results of this and we can see what we have.
|