die

Forking subprocesses in Perl unit tests stops prove; Test::Harness exiting

Hi, I have been trying to use the Perl utility/module "prove" as a test harness for some unit tests. The unit tests are a little more "system" than "unit" as I need to fork off some background processes as part of the test, Using the following... sub SpinupMonitor{ my $base_dir = shift; my $config = shift; my $pid = fork(); ...

How Can I Display Static HTML After I've Used die() in a PHP Block?

Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){ die(); } else{ #Do something } ?> </body> <html> I hope the purpose of this code is straightforward. If a certain condition is met (ie can't connect to database), then the program should die, but otherwise it should ...

How can I get around a 'die' call in a Perl library I can't modify?

Yes, the problem is with a library I'm using, and no, I cannot modify it. I need a workaround. Basically, I'm dealing with a badly written Perl library, that exits with 'die' when a certain error condition is encountered reading a file. I call this routine from a program which is looping through thousands of files, a handful of which ar...

Specify page/line when throwing die() ?

I am using PHP 4, the only way I know of to cause an error and stop everything is calling die(). But in case I run into the error later and don't remember where its coming from I would like to specify the page and line number that the die() occurred on (like other php errors do). Is there a way to do this? Thanks! ...

How do I handle both caught and uncaught errors in a Perl subroutine?

This is a followup to "How can I get around a ‘die’ call in a Perl library I can’t modify?". I have a subroutine that calls a Library-Which-Crashes-Sometimes many times. Rather than couch each call within this subroutine with an eval{}, I just allow it to die, and use an eval{} on the level that calls my subroutine: my $status=eval{fun...

what does PHP die() return

in PHP Does die() gives anything in return when we use it? ...

PHP Die question

Just a quick question. Say a call a method like so mysql_pconnect("server","tator_w","password") or die("Unable to connect to SQL server"); Can I have the 'die' call a method rather then display a text message? If so, how? ...

Is there a C equivalent for Perl's Carp module?

In some projects I've done in C, I've liked using the following macros which work similar to Perl's warn and die subroutines: #include <stdio.h> #include <stdlib.h> #define warn(...) \ fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, " at %s line %d\n", __FILE__, __LINE__) #define die(...) \ warn(__VA_ARGS__); \ exit(0x...

How to include files with die(); function?

Hi. file1.php and file2.php with die(); function. include.php: <? include 'file1.php'; include 'file2.php' ?> file1.php <? echo 'included'; die(); ?> file2.php <? echo 'not included'; die(); ?> How can I included both files with die(); function? P.S My English poor, sorry for that. ...

jQuery: Binding and Unbinding Live Click Events

Hi, So there are two constraints to my question: I must use an external function call in my click event, and I must use a live click event, rather binding a typical click event. So my problem is that I'm trying to unbind a click event after it occurs, and then rebind it once the click event code is complete. I'm doing this to preve...

jQuery die() Killing All Elements Instead of Only One Specified

Hi all, I have a peculiar issue that I'm suspecting may just be normal behavior, but I need people to confirm. I'm hooking up live click events to a number of <li> elements by using this code: $('li', $list).live("click", rightItemSingleClickEvent); Note here that I am using a blanket selector here to hook up the same live click eve...

How to trap a PHP script error which dies (Perl has eval)?

Hi I've got a script which works fine on our development server but dies on the clients server. error_reporting(E_ALL); if (function_exists('simplexml_load_file')) echo "function exists"; if (file_exists('test.xml')) { echo("<hr>just about to read local xml file :".__LINE__); $xml = simplexml_load_file('test.xml'); // dies here In ...

PHP and HTML integration

Hello, I have a php file that contains a HTML form, then PHP logic, then an HTML footer...in that order. I am trying to get the values from the form into some php validation logic in the botton of the page (but before the footer) using <?php VALIDATION LOGIC HERE ?>. the problem is when the validation finds an error, the php logic will...

Help troubleshoot a consistently repeatable mod_perl2 / $SIG{__DIE__} bug

This is mod_perl2 on Apache 2.2, ActiveState Perl 5.10 for win32. I override $SIG{__DIE__} and turn on DBI's RaiseError flag, which AFAICT from the docs, should call my override when a database call fails. It seems to almost always, except in one case, and I can't understand why. My script has an our $page variable, and being mod_perl...

PHP: multiple commands in die/exit

when it gives a error I want him to do 2 things. echo nl2br($qVraagOp); mysql_error(); so i thougth: $rVraagOp = mysql_query( $qVraagOp ) or die( echo nl2br($qVraagOp); mysql_error(); ); I can write a function that does these two things and then call that but that a bit redundant. is there a other way? Matthy ...

How do I test for an exception type in perl?

How can I check what kind of exception caused the script or eval block to terminate? I need to know the type of error, and where the exception occurred. ...

Perl: catch error without die

I'm playing around with error handling and got a little problem. I connect with a database using the DBI module. I do my own error handling by using a subroutine that I call upon an error. I can catch my own dies and handle them just fine but when my database connection fails, the DBI module apparently prints out it's own die : DBI co...

How to execute a perl script within php and capture error messages?

I am trying to execute a Perl script like so: /usr/bin/ec2-consistent-snapshot 'vol-dr3131c2' When the Perl script fails it exits using 'die' and prints out an error message. I can see that error message when executing manually, but I am failing to capture it through PHP. I tried the following with no success: exec($command,$output)...

Can the Perl compiler tell me if I have an unchecked exception in my code?

Is there a way in Perl to declare that a method can throw an error (or die)? EDIT: What interests me the most is a way to get the compiler or IDE to tell me I have an unchecked exception somewhere in my code. I always loved how in Java, a method could handle an Exception and/or throw it. The method signature allows to put "throws MyExc...

PHP problem with die()

So, I have this code: } else { $photograph_moderation = new PhotographModeration($this->photograph_id); $photograph_moderation->purgePhotograph(); //eventually take to an error page die('image is not big enough to upload'); } the purgePhotograph() function gets called ...