Skip Menu |

This queue is for tickets about the MooseX-ModifyTaggedMethods CPAN distribution.

Report information
The Basics
Id: 82771
Status: resolved
Priority: 0/
Queue: MooseX-ModifyTaggedMethods

People
Owner: perl [...] toby.ink
Requestors: arfreitas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.001
Fixed in: (no value)



Subject: cannot apply after method modifier in Moose classes
Greetings, Hope you remember my question at the Perl monks website. :-) Following your suggestion, I'm trying to use MooseX-ModifyTaggedMethods into a new project of mine, but seems to be it is not working as expected. Instead of attaching the all code that I used for testing, please refer to http://code.google.com/p/siebel-com/source/browse/#svn%2Ftags%2FMooseX-ModifyTaggedMethods (you want to start from Siebel::COM since it is the only Moose::Role that I'm using). I intend to publish this distribution at CPAN as soon as I get it working. The attached file is the test by itself. I forced an error by using a wrong set of user/password. With that, I should get an error from line 38, which is not happening. Here is what I got: C:\COM+>test.pl 4096 Attribute (_ole) does not pass the type constraint because: Validation failed for 'Win32::OLE' with value undef at constructor Siebel::COM::Business::Component::new (defined at C:/ Perl/site/lib/Siebel/COM/Business/Component.pm line 75) line 31. Siebel::COM::Business::Component::new('Siebel::COM::Business::Component', 'HASH(0x248001c)') called at C:/Perl/site/lib/Siebel/COM/Business/Object.pm line 17 Siebel::COM::Business::Object::get_bus_comp('Siebel::COM::Business::Object=HASH(0x248127c)', 'Contact') called at C:\Users\slh2170\Documents\Data Load\COM+\test.pl line 44 eval {...} called at C:\Users\slh2170\Documents\Data Load\COM+\test.pl line 25 ...propagated at C:\Users\slh2170\Documents\Data Load\COM+\test.pl line 78. Moose raises an error because the program could not give a proper Win32::OLE object since the login method failed (silently). Beware that the expected return code should be zero for not raising any error. I tried to debug MooseX::ModifyTaggedMethods but I could not set a break at methods_tagged function (probably I'm doing something wrong). I choosed to make changes directly to the file ModifyTaggedMethods.pm and add some debugging messages, and what I got is that the $klass variable is getting nothing (but $name has "SiebelAPICheck"). If I comment the lines that refer to return an anonymous sub, this is what I got: C:\COM+>test.pl Can't call method "find_method_by_name" on an undefined value at C:/Perl/site/lib/MooseX/ModifyTaggedMethods.pm line 48. Compilation failed in require at C:/Perl/lib/Module/Runtime.pm line 317. at C:/Perl/lib/Moose.pm line 67. Compilation failed in require at C:/Perl/lib/Module/Runtime.pm line 317. at C:/Perl/lib/Moose.pm line 63. Compilation failed in require at C:/Perl/site/lib/Siebel/COM/Business/Object.pm line 7. BEGIN failed--compilation aborted at C:/Perl/site/lib/Siebel/COM/Business/Object.pm line 7. Compilation failed in require at C:/Perl/site/lib/Siebel/COM/App.pm line 10. BEGIN failed--compilation aborted at C:/Perl/site/lib/Siebel/COM/App.pm line 10. Compilation failed in require at C:/Perl/lib/Module/Runtime.pm line 317. at C:/Perl/lib/Moose.pm line 63. Compilation failed in require at C:\Users\slh2170\Documents\Data Load\COM+\test.pl line 3. BEGIN failed--compilation aborted at C:\Users\slh2170\Documents\Data Load\COM+\test.pl line 3. Sub::Talisman seems to be working fine since during debugging sessions I can get it mapping the subs attributes correctly. I'm using Windows 7 Enterprise with Service Pack 1. This is the Perl distribution I'm using: C:\Users\slh2170\Documents\Data Load\COM+>perl -v This is perl 5, version 16, subversion 1 (v5.16.1) built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2012, Larry Wall Binary build 1601 [296175] provided by ActiveState http://www.ActiveState.com Built Aug 30 2012 20:08:55 I was able to install MooseX-ModifyTaggedMethods from a PPM package, but I also tried to install it from CPAN (forcing a test) and got nothing wrong from it. I'm not aware how to work with Moose MOP to debug further your code, but please let me know if you need help for testing.
Subject: test.pl
use strict; use warnings; use Siebel::COM::App::DataServer; use feature 'say'; my $schema = { 'Contact' => [ 'Birth Date', 'Created', 'Created By Name', 'Email Address', 'Fax Phone #', 'First Name', 'Id', 'Job Title', 'Last Name', 'Updated', 'Updated By Name', 'Work Phone #' ] }; my $sa; eval { $sa = Siebel::COM::App::DataServer->new( { cfg => 'C:/Siebel/8.1/Client_1/BIN/ptb/scomm.cfg', data_source => 'ServerDataSrcDEV', user => 'sadmin', password => 'sadmin1' } ); my ( $bo, $bc, $key, $field, $moreResults ); $sa->login(); say $sa->get_return_code(); foreach $key ( keys(%$schema) ) { $bo = $sa->get_bus_object($key); $bc = $bo->get_bus_comp($key); foreach $field ( @{ $schema->{$key} } ) { $bc->activate_field($field); } $bc->clear_query(); $bc->query(); $moreResults = $bc->first_record(); while ($moreResults) { printf("-----\n"); foreach $field ( @{ $schema->{$key} } ) { printf( "%40s: %s\n", $field, $bc->get_field_value($field) ); } $moreResults = $bc->next_record(); } } }; if ($@) { die $sa->get_last_error() if ( defined($sa) ); }
I've added a test case for the "after" method modifier. I don't have a Windows machine to test this on, and without a cross-platform test case that exhibits this problem, there's not much more I can do.
I've added a test case similar to the code shown here, and it is passing on Windows. It's been over a year since I've heard anything on this topic, so I'm assuming it is resolved.