Re: Hash and subs question

2017-09-28 Thread ToddAndMargo
On 09/28/2017 08:56 PM, Brandon Allbery wrote: On Thu, Sep 28, 2017 at 11:52 PM, ToddAndMargo > wrote: I see that SayHash(%H) will take any hash I send it. Is there a way to make the compiler pissed if a sub does not see the

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo wrote: > Figured it out. The chat line told me that there is an error in the > docs. The proper way was "e" not "f" > This is not the same thing. .e will return True if it exists but is a directory, for example. I mentioned

Re: Hash and subs question

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:05 AM, ToddAndMargo wrote: > sub all-dimensions(% (:length(:$x), :width(:$y), :depth(:$z))) { > $x andthen $y andthen $z andthen True > } > > it turn my hash into single variables. Is there a way to > test if the right keys are present and

Re: -f ???

2017-09-28 Thread Norman Gaywood
On 29 September 2017 at 15:10, Brandon Allbery wrote: > > (And, Norman? It produces a Failure, not a hard exception. You can > introspect Failures to keep them from getting thrown.) > Yep, that's what I thought I'd said :-) Obviously not clearly. Another way of looking at

how do I assign an array to a hash key

2017-09-28 Thread ToddAndMargo
Hi All, I am creating a hash. One of the keys I want to point to an array, not a string. I have created a test: $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for @(%x) {say $_};' {aaa => x, b => [y q r], c => z} y q r This seems too easy. I have to have done

Re: how do I assign an array to a hash key

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:47 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:44 AM, ToddAndMargo > wrote: I will probably use the @ for a while until I get use to it for readability. I think that's actually disrecommended, because it

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 10:12 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo > wrote: Figured it out.  The chat line told me that there is an error in the docs.  The proper way was "e" not "f" This is not the same

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 10:31 PM, ToddAndMargo wrote: On 09/28/2017 10:19 PM, ToddAndMargo wrote: On 09/28/2017 10:12 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo > wrote:     Figured it out.  The chat line told me that

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:53 PM, ToddAndMargo wrote: On 09/28/2017 09:45 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo > wrote:     Does perl 6 have an equivalent to bash's "-f" to     see if a file exists?  Or is that a

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:45 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo > wrote: Does perl 6 have an equivalent to bash's "-f" to see if a file exists?  Or is that a system call? IO::Path's .f method. (Or .e

Re: how do I assign an array to a hash key

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:44 AM, ToddAndMargo wrote: > I will probably use the @ for a while until I get use to > it for readability. > I think that's actually disrecommended, because it looks too much like Perl 5's refs but isn't, so it can bite you unexpectedly if you

Re: -f ???

2017-09-28 Thread ToddAndMargo
On 09/28/2017 10:19 PM, ToddAndMargo wrote: On 09/28/2017 10:12 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo > wrote:     Figured it out.  The chat line told me that there is an error in the     docs.  The proper

Re: how do I assign an array to a hash key

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:32 AM, ToddAndMargo wrote: > $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for > @(%x) {say $_};' > {aaa => x, b => [y q r], c => z} > y > q > r > > This seems too easy. I have to have done something wrong. > What did I

Re: Hash and subs question

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:11 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:05 AM, ToddAndMargo > wrote: sub all-dimensions(% (:length(:$x), :width(:$y), :depth(:$z))) {     $x andthen $y andthen $z andthen True } it turn my

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:06 AM, Brandon Allbery wrote: > On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo > wrote: > >> On 09/28/2017 09:53 PM, ToddAndMargo wrote: >> >>> On 09/28/2017 09:45 PM, Brandon Allbery wrote: >>> IO::Path's .f method. (Or

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo wrote: > On 09/28/2017 09:53 PM, ToddAndMargo wrote: > >> On 09/28/2017 09:45 PM, Brandon Allbery wrote: >> >>> IO::Path's .f method. (Or .e to not require it to be a file, etc. as >>> usual.) >>> >>> pyanfar Z$ 6

Re: -f ???

2017-09-28 Thread Norman Gaywood
I was just reading about this! On 29 September 2017 at 14:53, ToddAndMargo wrote: > > $ perl6 -e 'say "erasxeme.txt".IO.f;' > Failed to find '/home/linuxutil/erasxeme.txt' while trying to do '.f' > in block at -e line 1 > When you do: "erasxeme.txt".IO.f It will

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:10 AM, Brandon Allbery wrote: > Apparently not a bug, just unfortunate. You have to explicitly coerce it > to Bool to keep it from throwing. > > pyanfar Z$ 6 '".profileX".IO.f.Bool.say' > False > This can also be done with 'so' or prefix

-f ???

2017-09-28 Thread ToddAndMargo
Hi All, Does perl 6 have an equivalent to bash's "-f" to see if a file exists? Or is that a system call? Many thanks, -T

Re: how do I assign an array to a hash key

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:32 PM, ToddAndMargo wrote: Hi All, I am creating a hash.  One of the keys I want to point to an array, not a string. I have created a test: $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for @(%x) {say $_};' {aaa => x, b => [y q r], c => z} y q r This

Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo wrote: > Does perl 6 have an equivalent to bash's "-f" to > see if a file exists? Or is that a system call? > IO::Path's .f method. (Or .e to not require it to be a file, etc. as usual.) pyanfar Z$ 6

Re: how do I assign an array to a hash key

2017-09-28 Thread ToddAndMargo
On 09/28/2017 09:43 PM, Brandon Allbery wrote: On Fri, Sep 29, 2017 at 12:32 AM, ToddAndMargo > wrote: $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for @(%x) {say $_};' {aaa => x, b => [y q r], c => z}

Re: chown?

2017-09-28 Thread Brandon Allbery
On Thu, Sep 28, 2017 at 11:15 PM, ToddAndMargo wrote: > I wonder why they did not "banish" (sound so harsh) chmod? > Basic file permissions are actually relatively similar. Windows (and OS X! see chmod(1)) integrate ACL support, but there's still a reasonably common core

Hash and subs question

2017-09-28 Thread ToddAndMargo
Hi All, Looking at this test I threw together; $ perl6 -e 'sub SayHash(%H) {say %H}; my %x = [aaa => "x", b=>"y", c=>"z"];SayHash(%x);' {aaa => x, b => y, c => z} I see that SayHash(%H) will take any hash I send it. Is there a way to make the compiler pissed if a sub does not see the

Re: Hash and subs question

2017-09-28 Thread Brandon Allbery
On Thu, Sep 28, 2017 at 11:52 PM, ToddAndMargo wrote: > I see that SayHash(%H) will take any hash I send it. > > Is there a way to make the compiler pissed if a sub does not see > the specific keys int he hash it wants? Or do I need to use loop > with ":exists" and test

Need MIME syntax help

2017-09-28 Thread ToddAndMargo
Hi All, This piece of code works: my $email = Email::MIME.create( header-str => [from => $from, to => @to, subject => $Subject ], parts => [ Email::MIME.create( header => [ content-transfer-encoding =>

Re: Hash and subs question

2017-09-28 Thread ToddAndMargo
On 09/28/2017 08:56 PM, Brandon Allbery wrote: On Thu, Sep 28, 2017 at 11:52 PM, ToddAndMargo > wrote: I see that SayHash(%H) will take any hash I send it. Is there a way to make the compiler pissed if a sub does not see the

Re: Why can't I "write"?

2017-09-28 Thread ToddAndMargo
On 09/23/2017 12:05 AM, Brent Laabs wrote: OK, a method is something you call on an object, using a the dot operator.  A subroutine is an independent object installed into your current lexical scope. If write was a sub, it would work exactly as you described:    48:   my $Handle = open(

Re: chown?

2017-09-28 Thread ToddAndMargo
On 09/28/2017 08:08 PM, Brandon Allbery wrote: On Thu, Sep 28, 2017 at 11:03 PM, ToddAndMargo > wrote: https://docs.perl6.org/language/5to6-perlfunc#chown say we ain't got a