File: Common.pm

package info (click to toggle)
libdata-util-perl 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556 kB
  • sloc: perl: 2,958; ansic: 416; makefile: 8
file content (42 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (5)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# benchmark/common.pl

use 5.008_001;

use strict;
use B qw(svref_2object);
use Config qw(%Config);
use XSLoader();
use DynaLoader();
use Carp qw(longmess);

$SIG{__WARN__} = \&longmess;

sub perl_signeture{
	printf "Perl %vd on %s\n", $^V, $Config{archname};
}

sub module_signeture{
	my($name, $subr) = @_;
	my $cv = svref_2object($subr);

	printf "%s(%s)/%s\n", $name, $cv->XSUB ? 'XS' : 'PurePerl', $name->VERSION;
}

sub signeture{
	my %mods = @_;
	perl_signeture();

	while(my($name, $subr) = each %mods){
		module_signeture($name => $subr);
	}

	print "\n";
}


if(grep { /^--pureperl$/ } @ARGV){
	no warnings 'redefine';
	*DynaLoader::bootstrap = sub{ die };
	*XSLoader::load        = sub{ die };
}
1;