develooper Front page | perl.moose | Postings from April 2014

no diagnostic for invalid with

Thread Next
John Macdonald
April 15, 2014 21:49
no diagnostic for invalid with
Message ID:
With the locally installed version of Moose (2.1404) I get no error or warning if I use the with method but specify an unloaded package as the role name.  I had simply omitted the "use My::Role" before trying to specify a class and define it using "with'My::Role'".  The class compiled and executed without any error, giving no complaint until I actually tried to use a method that was provided by the role and the method was not found.

Is there some important benefit in having with accept a role name that does not exist?  I took a long time to find my problem because the with was "obviously" succeeding without error in linking to my role, so I was tracking through all sorts of later stages until I worked my way back to this root cause.  If there is some value in specifying a role that has no content, perhaps there could be some syntactic designation for such cases, so that an error message could be issued for a role that *is* expected to supported by a package when no package is found to provide that role.

John Macdonald
Software Engineer

Ontario Institute for Cancer Research
MaRS Centre

661 University Avenue

Suite 510
Toronto, Ontario

Canada M5G 0A3



Toll-free: 1-866-678-6427
Twitter: @OICR_news<>

This message and any attachments may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this message in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this message may not be that of the organization.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About