in reply to Class::MOP won't load a class!!

What does Admin_server::Parser::Plugin::FeedHandler look like? Are you 100% sure it actually has a does method? Perl is generating that error because it can't find the does method, the comment about it not being loaded is just perl suggesting a possible cause.

-stvn

Replies are listed 'Best First'.
Re^2: Class::MOP won't load a class!!
by MarkovChain (Sexton) on Sep 23, 2009 at 18:43 UTC
    Hi Steven,

    Thanks for the reply.

    doesis a sugar function exported by Moose. It's job is to check if a given Moose class 'does' a role. (See http://search.cpan.org/~drolsky/Moose-0.89/lib/Moose/Manual/Roles.pod).

    I am more inclined to believe that the class hasn't been loaded because in the output of t/Parser.t, I don't see the line finished loading plugin.

    Admin_server::Parser::Plugin::FeedHandler has four functions - none of which is does. I could list them out but not sure if they are relevant to the discussion.

      does is a sugar function exported by Moose. It's job is to check if a given Moose class 'does' a role.

      Yes, I know, I am the (original) author of Moose and Class::MOP :)

      And actually, does is not part of the exported sugar, it is a method of Moose::Object.

      I am more inclined to believe that the class hasn't been loaded because in the output of t/Parser.t, I don't see the line finished loading plugin.

      Yes, but the failure is saying there is no does method, and you don't call the does until after that line would be printed. There is no reason why Class::MOP::is_class_loaded would be calling does as does is a Moose thing and not a Class::MOP thing. Perhaps you are calling or loading an older version of the Admin_server::Parser module?

      Admin_server::Parser::Plugin::FeedHandler has four functions - none of which is does. I could list them out but not sure if they are relevant to the discussion.

      Perhaps it wouldn't be helpful, but it wouldn't hurt either. It also might be good to let us know the version of Moose/Class::MOP your running too.

      For what its worth, it works on my machine when I reproduced your code and setup.

      -stvn

        Hi Steven,

        Whoa!! Respect Sir!!

        I must apologize for my delay in reply. I just had a kid and had to take care of the little doodle and mommy.

        Ok so here are the point(s).

        1. According to http://search.cpan.org/~drolsky/Moose-0.92/lib/Moose/Object.pm, This class is the default base class for all Moose-using classes. When you use Moose in this class, your class will inherit from this class.. And my FeedHandler.pm starts off with:
          19 package Admin_server::Parser::Plugin::Feedhandler; 20 use MooseX::FollowPBP; 21 use Moose; 22 23 with 'Admin_server::Interface::ParserInterface';
          So even does should be available anyway.
        2. I have for functions in the module. They are:

          is_yours()

          tell_status()

          tell_script_names()

          tell_instance_info()

        3. I am currently using version 0.92 of Class::MOP.

        Thank You,

        - Markov

        So I thought I would print out the symbol table in %Admin_server::Parser,

        75 print "Plugin $plugin is loaded indeed.\n" 76 if ( Class::MOP::is_class_loaded($plugin) ); 77 78 #===================================== 79 # Let's print out the symbol table to check 80 # whether the plugins loads up. 81 #===================================== + 82 83 print '-'x80, "\n"; 84 print 'Printing out the symbol table....', "\n"; + 85 print '-'x80, "\n"; 86 foreach my $key ( sort {$a cmp $b} keys %Admin_server::Pa +rser:: ) { 87 print $key, "\n"; + 88 }
        and this is what i get...
        $prove -lv t/Parser.t t/Parser.t .. 1..4 ok 1 - use Admin_server::Parser; ok 2 - Admin_server::Parser can be instantiated. ok 3 - Instantiated object is of type Admin_server::Parser Found plugins: Admin_server::Parser::Plugin::FeedHandler Loading plugin Admin_server::Parser::Plugin::FeedHandler finished loading Admin_server::Parser::Plugin::FeedHandler ---------------------------------------------------------------------- +---------- Printing out the symbol table.... ---------------------------------------------------------------------- +---------- BEGIN BUILD BUILDARGS DEMOLISH DEMOLISHALL DESTROY ISA ParserInterface Plugin:: _build_plugins a b blessed can clear_plugins confess get_plugins has_plugins import isa meta new tell_app_name tell_app_status Can't locate object method "does" via package "Admin_server::Parser::P +lugin::FeedHandler" (perhaps you forgot to load "Admin_server::Parser +::Plugin::FeedHandler"?) at /Volumes/UserData/Users/dattanik/Programs +/Perl/Work_area/Admin_server/lib/Admin_server/Parser.pm line 91. # Looks like you planned 4 tests but ran 3. # Looks like your test exited with 255 just after 3.

        So as you can see, there is no FeedHandler sitting there..... I am lost :(