File: test62-subcaller1-a.p

package info (click to toggle)
libdevel-nytprof-perl 6.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,552 kB
  • sloc: perl: 5,616; javascript: 4,033; ansic: 107; makefile: 23
file content (26 lines) | stat: -rw-r--r-- 821 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
# test determination of subroutine caller in unusual cases

# test dying from an xsub
require Devel::NYTProf::Test;
eval { Devel::NYTProf::Test::example_xsub(0, "die") };

# test dying from an xsub where the surrounding eval is an
# argument to a sub call. This used to coredump.
sub sub1 { $_[0] }
sub1 eval { Devel::NYTProf::Test::example_xsub(0, "die") };

# test sub calls (xs and perl) from within a sort block
sub sub2 { $_[0] }
# sort block on one line due to change to line numbering in perl 5.21
my @a = sort { Devel::NYTProf::Test::example_xsub(); sub2($a) <=> sub2($b); } (1,3,2);

# test sub call as a sort block
sub sub3 { $_[0] } # XXX not recorded due to limitation of perl
my @b = sort \&sub3, 3, 1, 2;

# test sub call from a subst
sub sub4 { $_[0] }
my $a = "abcbd";
$a =~ s/b/sub4(uc($1))/ge;

exit 0;