Re: need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
On 06/03/2018 10:04 AM, ToddAndMargo wrote: Hi All, I need the Perl6 commands for the following LINUX commands. mkdir  make directory chown  change ownership chmod  change file mode bits del    delete file Many thanks, -T Hi All, Today's final Keeper file on IO -T

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
Hi Brandon, I really appreciate all the help you have given me on this! Hi All, As it transpired, I can not do use module.pm6 < xxx yyy >; as it is not yet implemented. Brandon had to suss it out for me. https://rt.perl.org/Public/Bug/Display.html?id=127305 -T

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
"use" does two things, in both perl 5 and perl 6. It loads definitions from a file, and it imports things marked as exported. (The first can be done separately, the same way in both: "require" instead of "use".) Normally you will give a file its own namespace with a "module" (perl 5: "package")

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 06:02 PM, Brandon Allbery wrote: t doesn't affect export at all. It affects what namespace the original name is in. Why would it affect export or import directly? Although if they end up declared in your existing namespace because you didn't include it so it loaded the file in

Re: How to print colorized text to the terminal

2018-06-03 Thread Brent Laabs
You might want to consider using Terminal::ANSIColor. On Sun, Jun 3, 2018 at 5:53 PM, Xin Cheng wrote: > I just tried to use "put" in place of "say", and got the same result. > > Thanks. > > Ziping > > > On Jun 3, 2018, at 8:44 PM, Brandon Allbery wrote: > > "say" uses the .gist method, which

Re: How to print colorized text to the terminal

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 In proper Perl fashion, there's a module for this: https://github.com/tadzik/Terminal-ANSIColor I haven't used it myself, so I'm not sure how well it works, but it's worth a shot at least. On Sun, 3 Jun 2018 20:41:32 -0400 Xin Cheng wrote: > Hi,

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
It doesn't affect export at all. It affects what namespace the original name is in. Why would it affect export or import directly? Although if they end up declared in your existing namespace because you didn't include it so it loaded the file in your current namespace, then no export or import is

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 7:40 PM ToddAndMargo > wrote: >> On Sun, Jun 3, 2018 at 7:17 PM ToddAndMargo mailto:toddandma...@zoho.com> >> >> wrote: >> >> >> On 0>> On Sun,

Re: How to print colorized text to the terminal

2018-06-03 Thread Xin Cheng
I just tried to use "put" in place of "say", and got the same result. Thanks. Ziping > On Jun 3, 2018, at 8:44 PM, Brandon Allbery wrote: > > "say" uses the .gist method, which quotes the output for readability. You > probably want "put" instead. > > On Sun, Jun 3, 2018 at 8:42 PM Xin Cheng

Re: How to print colorized text to the terminal

2018-06-03 Thread Brandon Allbery
"say" uses the .gist method, which quotes the output for readability. You probably want "put" instead. On Sun, Jun 3, 2018 at 8:42 PM Xin Cheng wrote: > Hi, > > I am trying to make a program to do grep with perl6 regular expression, > and I would like to colorize the matched part to the

How to print colorized text to the terminal

2018-06-03 Thread Xin Cheng
Hi, I am trying to make a program to do grep with perl6 regular expression, and I would like to colorize the matched part to the terminal. So the following is what I wrote sub MAIN(Str $pattern,Str $filename){ for $filename.IO.lines -> $line { my Str $temp = $line; if

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
The question you asked was why putting sub RunInTerm in RunInTerm.pm6 did not declare a name RunInTerm::RunInTerm, it only declared a name RunInTerm. You even provided a specific example of this question. If you had a different question in mind, try asking it again. On Sun, Jun 3, 2018 at 7:40

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 04:21 PM, Patrick Spek via perl6-users wrote: No problem! To be precise, -e can be easily remembered from "evaluate" (which I think is also what it actually stands for). Great tip. Thank you! Chuckle, I was thinking "-e" mean "execute", Funny because Perl6 is not a complied

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 7:17 PM ToddAndMargo > wrote: On 0>> On Sun, Jun 3, 2018 at 6:33 PM ToddAndMargo mailto:toddandma...@zoho.com> >> >> wrote: >> >> On 06/03/2018 03:24

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
You have misunderstood. The reason you can do that in Perl 5 is because Term/ANSIColor.pm starts with package Term::ANSIColor; It has nothing to do with what you named the file, it is a matter of namespaces. And Perl 5 and Perl 6 behave mostly the same here (Perl 6 has a few more options).

Re: need second pair of eyes

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 No problem! To be precise, -e can be easily remembered from "evaluate" (which I think is also what it actually stands for). On Sun, 3 Jun 2018 16:08:04 -0700 ToddAndMargo wrote: > On 06/03/2018 03:57 PM, Patrick Spek via perl6-users wrote: > >

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 0>> On Sun, Jun 3, 2018 at 6:33 PM ToddAndMargo > wrote: On 06/03/2018 03:24 PM, Brandon Allbery wrote: > It is allowed if you have 'unit module RunNoShell;' at the top of > RunNoShell.pm6. Otherwise you defined it in the main namespace and

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 03:57 PM, Patrick Spek via perl6-users wrote: It's not that it particularly dislikes it, but you have to think about it in what the options do, and what you want to accomplish. In a regular Perl 6 script, you'd also have to consider the order in which you do a similar thing.

Re: need second pair of eyes

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 It's not that it particularly dislikes it, but you have to think about it in what the options do, and what you want to accomplish. In a regular Perl 6 script, you'd also have to consider the order in which you do a similar thing. First, you need to

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
On Sun, Jun 3, 2018 at 6:33 PM ToddAndMargo wrote: > On 06/03/2018 03:24 PM, Brandon Allbery wrote: > > It is allowed if you have 'unit module RunNoShell;' at the top of > > RunNoShell.pm6. Otherwise you defined it in the main namespace and > > looking for it in the RunNoShell namespace will

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, 3 Jun 2018 15:22:17 - -0700 ToddAndMargo wrote: On 06/03/2018 03:06 PM, Brad Gilbert wrote: It's -I. not -I perl6 -I. -MRunNoShell '( my $a, my $b ) = RunNoShell("ls \*.pm6"); say $a;' Could not open ( my $a, my $b ) = RunNoShell("ls \*.pm6"); say $a;. Failed to stat file: no such

Re: need second pair of eyes

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 You're missing `-e` here, it should be perl6 -I. -MRunNoShell -e '( my $a, my $b ) = RunNoShell("ls \*.pm6"); For further clarification, the `.` after `-I` indicates the directory that is being added to the paths Perl 6 checks for libraries

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 6:22 PM ToddAndMargo > wrote: On 06/03/2018 03:07 PM, Brandon Allbery wrote: > I'm still trying to figure out why you have just "lib" instead of "use > lib" there. And why it's not throwing an error. As poop! I was

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 03:25 PM, Brandon Allbery wrote: What do you think the path is? Do you still think after being told twice that the / is necessary? If you must cargo cult then say -I./ instead of -I.. The default "lib" path for perl 6 does not include this directory. perl6 -I./ -MRunNoShell '(

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
What do you think the path is? Do you still think after being told twice that the / is necessary? If you must cargo cult then say -I./ instead of -I.. On Sun, Jun 3, 2018 at 6:24 PM ToddAndMargo wrote: > >> On Sun, Jun 3, 2018 at 6:06 PM ToddAndMargo >> > wrote: >

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
It is allowed if you have 'unit module RunNoShell;' at the top of RunNoShell.pm6. Otherwise you defined it in the main namespace and looking for it in the RunNoShell namespace will fail. Perl 5 does the same thing fi you omitted 'package RunNoShell;' at the top of RunNoShell.pm. On Sun, Jun 3,

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 6:06 PM ToddAndMargo > wrote: On 06/03/2018 02:54 PM, Brad Gilbert wrote: > You can use q[./] instead of \'./\' > (especially useful so that it will work on both Windows and Unix > > But in this case it is even better

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 03:06 PM, Brad Gilbert wrote: It's -I. not -I perl6 -I. -MRunNoShell '( my $a, my $b ) = RunNoShell("ls \*.pm6"); say $a;' Could not open ( my $a, my $b ) = RunNoShell("ls \*.pm6"); say $a;. Failed to stat file: no such file or directory

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 03:07 PM, Brandon Allbery wrote: I'm still trying to figure out why you have just "lib" instead of "use lib" there. And why it's not throwing an error. As poop! I was mixing Perl 5 and Perl 6. $ p6 'use lib <./>; use RunNoShell; ( my $a, my $b ) = RunNoShell("ls"); say $a;'

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
No, the path is just '.'. The trailing '/' does nothing. (Actually, it will be handled as './.' which is also the same as just '.'.) Trailing slash somehow being required for directories is a bit of shell cargo culting. On Sun, Jun 3, 2018 at 6:06 PM ToddAndMargo wrote: > On 06/03/2018 02:54

Re: need second pair of eyes

2018-06-03 Thread Brad Gilbert
It's -I. not -I On Sun, Jun 3, 2018 at 5:05 PM, ToddAndMargo wrote: > On 06/03/2018 02:54 PM, Brad Gilbert wrote: >> >> You can use q[./] instead of \'./\' >> (especially useful so that it will work on both Windows and Unix >> >> But in this case it is even better to use -I and -M >> >> p6

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
I'm still trying to figure out why you have just "lib" instead of "use lib" there. And why it's not throwing an error. On Sun, Jun 3, 2018 at 6:02 PM ToddAndMargo wrote: > On 06/03/2018 02:50 PM, Brandon Allbery wrote: > > Double quotes, or the one we were just discussing a few minutes ago. > >

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 02:54 PM, Brad Gilbert wrote: You can use q[./] instead of \'./\' (especially useful so that it will work on both Windows and Unix But in this case it is even better to use -I and -M p6 -I. -MRunNoShell -e '( my $a, my $b ) = RunNoShell::RunNoShell("ls *.pm6"); say

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On 06/03/2018 02:50 PM, Brandon Allbery wrote: Double quotes, or the one we were just discussing a few minutes ago.     use lib "./";     use lib <./>; The trailing / doesn't do anything useful there, by the way. On Sun, Jun 3, 2018 at 5:48 PM ToddAndMargo >

Re: need second pair of eyes

2018-06-03 Thread Brad Gilbert
You can use q[./] instead of \'./\' (especially useful so that it will work on both Windows and Unix But in this case it is even better to use -I and -M p6 -I. -MRunNoShell -e '( my $a, my $b ) = RunNoShell::RunNoShell("ls *.pm6"); say $a;' On Sun, Jun 3, 2018 at 4:47 PM,

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
Double quotes, or the one we were just discussing a few minutes ago. use lib "./"; use lib <./>; The trailing / doesn't do anything useful there, by the way. On Sun, Jun 3, 2018 at 5:48 PM ToddAndMargo wrote: > >> On Sun, Jun 3, 2018 at 5:28 PM ToddAndMargo >>

Re: need second pair of eyes

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 5:28 PM ToddAndMargo > wrote: Hi All, What am I doing wrong here? $ p6 'lib \'./\'; use RunNoShell; ( my $a, my $b ) = RunNoShell::RunNoShell("ls *.pm6"); say $a;' bash: syntax error near unexpected token

Re: need second pair of eyes

2018-06-03 Thread Brandon Allbery
bash doesn't like nested single quotes, even with escapes. So the first \' gave you a literal backslash and ended the quoted part, then the second \' gave you a literal ' and continued without quoting. The final ' would then open a new quoted string, but bash doesn't get that far because it sees

need second pair of eyes

2018-06-03 Thread ToddAndMargo
Hi All, What am I doing wrong here? $ p6 'lib \'./\'; use RunNoShell; ( my $a, my $b ) = RunNoShell::RunNoShell("ls *.pm6"); say $a;' bash: syntax error near unexpected token `=' Huh ??? This is RunNoShell.pm6 sub RunNoShell ( $RunString ) is export { ...

Re: Is there a built in recursive rmdir and mkdir?

2018-06-03 Thread ToddAndMargo
On 06/03/2018 01:28 PM, Patrick Spek via perl6-users wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On Sun, 3 Jun 2018 13:13:31 -0700 ToddAndMargo wrote: Does Perl 6 have a built in recursive rmdir equivalent to LINUX's `rmdir --parents path`? For this, there's `rmtree` in the

Re: Is there a built in recursive rmdir and mkdir?

2018-06-03 Thread ToddAndMargo
On 06/03/2018 01:19 PM, Tom Browder wrote: On Sun, Jun 3, 2018 at 3:13 PM, ToddAndMargo wrote: Hi All, Does Perl 6 have a built in recursive rmdir equivalent to LINUX's `rmdir --parents path`? Searching for "rmdir" on the docs site, and selecting the sub rmdir entry, I see the following:

Re: <> question

2018-06-03 Thread ToddAndMargo
On 06/03/2018 01:31 PM, Brad Gilbert wrote: On Sun, Jun 3, 2018 at 3:08 PM, ToddAndMargo > wrote: On 06/03/2018 11:01 AM, Brandon Allbery wrote: Is there something missing in the examples at the link? Well, a bit.  When I see     chmod

Re: <> question

2018-06-03 Thread ToddAndMargo
On 06/03/2018 01:25 PM, Patrick Spek via perl6-users wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 The < > syntax is a bit like qw<> from Perl 5. You'll get a List (or Array, not sure which type exactly from it. So is a list with two elements, "myfile1" and "myfile2". If you

Re: <> question

2018-06-03 Thread ToddAndMargo
On 06/03/2018 01:16 PM, Brandon Allbery wrote: On Sun, Jun 3, 2018 at 4:09 PM ToddAndMargo > wrote: $ touch a b c $ p6 'chmod 0o777 < a b c >;' ===SORRY!=== Error while compiling -e Preceding context expects a term, but found infix > instead. at

Re: <> question

2018-06-03 Thread Brad Gilbert
On Sun, Jun 3, 2018 at 3:08 PM, ToddAndMargo wrote: > On 06/03/2018 11:01 AM, Brandon Allbery wrote: > >> Is there something missing in the examples at the link? >> > > Well, a bit. When I see > > chmod 0o755, ; > > I think `myfile1` and `myfile2` are "functions", not > data. > They

Re: <> question

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 The < > syntax is a bit like qw<> from Perl 5. You'll get a List (or Array, not sure which type exactly from it. So is a list with two elements, "myfile1" and "myfile2". If you want to use a variable, you can just provide it with one or more

Re: Is there a built in recursive rmdir and mkdir?

2018-06-03 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On Sun, 3 Jun 2018 13:13:31 -0700 ToddAndMargo wrote: > Does Perl 6 have a built in recursive rmdir > equivalent to LINUX's `rmdir --parents path`? For this, there's `rmtree` in the `File::Directory::Tree` module. It is referenced in the docs:

Re: Is there a built in recursive rmdir and mkdir?

2018-06-03 Thread Tom Browder
On Sun, Jun 3, 2018 at 3:13 PM, ToddAndMargo wrote: > Hi All, > > Does Perl 6 have a built in recursive rmdir > equivalent to LINUX's `rmdir --parents path`? Searching for "rmdir" on the docs site, and selecting the sub rmdir entry, I see the following: To delete non-empty directory, see

Re: <> question

2018-06-03 Thread Brandon Allbery
On Sun, Jun 3, 2018 at 4:09 PM ToddAndMargo wrote: > $ touch a b c > $ p6 'chmod 0o777 < a b c >;' > ===SORRY!=== Error while compiling -e > Preceding context expects a term, but found infix > instead. > at -e:1 > --> chmod 0o777 < a b c >⏏; > You're missing the comma after the mode

Is there a built in recursive rmdir and mkdir?

2018-06-03 Thread ToddAndMargo
Hi All, Does Perl 6 have a built in recursive rmdir equivalent to LINUX's `rmdir --parents path`? Also, does Perl6 have a built in recursive mkdir equivalent to LINUX's `mkdir --parents path`? Many thanks, -T

Re: <> question

2018-06-03 Thread ToddAndMargo
On 06/03/2018 11:01 AM, Brandon Allbery wrote: Is there something missing in the examples at the link? Well, a bit. When I see chmod 0o755, ; I think `myfile1` and `myfile2` are "functions", not data. I instead look for something like chmod 0o755, < $myfile1 $myfile2 >; or

Re: <> question

2018-06-03 Thread ToddAndMargo
On 06/03/2018 11:01 AM, Brandon Allbery wrote: Is there something missing in the examples at the link? yes, `` is confusing to me. I can't tell is `<>` is an editorial comment or Perl syntax. Is it chmod 0o755, $f1, $f2; or chmod 0o755 <$f1 $f2>; or either?

Re: need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
On 06/03/2018 10:04 AM, ToddAndMargo wrote: Hi All, I need the Perl6 commands for the following LINUX commands. mkdir  make directory chown  change ownership chmod  change file mode bits del    delete file Many thanks, -T Would you mind looking over my notes to see if I

Re: <> question

2018-06-03 Thread Brandon Allbery
Is there something missing in the examples at the link? On Sun, Jun 3, 2018 at 1:48 PM ToddAndMargo wrote: > >> https://docs.perl6.org/language/quoting#Word_quoting:_%3C_%3E > >> > >> On Sun, Jun 3, 2018 at 1:42 PM ToddAndMargo >> > wrote: > >> > >> What is

Re: need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
> On Sun, Jun 3, 2018 at 1:47 PM ToddAndMargo > wrote: > > > Ah poop! Can't find "chown" On 06/03/2018 10:50 AM, Brandon Allbery wrote: I imagine that'e because it's nearly impossible to implement portably: Unix and Windows do different things here. In

Re: need mkdir, chown, chmod, del

2018-06-03 Thread Brandon Allbery
I imagine that'e because it's nearly impossible to implement portably: Unix and Windows do different things here. In particular, Unix chown() also sets the group owner, but Windows has no such concept. On Sun, Jun 3, 2018 at 1:47 PM ToddAndMargo wrote: > On 06/03/2018 10:08 AM, ToddAndMargo

Re: <> question

2018-06-03 Thread ToddAndMargo
https://docs.perl6.org/language/quoting#Word_quoting:_%3C_%3E On Sun, Jun 3, 2018 at 1:42 PM ToddAndMargo > wrote: What is this? https://docs.perl6.org/routine/chmod#role_IO chmod 0o755, ; Is it? chmod 0o755, $file1, $file2 On

Re: need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
On 06/03/2018 10:08 AM, ToddAndMargo wrote: On Sun, Jun 3, 2018 at 1:05 PM ToddAndMargo > wrote:     Hi All,     I need the Perl6 commands for the following LINUX     commands.     mkdir  make directory     chown  change ownership     chmod  change

Re: <> question

2018-06-03 Thread Brandon Allbery
Yes, it's a quick way to mak a list of quoted strings. Think qw() in perl 5, but < > is equivalent to single quotes whereas << >> is equivalent to double quotes. https://docs.perl6.org/language/quoting#Word_quoting:_%3C_%3E On Sun, Jun 3, 2018 at 1:42 PM ToddAndMargo wrote: > What is this? > >

<> question

2018-06-03 Thread ToddAndMargo
What is this? https://docs.perl6.org/routine/chmod#role_IO chmod 0o755, ; Is it? chmod 0o755, $file1, $file2

Re: need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 1:05 PM ToddAndMargo > wrote: Hi All, I need the Perl6 commands for the following LINUX commands. mkdir make directory chown change ownership chmod change file mode bits deldelete file

Re: need mkdir, chown, chmod, del

2018-06-03 Thread Brandon Allbery
Same answer: https://docs.perl6.org/type/IO::Path is where all the path-related things live. On Sun, Jun 3, 2018 at 1:05 PM ToddAndMargo wrote: > Hi All, > > I need the Perl6 commands for the following LINUX > commands. > > mkdir make directory > chown change ownership > chmod

Re: IO ???

2018-06-03 Thread ToddAndMargo
On Sun, Jun 3, 2018 at 1:01 PM ToddAndMargo > wrote: Hi All, I have a been looking around the docs pages and I am not finding a list of what the various IO functions do. I would like a list of IO.e does this and IO.d does that. Any such

need mkdir, chown, chmod, del

2018-06-03 Thread ToddAndMargo
Hi All, I need the Perl6 commands for the following LINUX commands. mkdir make directory chown change ownership chmod change file mode bits deldelete file Many thanks, -T -- ~~ Computers are like air conditioners. They malfunction

Re: IO ???

2018-06-03 Thread Brandon Allbery
It's a bit subtle to track down, but the IO method gives you an IO::Path object. https://docs.perl6.org/type/IO::Path On Sun, Jun 3, 2018 at 1:01 PM ToddAndMargo wrote: > Hi All, > > I have a been looking around the docs pages and I am > not finding a list of what the various IO functions do. >

IO ???

2018-06-03 Thread ToddAndMargo
Hi All, I have a been looking around the docs pages and I am not finding a list of what the various IO functions do. I would like a list of IO.e does this and IO.d does that. Any such list exist? Many thanks, -T -- ~~ Computers are like air conditioners.