Re: who call raku?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 16:01, ToddAndMargo via perl6-users wrote:

On 2/10/24 15:26, Marc Chantreux wrote:
On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users 
wrote:

Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth




$ raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'
bash


Very cool.  Thank you.

I also need (only a little bit, I figured a way
around it) to kow how to do it in Windows.




Winsdows no so cool.  perl -e does not get past the
quoting issue from the command console.

So:

>raku

[0] > say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]
Failed to open file K:\proc\6640\stat: No such file or directory
  in method throw at 'SETTING::'src/core.c/Exception.rakumod line 65
  in method fail at 'SETTING::'src/core.c/Exception.rakumod line 89
  in block  at 'SETTING::'src/core.c/IO/Handle.rakumod line 158
  in method open at 'SETTING::'src/core.c/IO/Handle.rakumod line 155
  in method open at 'SETTING::'src/core.c/IO/Path.rakumod line 212
  in method words at 'SETTING::'src/core.c/IO/Path.rakumod line 805
  in block  at  line 1



Re: who call raku?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 15:26, Marc Chantreux wrote:

On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users wrote:

Actually, I am looking for the name of the calling program:
Cobian, Task manager, deamon, etc..


linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth




$ raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'
bash


Very cool.  Thank you.

I also need (only a little bit, I figured a way
around it) to kow how to do it in Windows.


Re: who call raku?

2024-02-10 Thread Marc Chantreux
On Thu, Feb 08, 2024 at 02:25:00PM -0800, ToddAndMargo via perl6-users wrote:
> Actually, I am looking for the name of the calling program:
> Cobian, Task manager, deamon, etc..

linux centric anwser:

raku -e 'say "/proc/{"/proc/$*PID/stat".IO.words[3]}/comm".IO.lines[0]'

hth

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



Re: disable coercing?

2024-02-10 Thread ToddAndMargo via perl6-users

On 2/10/24 02:41, Elizabeth Mattijsen wrote:

On 10 Feb 2024, at 08:56, ToddAndMargo via perl6-users  
wrote:

Hi All,

Is there a switch to tell Raku to bomb out with a
type mismatch rather than coercing the following?


my uint16 $x = -1

65535


No, this is intentional behaviour on native integers.


Rats.

I type cast my variable when I can to keep me out of trouble
("Expected Int but got Str").  Guess I got a bit too
lazy.   I am going to have to be more careful when
dealing with Cardinals (unit's).  I did get stung by this
yesterday. Took me hours to figure it out.


Note that you can increment such a value without problems:

[0] > my uint16 $x = -1;
65535
[1] > ++$x
0


Oh now that is really sneaky and speaks
of any underlying understand of bit wise
operations!  :-)

Thank you!




Re: disable coercing?

2024-02-10 Thread Elizabeth Mattijsen
> On 10 Feb 2024, at 08:56, ToddAndMargo via perl6-users  
> wrote:
> 
> Hi All,
> 
> Is there a switch to tell Raku to bomb out with a
> type mismatch rather than coercing the following?
> 
> > my uint16 $x = -1
> 65535

No, this is intentional behaviour on native integers.

Note that you can increment such a value without problems:

[0] > my uint16 $x = -1;
65535
[1] > ++$x
0