Re: overwrite?

2017-09-25 Thread ToddAndMargo

On 09/25/2017 09:42 AM, Parrot Raiser wrote:

Have you considered simply "touch"ing the file? That updates the timestamp.



yes.

The way I actually did it forced me to (keep) learn(ing)
how to write and read to files.

A lot of the things I do, I do the hard way so that I am
forced to learn.

I can not do s/ and m/ and if ( $x ~~~/xxx/ ) without having
to look at a reference.  Yippee!  I think.  maybe.



Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 10:49 PM, ToddAndMargo 
wrote:

> There is another operating system other than Linux?  I
> had heard rumors of that: it is slow, expensive, crashes
> all the time.  But I thought is was only a story to frighten
> little children and young programmers.   SAY IT ISN'T
> TRUE!!!   :-)
>

Please don't insult FreeBSD like that. :p

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

O> On Mon, Sep 25, 2017 at 10:19 AM, Brandon Allbery > wrote:

On Mon, Sep 25, 2017 at 3:09 AM, Julien Simonet
> wrote:

I think your problem is coming from a (") missing at line 3.
At the same line, the semicolon (;) is misplaced : it should be
at the end if line.


It took older perl over a decade to come up with better error
messages for this. Can we please do it a bit sooner?


On 09/25/2017 07:25 AM, Brandon Allbery wrote:
So as to make this not entirely content-free: I would suggest that the 
string language note the line on which it sees a bare newline, and if it 
subsequently hits a syntax error while still parsing that string it 
could output something like perl 5's "Possible runaway multi-line string 
starting on line ..." as a suggestion.




Usually, when I get an error message, I go straight to the error line
to see if I can figure it out myself.  Sort of a brain game.

If I can't figure it out on my own, then I read the error message.

If the error messages makes no sense, like the one I saw
here -- "Variable '$IAmFrom' is not declared " when it
actually was -- then I go the last line I actually worked on
and work backwards until I find what I forget or booboo'ed.
It can be miserable to find a missing quote or curly bracket.

Geary color codes things pretty well, but not so much on the
curly brackets: it will show you the matching opening bracket
in a dark blue that is pretty hard to tell apart from the
native black.  (I use Geany as it works over "ssh -X" really
well.)

If I have missed a quote, sometimes the error message is hundreds
of line below the booboo and a lot of times at the end of the file.

And sometimes I just need an extra pair of eyes.  Thank you guys!

:-)

-T


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

On 09/25/2017 06:39 AM, Timo Paulssen wrote:



Second itteration:


#!/usr/bin/env perl6

say "Full file name <$?FILE>";

my $IAm;
my $IAmFrom;

$?FILE ~~ m|(.*\/)(.*)|;
$IAmFrom = $0;
$IAm = $1;
say "IAm    <$IAm>";
say "IAmFrom    <$IAmFrom>";



Please don't use string functions on paths; doing it like this is liable
to break when used on another OS like windows where paths are separated
with \ instead of /

What you're doing here is exactly what .IO.basename and .IO.dirname are for.

     https://docs.perl6.org/type/IO::Path#method_basename
     https://docs.perl6.org/type/IO::Path#method_dirname




Hi Timo,

There is another operating system other than Linux?  I
had heard rumors of that: it is slow, expensive, crashes
all the time.  But I thought is was only a story to frighten
little children and young programmers.   SAY IT ISN'T
TRUE!!!   :-)

The misunderstanding on what was an exercise on me learning subs
and matches, turned into a wonderful example for my keepers file
on OS name and path.  Thank you!

Oh ya, and your method doesn't comes out with that annoying "/./"!

-T

This is my keeper file:


perl 6: program name and path:


https://docs.perl6.org/type/IO::Path#method_basename
https://docs.perl6.org/type/IO::Path#method_dirname
https://docs.perl6.org/language/variables#Compile-time_variables


my $WhoAmI = $*PROGRAM-NAME;
( my $IAm =~ $?FILE ) ~~ s|.*"/"||;
my $IAmFrom = $?FILE.IO.dirname;
my $IAm = $?FILE.IO.basename;



program path and name:


#!/usr/bin/env perl6

say "Full file name <$?FILE>";

my $IAm;
my $IAmFrom;

$?FILE ~~ m|(.*\/)(.*)|;
$IAmFrom = $0;
$IAm = $1;
say "IAm<$IAm>";
say "IAmFrom<$IAmFrom>\n";

say "and the OS agnostic way:";
$IAmFrom = $?FILE.IO.dirname;
$IAm = $?FILE.IO.basename;
say "IAm<$IAm>";
say "IAmFrom<$IAmFrom>";



$ FileTest.pl6
Full file name 
IAm
IAmFrom

and the OS agnostic way:
IAm
IAmFrom


$ /home/linuxutil/FileTest.pl6
Full file name 
IAm
IAmFrom

and the OS agnostic way:
IAm
IAmFrom


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

On 09/25/2017 12:51 PM, Parrot Raiser wrote:

ToddAndMargo might save some time by asking "Is this a problem someone
else might have solved, and if so, how?" before plunging ahead and
coding. From this and previous postings, it looks as though the answer
might frequently start with "Yes", and would save a lot of redundant
effort.



Todd has to learn sometime.  Little exercises like this help
him to learn string substitutions and matches.

As far as someone having done it. That is a good idea.
I love modules.  Currently Perl 6's modules are in transition
and have a lot of issues.  The ftp module can not get a socket;
The email module can't handle ssl; and on and so forth.
Their time is still yet to come, but they will get there.

And as far as Todd goes, he needs to learn substitutions
and matched so well he can do them in his sleep. He
can not rely on his personality and good looks forever!


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 10:23 PM, ToddAndMargo 
wrote:

> On 09/25/2017 07:25 AM, Brandon Allbery wrote:
>
>> So as to make this not entirely content-free: I would suggest that the
>> string language note the line on which it sees a bare newline, and if it
>> subsequently hits a syntax error while still parsing that string it could
>> output something like perl 5's "Possible runaway multi-line string starting
>> on line ..." as a suggestion.
>>
>
> Really like this sugestion!
>

I'm actually looking at the code in question now... and unsure how to
proceed, as hacking on perl 6 parsers is a bit new to me and this looks
like it needs to be implemented in a way that is usable by multiple roles
representing different kinds of 'quoted string' (single, double, regex,
...).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

On 09/25/2017 07:25 AM, Brandon Allbery wrote:
So as to make this not entirely content-free: I would suggest that the 
string language note the line on which it sees a bare newline, and if it 
subsequently hits a syntax error while still parsing that string it 
could output something like perl 5's "Possible runaway multi-line string 
starting on line ..." as a suggestion.


Really like this sugestion!


Re: Need a second pair of eyes

2017-09-25 Thread Parrot Raiser
ToddAndMargo might save some time by asking "Is this a problem someone
else might have solved, and if so, how?" before plunging ahead and
coding. From this and previous postings, it looks as though the answer
might frequently start with "Yes", and would save a lot of redundant
effort.


Re: overwrite?

2017-09-25 Thread Parrot Raiser
Have you considered simply "touch"ing the file? That updates the timestamp.


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
So as to make this not entirely content-free: I would suggest that the
string language note the line on which it sees a bare newline, and if it
subsequently hits a syntax error while still parsing that string it could
output something like perl 5's "Possible runaway multi-line string starting
on line ..." as a suggestion.

On Mon, Sep 25, 2017 at 10:19 AM, Brandon Allbery 
wrote:

> On Mon, Sep 25, 2017 at 3:09 AM, Julien Simonet 
> wrote:
>
>> I think your problem is coming from a (") missing at line 3.
>> At the same line, the semicolon (;) is misplaced : it should be at the
>> end if line.
>>
>
> It took older perl over a decade to come up with better error messages for
> this. Can we please do it a bit sooner?
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 3:09 AM, Julien Simonet 
wrote:

> I think your problem is coming from a (") missing at line 3.
> At the same line, the semicolon (;) is misplaced : it should be at the end
> if line.
>

It took older perl over a decade to come up with better error messages for
this. Can we please do it a bit sooner?

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Timo Paulssen

> Second itteration:
>
> 
> #!/usr/bin/env perl6
>
> say "Full file name <$?FILE>";
>
> my $IAm;
> my $IAmFrom;
>
> $?FILE ~~ m|(.*\/)(.*)|;
> $IAmFrom = $0;
> $IAm = $1;
> say "IAm    <$IAm>";
> say "IAmFrom    <$IAmFrom>";
> 

Please don't use string functions on paths; doing it like this is liable
to break when used on another OS like windows where paths are separated
with \ instead of /

What you're doing here is exactly what .IO.basename and .IO.dirname are for.

    https://docs.perl6.org/type/IO::Path#method_basename
    https://docs.perl6.org/type/IO::Path#method_dirname


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

On 09/25/2017 12:22 AM, ToddAndMargo wrote:

On 09/25/2017 12:14 AM, ToddAndMargo wrote:
Le 25 septembre 2017 08:55:59 GMT+02:00, ToddAndMargo 
 a écrit :



1: #!/usr/bin/env perl6
2:
3: say "Full file name <$?FILE;>
4:
5: my $IAmFrom;
6:   $IAmFrom = $?FILE;
7:   $IAmFrom ~~ \.*/||;
8: say "IAmFrom <$IAmFrom>";


$ /home/linuxutil/FileTest.pl6
===SORRY!=== Error while compiling /home/linuxutil/FileTest.pl6
Variable '$IAmFrom' is not declared
at /home/linuxutil/FileTest.pl6:5
--> my ⏏$IAmFrom = $?FILE;


Sure look declaired to me.  What did I typo?


On 09/25/2017 12:09 AM, Julien Simonet wrote:

Hello,

I think your problem is coming from a (") missing at line 3.
At the same line, the semicolon (;) is misplaced : it should be at 
the end if line.


I hope I helped :)



That was it.  Thank you!


In case anyone is curious, this it the final test with all the
booboo's removed:


#!/usr/bin/env perl6

say "Full file name <$?FILE>";

my $IAm;
my $IAmFrom;
$IAmFrom = $?FILE;
$IAmFrom ~~ m|(.*\/)(.*)|;
$IAmFrom = $0;
$IAm = $1;
say "IAm<$IAm>\nIAmFrom<$IAmFrom>";


$ FileTest.pl6
Full file name 
IAm
IAmFrom

$ /home/linuxutil/FileTest.pl6
Full file name 
IAm
IAmFrom


Second itteration:


#!/usr/bin/env perl6

say "Full file name <$?FILE>";

my $IAm;
my $IAmFrom;

$?FILE ~~ m|(.*\/)(.*)|;
$IAmFrom = $0;
$IAm = $1;
say "IAm<$IAm>";
say "IAmFrom<$IAmFrom>";



Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo

On 09/25/2017 12:14 AM, ToddAndMargo wrote:
Le 25 septembre 2017 08:55:59 GMT+02:00, ToddAndMargo 
 a écrit :



1: #!/usr/bin/env perl6
2:
3: say "Full file name <$?FILE;>
4:
5: my $IAmFrom;
6:   $IAmFrom = $?FILE;
7:   $IAmFrom ~~ \.*/||;
8: say "IAmFrom <$IAmFrom>";


$ /home/linuxutil/FileTest.pl6
===SORRY!=== Error while compiling /home/linuxutil/FileTest.pl6
Variable '$IAmFrom' is not declared
at /home/linuxutil/FileTest.pl6:5
--> my ⏏$IAmFrom = $?FILE;


Sure look declaired to me.  What did I typo?


On 09/25/2017 12:09 AM, Julien Simonet wrote:

Hello,

I think your problem is coming from a (") missing at line 3.
At the same line, the semicolon (;) is misplaced : it should be at the 
end if line.


I hope I helped :)



That was it.  Thank you!


In case anyone is curious, this it the final test with all the
booboo's removed:


#!/usr/bin/env perl6

say "Full file name <$?FILE>";

my $IAm;
my $IAmFrom;
   $IAmFrom = $?FILE;
   $IAmFrom ~~ m|(.*\/)(.*)|;
   $IAmFrom = $0;
   $IAm = $1;
say "IAm<$IAm>\nIAmFrom<$IAmFrom>";


$ FileTest.pl6
Full file name 
IAm
IAmFrom

$ /home/linuxutil/FileTest.pl6
Full file name 
IAm
IAmFrom


Re: Need a second pair of eyes

2017-09-25 Thread ToddAndMargo
Le 25 septembre 2017 08:55:59 GMT+02:00, ToddAndMargo 
 a écrit :



1: #!/usr/bin/env perl6
2:
3: say "Full file name <$?FILE;>
4:
5: my $IAmFrom;
6:   $IAmFrom = $?FILE;
7:   $IAmFrom ~~ \.*/||;
8: say "IAmFrom <$IAmFrom>";


$ /home/linuxutil/FileTest.pl6
===SORRY!=== Error while compiling /home/linuxutil/FileTest.pl6
Variable '$IAmFrom' is not declared
at /home/linuxutil/FileTest.pl6:5
--> my ⏏$IAmFrom = $?FILE;


Sure look declaired to me.  What did I typo?


On 09/25/2017 12:09 AM, Julien Simonet wrote:

Hello,

I think your problem is coming from a (") missing at line 3.
At the same line, the semicolon (;) is misplaced : it should be at the 
end if line.


I hope I helped :)



That was it.  Thank you!


Re: Need a second pair of eyes

2017-09-25 Thread Julien Simonet
Hello, 

I think your problem is coming from a (") missing at line 3. 
At the same line, the semicolon (;) is misplaced : it should be at the end if 
line. 

I hope I helped :)


Le 25 septembre 2017 08:55:59 GMT+02:00, ToddAndMargo  a 
écrit :
>
>1: #!/usr/bin/env perl6
>2:
>3: say "Full file name <$?FILE;>
>4:
>5: my $IAmFrom;
>6:   $IAmFrom = $?FILE;
>7:   $IAmFrom ~~ \.*/||;
>8: say "IAmFrom <$IAmFrom>";
>
>
>$ /home/linuxutil/FileTest.pl6
>===SORRY!=== Error while compiling /home/linuxutil/FileTest.pl6
>Variable '$IAmFrom' is not declared
>at /home/linuxutil/FileTest.pl6:5
>--> my ⏏$IAmFrom = $?FILE;
>
>
>Sure look declaired to me.  What did I typo?

-- 
Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.