Re: Need "contains" help
On 05/02/2017 10:02 PM, Shrivats wrote: Careful :-) You're actually closing the single quote youstarted with perl6 -e. In other words, this is your Shell's doing. You can execute this as a script with single quote around string literals with no issues Streetcars Mumble. And I did know that. :'( Thank you!
Re: Need "contains" help
On 05/02/2017 10:02 PM, Shrivats wrote: Careful :-) You're actually closing the single quote youstarted with perl6 -e. In other words, this is your Shell's doing. You can execute this as a script with single quote around string literals with no issues Streetcars Mumble. I did know that. Thank you!
Re: Need "contains" help
Careful :-) You're actually closing the single quote youstarted with perl6 -e. In other words, this is your Shell's doing. You can execute this as a script with single quote around string literals with no issues Streetcars On May 3, 2017 10:27, "ToddAndMargo"wrote: > Hi All, > > Why does this work > > $ perl6 -e 'my $x="abcdef"; if $x.contains( "abc" ) { say "yes" } else { > say "no" };' > yes > > > And this does not? > > $ perl6 -e 'my $x="abcdef"; if $x.contains( 'abc' ) { say "yes" } else { > say "no" };' > ===SORRY!=== Error while compiling -e > Undeclared routine: > abc used at line 1. Did you mean 'abs'? > > Why can I not use 'abc' and must use "abc"? > > > Many thanks, > -T > > > -- > > Yesterday it worked. > Today it is not working. > Windows is like that. > >
Need "contains" help
Hi All, Why does this work $ perl6 -e 'my $x="abcdef"; if $x.contains( "abc" ) { say "yes" } else { say "no" };' yes And this does not? $ perl6 -e 'my $x="abcdef"; if $x.contains( 'abc' ) { say "yes" } else { say "no" };' ===SORRY!=== Error while compiling -e Undeclared routine: abc used at line 1. Did you mean 'abs'? Why can I not use 'abc' and must use "abc"? Many thanks, -T -- Yesterday it worked. Today it is not working. Windows is like that.
[perl #131247] [REGRESSION] )> in regex results in stuff being matched wrongly ( /)> . <(/ )
# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev # Please include the string: [perl #131247] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131247 > Code: say "abc" ~~ /)> . <(/ Result (2015.12 … 2017.03): # Result (2017.04.3, HEAD(701dab3)) 「bc」 「bc」 is definitely wrong and # is kinda right. Bisectable points to these two commits: * https://github.com/rakudo/rakudo/commit/5d68f1ff1a8b32570a686bb8151805ba60d98251 * https://github.com/rakudo/rakudo/commit/3cff74cf5ac40e9df4ca45764759d84cc43a0c67 IRC log: https://irclog.perlgeek.de/perl6-dev/2017-05-02#i_14521403
[perl #131244] Baggy/Setty .Str/.gist/.perl needs to guarantee order, like Map/Hash do
# New Ticket Created by Zoffix Znet # Please include the string: [perl #131244] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131244 > https://irclog.perlgeek.de/perl6-dev/2017-05-02#i_14519628 * TimToady notes that .perl and .gist do guarantee sorted order 16:02 Zoffix s: bag(), 'perl', \() 16:02 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/08a8075/src/core/Baggy.pm#L375 16:03 Zoffix Don't look like it 16:03 TimToadythey're supposed to 16:03 Zoffix And if it does, then .Stringy also does, 'cause they're using the same Baggy!LISTIFY method 16:04 TimToadyyou can always iterate a hash yourself if you really want unordered 16:04 sets and bags should follow the same policy 16:05 Zoffix So Hash.Str is guaranteed to be ordered? 16:05 Oh yeah: multi method Str(Map:D:) { self.sort.join("\n") } 16:06 m: use nqp; dd nqp::getattr(Map.new(), Map, '$!storage').^name 16:06 camelia rakudo-moar 08a807: OUTPUT: «"BOOTHash"» 16:07 Zoffix And Baggy takes nqp::iterator() of BOOTHash and just loops over it... I'm guessing that's unordered 16:07 timotimoyeah, that's unordered
Re: Modulino in Perl 6
On Tue, 2 May 2017 17:02:40 +0200 Gabor Szabowrote: > Is there some way in Perl 6 to tell if a file was executed directly or > loaded into memory as a module? One way that seems to work: define a ``sub MAIN``; it will be invoked when you execute the file as a program, but won't be touched if you load it as a module. Example: in file ``/tmp/x/Foo.pm6``:: class Foo { has $.value; } sub MAIN($value) { say Foo.new(:$value).value; } then:: $ perl6 -I /tmp/x -e 'use Foo;say Foo.new(:value(5)).value' 5 $ perl6 /tmp/x/Foo.pm6 Usage: /tmp/x/Foo.pm6 $ perl6 /tmp/x/Foo.pm6 12 12 -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 Leela: You buy one pound of underwear and you're on their list forever.
Re: Modulino in Perl 6
On Tue, May 02, 2017 at 05:02:40PM +0200, Gabor Szabo wrote: : Using the caller() in Perl 5 one can figure out if the file was loaded : as a module or executed as a script. : : In Python one could check if __name__ is equal to "__main__". : : Is there some way in Perl 6 to tell if a file was executed directly or : loaded into memory as a module? : : regards : Gabor If you write a MAIN sub, it should be called only if the file was executed directly. Larry
[perl #131243] [REGEX] Interpolating a Hash in a regex treats it as a list and errors out
# New Ticket Created by Zoffix Znet # Please include the string: [perl #131243] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131243 > Both of these forms produce the error below my %stuff = ; say 'foo bar meows' ~~ m:g/ %stuff\S+ /; say 'foo bar meows' ~~ m:g/ %() \S+ /; # P6opaque: no such attribute '$!reified' in type List when trying to get # a value in block at z2.p6 line 8 What did I expect to happen? No idea, I just randomly tried the code. If it's not meant to work then at least a better error should be shown.
Modulino in Perl 6
Using the caller() in Perl 5 one can figure out if the file was loaded as a module or executed as a script. In Python one could check if __name__ is equal to "__main__". Is there some way in Perl 6 to tell if a file was executed directly or loaded into memory as a module? regards Gabor
Re: [perl #131242] Bug IO::Path method move
Thanks very much Marcel
Re: [perl #131242] Bug IO::Path method move
Thanks very much Marcel
[perl #131242] Bug IO::Path method move
On Tue, 02 May 2017 03:30:44 -0700, mt1...@gmail.com wrote: > With Rakudo version 2017.04.3-66-g7648793 built on MoarVM version > 2017.04-44-gf0db882 > implementing Perl 6.c. on a system (uname -a) Linux h03-fedora > 4.10.11-100.fc24.x86_64 #1 SMP Tue Apr 18 17:25:04 UTC 2017 x86_64 > x86_64 x86_64 GNU/Linux > > I see the following problem > > Moving a file where destination is the same as its source, two things > can happen a) program hangs or b) file is deleted. I would expect an > X::IO::Move exception with a proper message. > > Example.: 'abc.txt'.IO.move('abc.txt'); > > > Regards, > > Marcel Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/08a8075f91 Tests: https://github.com/perl6/roast/commit/4fdb8504cd Docs: https://github.com/perl6/doc/commit/eca21ff851 -- IO grant
[perl #131242] Bug IO::Path method move
On Tue, 02 May 2017 03:30:44 -0700, mt1...@gmail.com wrote: > With Rakudo version 2017.04.3-66-g7648793 built on MoarVM version > 2017.04-44-gf0db882 > implementing Perl 6.c. on a system (uname -a) Linux h03-fedora > 4.10.11-100.fc24.x86_64 #1 SMP Tue Apr 18 17:25:04 UTC 2017 x86_64 > x86_64 x86_64 GNU/Linux > > I see the following problem > > Moving a file where destination is the same as its source, two things > can happen a) program hangs or b) file is deleted. I would expect an > X::IO::Move exception with a proper message. > > Example.: 'abc.txt'.IO.move('abc.txt'); > > > Regards, > > Marcel Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/08a8075f91 Tests: https://github.com/perl6/roast/commit/4fdb8504cd Docs: https://github.com/perl6/doc/commit/eca21ff851 -- IO grant
[perl #131242] Bug IO::Path method move
# New Ticket Created by mt1957 # Please include the string: [perl #131242] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131242 > With Rakudo version 2017.04.3-66-g7648793 built on MoarVM version 2017.04-44-gf0db882 implementing Perl 6.c. on a system (uname -a) Linux h03-fedora 4.10.11-100.fc24.x86_64 #1 SMP Tue Apr 18 17:25:04 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux I see the following problem Moving a file where destination is the same as its source, two things can happen a) program hangs or b) file is deleted. I would expect an X::IO::Move exception with a proper message. Example.: 'abc.txt'.IO.move('abc.txt'); Regards, Marcel
[perl #131238] [LTA] "This type cannot unbox to a native string" when not returning a `Str` from method `gist`
Fair enough.