if ( defined &$TEST->test_sub ) { TEST->test_sub; } else { print "Method doesn't exist"; }