1 ## Everything a scrap does should be enclosed in an eval{} statement to catch errors (so the AJAX request doesn't receive an SGN error page, which is difficult to parse)
7 my $scrap = CXGN
::Scrap
->new();
8 my %args = $scrap->get_all_encoded_arguments();
10 ## Put all scrap code here
14 #insert new line so that Javascript can more easily separate sent error message from stack trace
15 $@
=~ s/(.*?) at \/data\/local/$1\n\/data\
/local/;
17 ##Everytime a scrap dies, confesses, or croaks, the AJAX response will begin with "E: " (for Error), followed by the die message.
18 #This allows JavaScript-side error-catching to be handled in a "f-error-ly" simple manner