#!/usr/bin/perl use Carp qw(croak); sub imp { croak shift(), ": oops" } sub git { local $Carp::CarpLevel = 2; imp @_; } git "hello"; #### perl -w ./git.pl hello: oops at ./git.pl line 8 #### @CHECKS = ( arg1 => undef, # a mandatory but unchecked argument arg2 => 'mumble', # an optional scalar argument, with the default arg3 => \&check_arg3, # a checked argument. ); #### sub new { ClassUtils::construct {}, \@CHECKS, @_ } #### sub new { ClassUtils::construct [], \@CHECKS, @_ } #### $OBJ = $CLASS->new(arg1 => 1, arg2 => 'git', arg3 => $X); #### sub new { ClassUtils::construct SUPER::new(@_), \%CHECKS, @_ }