adapted how the individual overview is instantiated
[sgn.git] / cgi-bin / scraps / scrap.pl
blob196823751debd1435dc04333b09da5c7c60e0c3f
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)
2 use CXGN::Page;
3 use CXGN::Scrap;
4 use Carp;
6 eval {
7 my $scrap = CXGN::Scrap->new();
8 my %args = $scrap->get_all_encoded_arguments();
10 ## Put all scrap code here
13 if($@) {
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/;
16 print "E: $@";
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