File: stdmessage.pm

package info (click to toggle)
libextutils-xspp-perl 0.1800-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 996 kB
  • ctags: 1,861
  • sloc: perl: 8,324; cpp: 125; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 543 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package ExtUtils::XSpp::Exception::stdmessage;
use strict;
use warnings;
use base 'ExtUtils::XSpp::Exception';

sub init {
  my $this = shift;
  $this->SUPER::init(@_);
}

sub handler_code {
  my $this = shift;
  my $no_spaces_indent = shift;
  $no_spaces_indent = 4 if not defined $no_spaces_indent;

  my $ctype = $this->cpp_type;
  my $msg = "Caught C++ exception of type or derived from '$ctype': \%s";
  my $code = <<HERE;
catch ($ctype& e) {
  croak("$msg", e.what());
}
HERE
  return $this->indent_code($code, $no_spaces_indent);
}

1;