The application I currently work on has a class named, CC2::Schema::BirthdayCardList. and there is an object of it which calls a method 'add_to_birthday_cards', but I cant see any so named method or any AUTOLOADs in either the same class or any parent classes of it. So I wonder where this method is located and how it works. I tried to find it with, Class::ISA and the output was as below :
perl -I ~/lib/ -MCC2::Schema::BirthdayCardList -MClass::ISA -le 'for ( +Class::ISA::super_path( "CC2::Schema::BirthdayCardList" )) { print "\ +$_ is : $_"; print "I have the method, add_to_birthday_cards\n" if $_ +->can("add_to_birthday_cards") }'
and the output was as follows :
$_ is : Local::CMSDBIx $_ is : DBIx::Class::InflateColumn::DateTime $_ is : DBIx::Class::InflateColumn $_ is : DBIx::Class::Row $_ is : DBIx::Class::Core $_ is : DBIx::Class::Relationship $_ is : DBIx::Class::Relationship::Helpers $_ is : DBIx::Class::Relationship::HasMany $_ is : DBIx::Class::Relationship::HasOne $_ is : DBIx::Class::Relationship::BelongsTo $_ is : DBIx::Class::Relationship::ManyToMany $_ is : DBIx::Class::Relationship::Accessor $_ is : DBIx::Class::Relationship::CascadeActions $_ is : DBIx::Class::Relationship::ProxyMethods $_ is : DBIx::Class::Relationship::Base $_ is : DBIx::Class::PK::Auto $_ is : DBIx::Class::PK $_ is : DBIx::Class::ResultSourceProxy::Table $_ is : DBIx::Class::ResultSourceProxy $_ is : DBIx::Class $_ is : DBIx::Class::Componentised $_ is : Class::C3::Componentised $_ is : Class::Accessor::Grouped
That is none of them have a so called method. However if I run this :
perl -I ~/lib/ -MCC2::Schema::BirthdayCardList -le 'print "Yes.....\n" + if CC2::Schema::BirthdayCardList->can("add_to_birthday_cards")'
it prints "Yes.....". So what is magical here ?

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.