i wanted to try and catch the error, and attempt another resize-and-write with a named block, eval, and redo
from reading the perldoc on redo, i find this:
"redo" cannot be used to retry a block which returns a value such as + "eval {}", "sub {}" or "do {}", and should not be used to exit a gre +p() or map() operation.
from here, i just return if no thumbnail img is needed, or create one.warn "new IMG: $fileName " if DEBUG; FILEWRITE: { eval { open( NEWIMG, ">>$fileName" ) or die "Can't open new image +file: ($fileName) $! \n"; binmode( NEWIMG ); $large->Resize( height => $newH, width => $newW ); # or di +e "Resizing error: $! \n"; $large->Write( file => \*NEWIMG ); # or die "Write error: + $!\n"; close( NEWIMG ); }; warn "trying to write the new file ( $fileName ) failed: $@ " +if ( $@ ); redo FILEWRITE if ( $@ ); } undef $large; warn "New LG image written" if DEBUG;
i get the first DEBUG line printed to STDERR, but not the second one on a segfault, so i've gotten to the point where it's the FILEWRITE block ... but, i'm not sure *exactly* which part is failing.
so ...
edit 2: after more testing/fighting, it seems that the calling app is segfaulting between a warn statement and a return 1; statement. i added a warning right after the object method is called ... and i never see it.
in the calling app:
i never see that last warning ... man, am i ever stuckunless ( -e $useFile and $needThumb && -e $checkThumb ) { warn "resizing $useFile ( and $checkThumb )"; my $resizeOK = $utils->resizeImg( $baseImg, $useFile, $needThum +b ); } warn "done resizing in main app " ;
In reply to redo question ( part 'catching segfaults' ) by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |