Re: Fwd: Re: Variables in modules
Since $?FILE in modules is being discussed I'll just leave this RT here: https://rt.perl.org/Public/Bug/Display.html?id=128442 On Thu, Mar 16, 2017 at 4:50 AM JuhiMarcel LangbroekTimmerman < mt195...@gmail.com> wrote: > In the perl doc of IO, IO::Path etc. The type is $?File.IO.WHAT to search > for. > > Or $?File.IO.^methods but that is only a list of methods. > > > Marcel > > > On March 13, 2017 23:29:15 ToddAndMargo wrote: > > >> > >> > >> On March 10, 2017 10:32:43 PM Theo van den Heuvel > >> wrote: > >> > >>> Not with me it doesn't. > >>> > >>> my $TheValue = $?FILE.subst(/.* "/"/, "", :g); > >>> sub sayfn is export { $TheValue.say } > >>> > >>> Could something else be wrong here? > >>> > >>> cheers, > >>> Theo > >>> > >>> ToddAndMargo schreef op 2017-03-10 22:10: > On 03/10/2017 09:53 AM, Timo Paulssen wrote: > > I don't quite understand what's wrong with just > > > > my $TheValue = $?FILE.subst(/.* "/"/, "" :g); > > > > near the top of your module? > > > > Hi Timo, > > Because it gives you "Use of uninitialized value $TheValue" > when you go to use it inside one of the "is export" subs > > :'( > > Many thanks, > -T > > > > On 03/13/2017 02:01 AM, JuhiMarcel LangbroekTimmerman wrote: > > > now we are at it, for readability perhaps instead of substitutes do, > > > > > > my $thevalue = $?FILE.IO.basename; > > > > > > Marcel > > > > > > Hi Marcel, > > > > Sweet. Thank you! > > > > Is there a list somewhere of all the tings I can tack onto the > > $?FILE variable? > > > > perl6 -e 'say $?FILE.perl;' > > > > Didn't work > > > > -T > > > > -- > > ~~ > > Computers are like air conditioners. > > They malfunction when you open windows > > ~~ >
Re: Fwd: Re: Variables in modules
In the perl doc of IO, IO::Path etc. The type is $?File.IO.WHAT to search for. Or $?File.IO.^methods but that is only a list of methods. Marcel On March 13, 2017 23:29:15 ToddAndMargo wrote: On March 10, 2017 10:32:43 PM Theo van den Heuvel wrote: Not with me it doesn't. my $TheValue = $?FILE.subst(/.* "/"/, "", :g); sub sayfn is export { $TheValue.say } Could something else be wrong here? cheers, Theo ToddAndMargo schreef op 2017-03-10 22:10: On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T On 03/13/2017 02:01 AM, JuhiMarcel LangbroekTimmerman wrote: > now we are at it, for readability perhaps instead of substitutes do, > > my $thevalue = $?FILE.IO.basename; > > Marcel Hi Marcel, Sweet. Thank you! Is there a list somewhere of all the tings I can tack onto the $?FILE variable? perl6 -e 'say $?FILE.perl;' Didn't work -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: Fwd: Re: Variables in modules
On March 10, 2017 10:32:43 PM Theo van den Heuvel wrote: Not with me it doesn't. my $TheValue = $?FILE.subst(/.* "/"/, "", :g); sub sayfn is export { $TheValue.say } Could something else be wrong here? cheers, Theo ToddAndMargo schreef op 2017-03-10 22:10: On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T On 03/13/2017 02:01 AM, JuhiMarcel LangbroekTimmerman wrote: > now we are at it, for readability perhaps instead of substitutes do, > > my $thevalue = $?FILE.IO.basename; > > Marcel Hi Marcel, Sweet. Thank you! Is there a list somewhere of all the tings I can tack onto the $?FILE variable? perl6 -e 'say $?FILE.perl;' Didn't work -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: Fwd: Re: Variables in modules
now we are at it, for readability perhaps instead of substitutes do, my $thevalue = $?FILE.IO.basename; Marcel On March 10, 2017 10:32:43 PM Theo van den Heuvel wrote: Not with me it doesn't. my $TheValue = $?FILE.subst(/.* "/"/, "", :g); sub sayfn is export { $TheValue.say } Could something else be wrong here? cheers, Theo ToddAndMargo schreef op 2017-03-10 22:10: On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T
Re: Fwd: Re: Variables in modules
Hm. How does it do with "sub sayfn" commented out? On 03/10/2017 04:02 PM, Theo van den Heuvel wrote: > Todd, > > Apparently I don't understand your intentions. You said you wanted > constants globally available in your module. > Don't you want to use those constants? If so, how? > Only inside the module, not exported. And I did find a workaround so the global stuff is only used when needed, not all the time. -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: Fwd: Re: Variables in modules
Todd, Apparently I don't understand your intentions. You said you wanted constants globally available in your module. Don't you want to use those constants? If so, how? Hm. How does it do with "sub sayfn" commented out? -- Theo van den Heuvel Van den Heuvel HLT Consultancy
Re: Fwd: Re: Variables in modules
ToddAndMargo schreef op 2017-03-10 22:10: On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T On 03/10/2017 01:32 PM, Theo van den Heuvel wrote: > Not with me it doesn't. > > my $TheValue = $?FILE.subst(/.* "/"/, "", :g); > sub sayfn is export { $TheValue.say } > > Could something else be wrong here? > > cheers, > Theo > Hm. How does it do with "sub sayfn" commented out? -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: Fwd: Re: Variables in modules
Not with me it doesn't. my $TheValue = $?FILE.subst(/.* "/"/, "", :g); sub sayfn is export { $TheValue.say } Could something else be wrong here? cheers, Theo ToddAndMargo schreef op 2017-03-10 22:10: On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T
Re: Fwd: Re: Variables in modules
On 03/10/2017 09:53 AM, Timo Paulssen wrote: I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module? Hi Timo, Because it gives you "Use of uninitialized value $TheValue" when you go to use it inside one of the "is export" subs :'( Many thanks, -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Re: Fwd: Re: Variables in modules
I don't quite understand what's wrong with just my $TheValue = $?FILE.subst(/.* "/"/, "" :g); near the top of your module?
Re: Fwd: Re: Variables in modules
On 03/09/2017 02:22 PM, Theo van den Heuvel wrote: Is this what you are looking for? our $IAm is export; ( $IAm = $?FILE ) ~~ s|.*"/"||; Hi Theo, Almost. I only want the code inside the module (pm) to see it. I don't want it exported. On the other hand, you just taught me h9owto export a value. Thank you! -T
Fwd: Re: Variables in modules
Is this what you are looking for? our $IAm is export; ( $IAm = $?FILE ) ~~ s|.*"/"||; -- Theo van den Heuvel Van den Heuvel HLT Consultancy