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

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.

Replies are listed 'Best First'.
Re^3: Class::MOP won't load a class!!
by stvn (Monsignor) on Sep 23, 2009 at 22:24 UTC
    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 :(

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

        Have you tried loading FeedHandler by hand? Perhaps there is an error in the module and for some reason that error is getting swallowed.

        Congrats on the baby btw!

        -stvn

        AARGH.... There see does is sitting there fine and dandy under Moose::Object and my class does a  use Moose;....?? Cut me some slack here Moosy!!

        $prove -lv t/Parser.t t/Parser.t .. 1..3 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 for %Admin_server::Parser:: .... ---------------------------------------------------------------------- +---------- 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 ---------------------------------------------------------------------- +---------- Printing out the symbol table for %Class::MOP .... ---------------------------------------------------------------------- +---------- AUTHORITY Attribute:: BEGIN Class:: HAVE_ISAREV IS_RUNNING_ON_5_10 Instance:: Method:: Module:: Object:: Package:: VERSION XS_VERSION __ANON__ _class_to_pmfile _is_valid_class_name _try_load_one_class blessed bootstrap check_package_cache_flag class_of confess does_metaclass_exist get_all_metaclass_instances get_all_metaclass_names get_all_metaclasses get_code_info get_metaclass_by_name import in_global_destruction is_class_loaded load_class load_first_existing_class reftype remove_metaclass_by_name store_metaclass_by_name subname weaken weaken_metaclass ---------------------------------------------------------------------- +---------- Printing out the symbol table for %Admin_server::Parser::Plugin::Feedh +andler:: .... ---------------------------------------------------------------------- +---------- BEGIN BUILD BUILDARGS DEMOLISH DEMOLISHALL DESTROY ISA blessed can confess is_yours isa meta new tell_instance_info tell_script_names tell_status ---------------------------------------------------------------------- +---------- Printing out the symbol table for %Moose::Object:: .... ---------------------------------------------------------------------- +---------- AUTHORITY BEGIN BUILD BUILDALL BUILDARGS DEMOLISH DEMOLISHALL DESTROY DOES ISA VERSION __mx_is_compiled can does dump import in_global_destruction meta new ---------------------------------------------------------------------- +---------- Done... ---------------------------------------------------------------------- +---------- 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 114. # Looks like your test exited with 255 just after 3. Dubious, test returned 255 (wstat 65280, 0xff00) All 3 subtests passed Test Summary Report ------------------- t/Parser.t (Wstat: 65280 Tests: 3 Failed: 0) Non-zero exit status: 255 Files=1, Tests=3, 0 wallclock secs ( 0.04 usr 0.01 sys + 0.23 cusr + 0.02 csys = 0.30 CPU) Result: FAIL

        Sorry just venting out.....