RE: no diagnostic for invalid with

[email protected] (John Macdonald) Tue, 15 Apr 2014 22:51:58 +0000
Newsgroups perl.moose
Message-ID <[email protected]>
Never mind.  I had the definition of the Moose object in the same file as the test, and it was after the test, so it wasn't being fully compiled.  Moving the Moose package to the front of the file before using it now does give useful diagnostics.

Mea culpa.


John Macdonald
Software Engineer

Ontario Institute for Cancer Research
MaRS Centre

661 University Avenue

Suite 510
Toronto, Ontario

Canada M5G 0A3


Tel:

Email: [email protected]

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.

________________________________
From: John Macdonald [[email protected]]
Sent: April 15, 2014 5:49 PM
To: [email protected]
Subject: no diagnostic for invalid with

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: [email protected]

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.