in reply to "Method is not in the class but it is there!"

Do note, as the output shows, that Class::ISA::super_path does not return the package it's called with (unless there's a loop in the inheritance structure). So, if &CC2::Schema::BirthdayCardList::add_to_birthday_cards exists, you get the behaviour you are seeing.

Alternatively, someone has put it in UNIVERSAL, which also isn't returned by super_path.

Replies are listed 'Best First'.
Re^2: "Method is not in the class but it is there!"
by shak380 (Novice) on Sep 05, 2011 at 08:45 UTC
    >> "if &CC2::Schema::BirthdayCardList::add_to_birthday_cards exists, you get the behaviour you are seeing" Yes, that is obvious, but as I mentioned there is no such method or a single word 'add_to_birthday_cards' in the module, CC2::Schema::BirthdayCardList. Also, it is not in UNIVERSAL, please see this :
    perl -I ~/cc-tmpl/lib/ -MUNIVERSAL -le 'print "Yes.....\n" if UNIVERSA +L->can("add_to_birthday_cards")'
    doesn't print "Yes.....". Also,
    grep 'add_to_birthday_cards' /usr/lib/perl5/5.8.8/UNIVERSAL.pm -rli
    outputs nothing.
      Note that Perl supports creation of methods with dynamic names at run time and compile time, so a grep not showing a result suggest that this might be the case.
      If you can't find it at all, and if the method uses variables, pass in a tied variable that dumps a stack trace on a FETCH. That should give you some line numbers to work with (or an indication the method was evalled into existence).
      Um, UNIVERSAL.pm is a core module, nobody edits UNIVERSAL.pm, but modules/programs, might at runtime, despite it being a bad practice, add symbols to UNIVERSAL namespace