For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2005 > Die without textoutput?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Die without textoutput?
gustav@varupiraten.se

2005-10-28, 3:55 am

Hi!

When die is used, there is message something like:

x doesn't exist as an environment variable
Died at lsh.pl line 510, <STDIN> line 6.
Childprocess complete

I just want the current process to die without giving any output to
screen, something like this:

x doesn't exist as an environment variable
Childprocess complete

Is there any substitue for the die-command to achieve this?

/G
@varupiraten.se


John W. Krahn

2005-10-28, 3:55 am

gustav@varupiraten.se wrote:
> Hi!


Hello,

> When die is used, there is message something like:
>
> x doesn't exist as an environment variable
> Died at lsh.pl line 510, <STDIN> line 6.
> Childprocess complete
>
> I just want the current process to die without giving any output to
> screen, something like this:
>
> x doesn't exist as an environment variable
> Childprocess complete


Isn't that output to the screen? Did you read the documentation for die where
it explains the different forms of output and alternatives to die?

perldoc -f die

Do you have any questions about what's in the documentation?

It is hard to diagnose code problems without seeing any code.


John
--
use Perl;
program
fulfillment
gustav@varupiraten.se

2005-10-28, 7:56 am

> gustav@varupiraten.se wrote:
>
> Hello,
>
>
> Isn't that output to the screen? Did you read the documentation for die
> where
> it explains the different forms of output and alternatives to die?

Yes, but I don't want any output to the screen! Is this possible to achieve?

I'd like something like pseduo..
die <No output to screen, just die>

/G


J.Peng

2005-10-28, 7:56 am

hi,
you can redefined the $SIG{__DIE__} handle to do that.
such as:

$SIG{__DIE__}=\&yourdie;
sub yourdie{
...
die;
}


> Hi!
>
> When die is used, there is message something like:
>
> x doesn't exist as an environment variable
> Died at lsh.pl line 510, <STDIN> line 6.
> Childprocess complete
>
> I just want the current process to die without giving any output to
> screen, something like this:
>
> x doesn't exist as an environment variable
> Childprocess complete
>
> Is there any substitue for the die-command to achieve this?
>
> /G
> @varupiraten.se
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>




______________________________________
Get your FREE 100MB email today at http://www.wapda.com


John Doe

2005-10-28, 7:56 am

J.Peng am Freitag, 28. Oktober 2005 11.27:
> hi,
> you can redefined the $SIG{__DIE__} handle to do that.
> such as:
>
> $SIG{__DIE__}=\&yourdie;
> sub yourdie{
> ...
> die;
> }


Or, to avoid a second die:

chomsky ~/ramsch $ perl -le '$SIG{__DIE__}=sub {exit(1)}; \
die "explore the reason yourself"'

chomsky ~/ramsch $ echo $?
1

# you will have an exit code of 1 instead of die output.

hth, joe

[...][color=darkred]
[...]
Hao Chen

2005-10-28, 7:56 am

Do you mean that you don't want the line number and file evealed?

Llama said,

If you don't want the line number and file revealed,
make sure that the dying words have a newline on the end.
That is, another way you could use die is in a line like this,
with a trailing newline:

die "Not enough arguments\n" if @ARGV < 2;

If there aren't at least two command-line arguments,
that program will say so and quit.
It won't include the program name and line number.


On 10/28/05, gustav@varupiraten.se <gustav@varupiraten.se> wrote:
> Hi!
>
> When die is used, there is message something like:
>
> x doesn't exist as an environment variable
> Died at lsh.pl line 510, <STDIN> line 6.
> Childprocess complete
>
> I just want the current process to die without giving any output to
> screen, something like this:
>
> x doesn't exist as an environment variable
> Childprocess complete
>
> Is there any substitue for the die-command to achieve this?
>
> /G
> @varupiraten.se
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>

John W. Krahn

2005-10-28, 7:56 am

gustav@varupiraten.se wrote:
> Yes, but I don't want any output to the screen! Is this possible to achieve?
>
> I'd like something like pseduo..
> die <No output to screen, just die>


perldoc -f exit


John
--
use Perl;
program
fulfillment
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com