# New Ticket Created by  Timothy Totten 
# Please include the string:  [perl #76518]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=76518 >


Say you have a module file called Greetings.pm6 that contains:

use v6;
module Greetings {
  sub hello($name='World') {
    say "Hello $name";
  }
}

If you were to do: perl6 -e 'use Greetings; hello("moon");'
It would appropriately print "Hello moon";

If you were to go into the REPL, you will find some more mysterious
behavior:

> use Greetings; hello('Moon');
Hello Moon
> hello()
Could not find sub &hello

A new session:

> use Greetings;
> hello()
Could not find sub &hello
> use Greetings;
P
> hello()
Hello World

It seems that any module that exports a subroutine, does not have the
subroutine exported in the REPL unless you call the 'use' statement twice.

You can test this with a module included with Rakudo:

> use DateTime::strftime;
> strftime('%A', DateTime.now)
Could not find sub &strftime
> use DateTime::strftime;
P
> strftime('%A', DateTime.now)
Thursday

I am assuming this behavior is a bug and is not expected.

Reply via email to