1 package SL::mebil::ERiC;
 
   3 #####################################################
 
   4 # Abhängigkeit: libinline-perl
 
   6 #####################################################
 
   7 use File::Copy qw(copy);
 
   9 use Inline C => Config => BUILD_NOISY => 1, MYEXTLIB => '/home/mebil/workspace_cpp/mERiC/Debug/libmERiC.so';
 
  10 use Inline C => <<'C_END';
 
  12 int validate (char*, char*);
 
  13 int senddata (char*, char*, char*, char*);
 
  15 int c_validate(char* datenart, char* xml_file) {
 
  16       int r = validate(datenart, xml_file);
 
  19 int c_submit(char* datenart, char* xml_file, char* certificate_path, char* PIN) {
 
  20       int r = senddata(datenart, xml_file, certificate_path, PIN);
 
  27         # parameter: 1) type of data: xmlfile must be named: <datatype>.xml
 
  29         #            3) path to certificate
 
  34                 certificate_path => $_[3],
 
  43         # open xml file for reading
 
  44         open (FILE, "$self->{xml_file}") or die "cannot open $self->{xml_file}";
 
  48         if ($encod =~ /UTF-8/) {
 
  49                 open (OUT, ">:encoding(iso-8859-1)", "data.xml");
 
  50                 print OUT "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n";
 
  52                 while ($line = <FILE>) {
 
  59         elsif ($encod =~ /8859-15/) {
 
  61             copy "$self->{xml_file}", "data.xml";
 
  64                 die "unknown encoding $encod";
 
  68         return c_validate($self->{datatype}, "data.xml");
 
  75         return c_submit($self->{datatype}, "data.xml", $self->{certificate_path}, $self->{PIN});