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

Hi Steven,

Yeah Moose::Object shows up.

I modified the test file for Admin_server::Parser::Plugin::Feedhandler as follows:

=========================================

#---------------------------------------------------------- # These are to test the ISA array. #---------------------------------------------------------- print "="x79 . "\n"; print STDOUT join ", ", $fh->meta()->superclasses(); print "\n"; print "="x79 . "\n"; print STDOUT join ", ", sort $fh->meta()->get_all_method_names(); print "\n"; print "="x79 . "\n";

=========================================

Upon proving it, I got the following results:

=========================================

$prove -lv t/Plugin/FeedHandler.t t/Plugin/FeedHandler.t .. 1..34 ok 1 - use Admin_server::Parser::Plugin::FeedHandler; ok 2 - Admin_server::Parser::Plugin::Feedhandler can be instantiated. ok 3 - Instantiated object is of type Admin_server::Parser::Plugin::Fe +edhandler. ok 4 - Conforms to canonized plugin interface - does Admin_server::Int +erface::ParserInterface. ok 5 - Feed handler application correctly identified. ok 6 - tell_instance_info succesfully called. ok 7 - tell_instance_info returns a hash reference. ok 8 - tell_instance_info return hash has a key of 'instance_name'. ok 9 - Instance name correctly extracted from first line of log4x data +. ok 10 - Instance name negative test successful. ok 11 - Instance name negative test successful. ok 12 - tell_script_names successfully called. ok 13 - tell_script_names returns a hash. ok 14 - The tell_script_names return hash has a key of start_script. ok 15 - The tell_script_names return hash has a key of stop_script. ok 16 - Start script name correctly extracted from first line of log4x + data. ok 17 - Stop script name correctly extracted from first line of log4x +data. ok 18 - Start script name negative test successful - (with erroneous d +ata). ok 19 - Stop script name negative test successful - (with erroneous da +ta). ok 20 - Start script name negative test successful - (with undef data) +. ok 21 - Stop script name negative test successful - (with undef data). ok 22 - tell_status successfully called with a log4x line not having a +n error. ok 23 - tell_status returns a hash. ok 24 - tell_status correctly diagnoses feed handler as up. ok 25 - tell_status return hash doesn't have the app_down key when app + is up. ok 26 - tell_status return hash doesn't have the app_unknown key when +app is up. ok 27 - tell_status successfully called with a log4x line having an er +ror. ok 28 - The tell_status correctly diagnoses feed handler as down. ok 29 - tell_status return hash doesn't have the app_up key when app i +s down. ok 30 - tell_status return hash doesn't have the app_unknown key when +app is down. ok 31 - tell_status successfully called with a undef value. ok 32 - The tell_status correctly diagnoses feed handler status as unk +nown. ok 33 - tell_status return hash doesn't have the app_up key when app i +s unknown. ok 34 - tell_status return hash doesn't have the app_unknown key when +app is unknown. =============================================================== Moose::Object =============================================================== BUILDALL, BUILDARGS, DEMOLISHALL, DESTROY, DOES, does, dump, is_yours, + meta, new, tell_instance_info, tell_script_names, tell_status =============================================================== ok All tests successful. Files=1, Tests=34, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.22 cusr + 0.02 csys = 0.28 CPU) Result: PASS

=========================================

So the good news is that Moose::Object shows up there. does shows up too!!

Replies are listed 'Best First'.
Re^7: Class::MOP won't load a class!!
by MarkovChain (Sexton) on Nov 12, 2009 at 16:51 UTC

    So to close the loop... I finally got the program to work but the solution is a bit uncouth.

    I am able to do a require on all the plugins that I need.

    It's a fix for now but I would really like Class::MOP to do the trick. Just makes the program more malleable and maintainable, Not sure why it would not load a module when require does it perfectly well.....

      Similar problem here. I'm missing 'new' in my new Moose class. Unfortunately in my case require 'Moose::Object.pm' does not work:

      Can't locate Moose::Object.pm in @INC (@INC contains: ... c:/xampp/perl/site/lib c:/xampp/perl/lib .)

      Any other ideas?

      Without the require I get:
      Wolfgang 14:07:08 /cygdrive/d/projekte/superclix/Bender/trunk $perl script/test.pl D:/projekte/superclix/dmklib/trunk/lib D:/projekte/superclix/Bender/trunk/lib c:/xampp/perl/site/lib c:/xampp/perl/lib . Can't locate object method "new" via package "Bender::Util::Check" (pe +rhaps you forgot to load "Bender::Util::Check"?) at script/t est.pl line 6.
      The offending code looks like this:
      BEGIN{ print join("\n",@INC,''); } use Bender::Util::Check; my $check=new Bender::Util::Check();
      Wolfgang

        Looks to me like your Moose install is broken somehow.

        -stvn
        require 'Moose::Object.pm' does not

        You have a file named 'Moose::Object.pm'? That is crazy, stick with modules

        require Moose::Object;