Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 86940
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: MAUKE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.1001
Fixed in: (no value)



Subject: 'extends' sometimes tries to load modules
The documentation for 'extends' says: | extends (@superclasses) | | This function will set the superclass(es) for the current class. What it doesn't say: In addition to setting up inheritance, in some cases[1] it tries to load corresponding modules from disk first. I find this behavior surprising and it doesn't seem to be documented anywhere. I think this behavior should be documented (or alternatively removed). [1] exact logic hard to describe; see sub _is_class_loaded in Class::Load::PP
Subject: Re: [rt.cpan.org #86940] 'extends' sometimes tries to load modules
Date: Mon, 15 Jul 2013 09:13:46 -0400
To: Lukas Mai via RT <bug-Moose [...] rt.cpan.org>
From: Jesse Luehrs <doy [...] tozt.net>
On Mon, Jul 15, 2013 at 06:07:50AM -0400, Lukas Mai via RT wrote: Show quoted text
> Mon Jul 15 06:07:49 2013: Request 86940 was acted upon. > Transaction: Ticket created by MAUKE > Queue: Moose > Subject: 'extends' sometimes tries to load modules > Broken in: 2.1001 > Severity: (no value) > Owner: Nobody > Requestors: MAUKE@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86940 > > > > The documentation for 'extends' says: > > | extends (@superclasses) > | > | This function will set the superclass(es) for the current class. > > What it doesn't say: In addition to setting up inheritance, in some > cases[1] it tries to load corresponding modules from disk first. I > find this behavior surprising and it doesn't seem to be documented > anywhere. I think this behavior should be documented (or alternatively > removed). > > [1] exact logic hard to describe; see sub _is_class_loaded in > Class::Load::PP
Why is this surprising? 'use base' and 'use parent' both work the same way. Noting this in the documentation probably wouldn't be a bad idea though. -doy
On Mon Jul 15 09:14:02 2013, doy@tozt.net wrote: Show quoted text
> On Mon, Jul 15, 2013 at 06:07:50AM -0400, Lukas Mai via RT wrote:
> > The documentation for 'extends' says: > > > > | extends (@superclasses) > > | > > | This function will set the superclass(es) for the current class. > > > > What it doesn't say: In addition to setting up inheritance, in some > > cases[1] it tries to load corresponding modules from disk first. I > > find this behavior surprising and it doesn't seem to be documented > > anywhere. I think this behavior should be documented (or alternatively > > removed). > > > > [1] exact logic hard to describe; see sub _is_class_loaded in > > Class::Load::PP
> > Why is this surprising? 'use base' and 'use parent' both work the same > way. Noting this in the documentation probably wouldn't be a bad idea > though.
It's surprising because 'extends' is not described as being like base/parent; it's described as setting superclasses, which I understand to be like '@ISA = ...'. The documentation for base/parent says: "Allows you to both load one or more modules, while setting up inheritance from those modules at the same time." ... i.e. it emphasizes the module loading part that 'extends' doesn't even mention.
This is patched in HEAD.