]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Tool/memcheck.pm
Only allow 24 callers
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Tool / memcheck.pm
index 9064b5d90e6e25d5fa695f368e8a003f307ce9a2..b300f66da1319a624ee7b171ec1506d76471ca90 100644 (file)
@@ -21,6 +21,8 @@ This class contains the information required by the session for running the C<me
 
 =cut
 
+use Scalar::Util ();
+
 use base qw<Test::Valgrind::Tool>;
 
 =head1 METHODS
@@ -58,8 +60,11 @@ sub new {
 
  my %args = @_;
 
- my $callers = delete $args{callers} || 50;
- $callers =~ s/\D//g;
+ my $callers = delete $args{callers};
+ $callers = 24 unless $callers;
+ die 'Invalid number of callers'
+            unless Scalar::Util::looks_like_number($callers) and $callers > 0
+                                                             and $callers <= 24;
 
  my $self = bless $class->Test::Valgrind::Tool::new(%args), $class;
 
@@ -68,7 +73,7 @@ sub new {
  $self;
 }
 
-sub new_trainer { shift->new(callers => 50) }
+sub new_trainer { shift->new(callers => 24) }
 
 =head2 C<callers>