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 ?