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

no diagnostic for invalid with

Thread Next
From:
John Macdonald
Date:
April 15, 2014 21:49
Subject:
no diagnostic for invalid with
Message ID:
01EF6156B387B14E8278ECC376793BE18D7827@exmb2.ad.oicr.on.ca
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


Tel:

Email: John.Macdonald@oicr.on.ca

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


www.oicr.on.ca<http://www.oicr.on.ca/>

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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About