Skip Menu |

This queue is for tickets about the Module-Runtime CPAN distribution.

Report information
The Basics
Id: 103370
Status: rejected
Priority: 0/
Queue: Module-Runtime

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

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



Subject: module_notional_filename does not know about the ' separator
Here is a patch: --- Runtime.pm 2015-04-07 17:01:37.000000000 -0700 +++ Runtime-fixed.pm 2015-04-07 17:02:13.000000000 -0700 @@ -263,7 +263,7 @@ sub module_notional_filename($) { &check_module_name; my($name) = @_; - $name =~ s!::!/!g; + $name =~ s!::|'!/!g; return $name.".pm"; }
Not a bug. The module is consistent in not accepting single quote as a segment separator. This is intentional, arising partly from the way the single-quote syntax is translated by the parser into the :: syntax: package names as they exist at runtime always use the :: separator. The module behaviour is documented, and changing it would be incompatible. Changing it for just one function would additionally make that function inconsistent with the rest of the module. -zefram
On 2015-04-07 19:37:32, ZEFRAM wrote: Show quoted text
> Not a bug. The module is consistent in not accepting single quote as > a segment separator. This is intentional, arising partly from the way > the single-quote syntax is translated by the parser into the :: syntax: > package names as they exist at runtime always use the :: separator.
I'm not sure I follow this. Are you saying that if a program is provided a package name with a ' in it, it should do the translation to :: first before passing it to (e.g.) use_module() or require_module()? It appears that package names containing ' are stored in the symbol table that way: use strict; use warnings; { package Foo'Bar; our $VERSION = '0.002'; } print "Foo'Bar::VERSION is $Foo'Bar::VERSION\n"; use Data::Dumper; local $Data::Dumper::Sortkeys = 1; my $package = "Foo'Bar"; no strict 'refs'; print Dumper(\%{"main::${package}::"}); ... shows data in the stash for both main::Foo::Bar:: and main::Foo'Bar:: Show quoted text
> The module behaviour is documented, and changing it would be incompatible.
I didn't see any documentation stating that ' separators were not respected. Which incompatibility do you mean? Show quoted text
> Changing it for just one function would additionally make that function > inconsistent with the rest of the module.
I didn't see any other code here that performs a package-to-file translation (indeed this function abstracts that logic away into a single place); it would have been preferred to point out what was missing than just saying that something was missed. This is obviously an easy fix, notwithstanding anything above.
Subject: Re: [rt.cpan.org #103370] module_notional_filename does not know about the ' separator
Date: Fri, 10 Apr 2015 06:16:41 +0100
To: Karen Etheridge via RT <bug-Module-Runtime [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
Karen Etheridge via RT wrote: Show quoted text
>I'm not sure I follow this. Are you saying that if a program is provided >a package name with a ' in it, it should do the translation to :: first >before passing it to (e.g.) use_module() or require_module()?
That's an implication of not changing the module, but not what I was saying in the bit you quoted. What I was saying there is that a ' separator in actual Perl code gets translated to :: by the parser. For example: $ perl -lwe "print for Foo'Bar" Foo::Bar So the ' separator is more confined to the parser; the :: separator is the one that actually appears in runtime data structures. Show quoted text
>It appears that package names containing ' are stored in the symbol >table that way:
That's interesting. The ' is not actually in the stash data structures at all: the %main:: stash contains a "Foo::" entry, and so on. But ' separators are being accepted in the symbolic reference string; they're handled by parse_gv_stash_name() in the core. I didn't know it did that. Show quoted text
>I didn't see any documentation stating that ' separators were not >respected. Which incompatibility do you mean?
The section of Module::Runtime(1) titled "Module name syntax". Show quoted text
>I didn't see any other code here that performs a package-to-file >translation
The module name syntax is used in other ways. The function is_module_name() checks a string for the documented syntax, and there are public regexps doing the same thing. There are also the module name composition functions around compose_module_name(), which operate on a documented variant of the module name syntax. Show quoted text
>it would have been preferred to point out what was missing than just >saying that something was missed
I wasn't intending for you to make a more extensive patch, and I still wouldn't accept one. But actually I interpreted your request as *intentionally* only affecting the one function. -zefram
On 2015-04-09 22:16:54, zefram@fysh.org wrote: Show quoted text
> So the ' separator is more confined to the parser; the :: separator is > the one that actually appears in runtime data structures. > ... But ' > separators are being accepted in the symbolic reference string; they're > handled by parse_gv_stash_name() in the core. I didn't know it did that.
Aha, these are both very informative points. Show quoted text
> >I didn't see any documentation stating that ' separators were not > >respected. Which incompatibility do you mean?
> The section of Module::Runtime(1) titled "Module name syntax".
Bleh, I don't know how I missed that. Indeed I've read it before, and re-reading it now helps me understand the stance you're taking in the module's implementation. Show quoted text
> I wasn't intending for you to make a more extensive patch, and I > still wouldn't accept one. But actually I interpreted your request as > *intentionally* only affecting the one function.
Right, I think that was the major disconnect that started us down the road of misunderstnding at the beginning. :) thanks again for your reply!