Skip Menu |
Report information
Id: 123541
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Presence of a DBIish.connect call in an INIT block in a module causes exports not to work from the module in Rakudo
Date: Sun, 4 Jan 2015 14:47:10 +0100
From: Carl Mäsak <cmasak [...] gmail.com>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 708b
$ perl6 -v This is perl6 version 2014.12-86-g43b724e built on MoarVM version 2014.12 $ cat M.pm use v6; use DBIish; module M { INIT { # A DBIish.connect("SQLite", :database<db>, :RaiseError); # B } # A our sub x() is export { say "OH HAI"; } } $ perl6 -I. -e'use M; x()' ===SORRY!=== Error while compiling -e Undeclared routine: x used at line 1 ... This is not what I expected. I expected it to print "OH HAI". Furthermore, remove the two lines marked "A", and it works as expected. Remove the line marked "B" and it works. My best guess, for what it's worth, is that the method call in the INIT block is interfering with the normal exporting from the module.
Date: Sun, 4 Jan 2015 15:33:05 +0100
Subject: Re: [perl #123541] Presence of a DBIish.connect call in an INIT block in a module causes exports not to work from the module in Rakudo
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
Show quoted text
> On 04 Jan 2015, at 14:47, Carl Mäsak (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by "Carl Mäsak" > # Please include the string: [perl #123541] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=123541 > > > > $ perl6 -v > This is perl6 version 2014.12-86-g43b724e built on MoarVM version 2014.12 > > $ cat M.pm > use v6; > use DBIish; > > module M { > INIT { # A > DBIish.connect("SQLite", :database<db>, :RaiseError); # B > } # A > > our sub x() is export { > say "OH HAI"; > } > } > > $ perl6 -I. -e'use M; x()' > ===SORRY!=== Error while compiling -e > Undeclared routine: > x used at line 1 > > ... > > This is not what I expected. I expected it to print "OH HAI". > > Furthermore, remove the two lines marked "A", and it works as > expected. Remove the line marked "B" and it works. > > My best guess, for what it's worth, is that the method call in the > INIT block is interfering with the normal exporting from the module.
use v6; use Test; module M { INIT { say <a b c>.Set; } our sub x is export { say "x" } } This works without any problem. I would concur that it is not just any method call, but something specific to DBIish.connect; Liz


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org