On 02/17/2017 06:43 PM, ToddAndMargo wrote:
Hi All,
<code>
$ cat die.pl6
#!/usr/bin/perl6
use strict;
# use warnings;
# use lib; # fill name of lib in
die "Curses on you!";
</code>
$ die.pl6
Curses on you!
in block <unit> at ./die.pl6 line 7
What is the best way to exit, like "die", without
the commentary "in block ...." from the "die" command?
I just want my stuff to show and nothing else.
Many thanks,
-T
Hi All,
Almost every thing you guys tell me, I write down.
This is what became of my question and die and exit.
I may be of use to others.
"die" is not all that useful, as it always exits
with a "1". With "exit", you can set the exit code.
The link to exit codes is nice.
-T
"exit" and "die" in Perl 6:
EXIT:
<code>
#!/usr/bin/perl6
use strict;
# use warnings;
# use lib; # fill name of lib in
print STDERR "Curses on you!\n";
exit 2;
print "This should not print\n";
</code>
$ exit.pl6; echo $?
Curses on you!
2
DIE:
<code>
$ cat die.pl6
#!/usr/bin/perl6
use strict;
# use warnings;
# use lib; # fill name of lib in
die "Curses on you!";
Print "This should not print\n";
</code>
$ die.pl6
Curses on you!
in block <unit> at ./die.pl6 line 7
1
For a list of bash exit codes:
http://www.tldp.org/LDP/abs/html/exitcodes.html
1 Catchall for general errors
2 Misuse of shell builtins (according to Bash documentation)
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~