Prev Next error_message_xam.pm Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Perl: Cppad Swig Exception Handling: Example and Test
package error_message_xam;
sub error_message_xam() {
     # check for standard perl programming conventions
     use strict;
     use warnings;
     #
     # load the Cppad Swig library
     use pm_cppad;
     #
     # initilaize return variable
     my $ok = 1;
     # ---------------------------------------------------------------------
     $ok = 0;
     eval { # try
          pm_cppad::error_message("test message");
     }; if( $@ ) { # catch
          my $stored_message = pm_cppad::error_message("");
          $ok = $stored_message eq "test message";
     }
     return( $ok  );
}

Input File: build/lib/example/perl/error_message_xam.pm