diff options
-rw-r--r-- | MDK/Common/Various.pm | 11 | ||||
-rw-r--r-- | perl-MDK-Common.spec | 6 |
2 files changed, 15 insertions, 2 deletions
diff --git a/MDK/Common/Various.pm b/MDK/Common/Various.pm index 0d8f008..6489f9d 100644 --- a/MDK/Common/Various.pm +++ b/MDK/Common/Various.pm @@ -68,6 +68,11 @@ gives main::g() called from /tmp/t.pl:2 main::f() called from /tmp/t.pl:4 + +=item internal_error(STRING) + +another way to C<die> with a nice error message and a backtrace + =item noreturn() use this to ensure nobody uses the return value of the function. eg: @@ -93,7 +98,7 @@ package MDK::Common::Various; use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); -@EXPORT_OK = qw(first second top to_bool to_int to_float bool2text bool2yesno text2bool chomp_ backtrace); +@EXPORT_OK = qw(first second top to_bool to_int to_float bool2text bool2yesno text2bool chomp_ backtrace internal_error noreturn); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); @@ -119,6 +124,10 @@ sub backtrace { $s; } +sub internal_error { + die "INTERNAL ERROR: $_[0]\n" . backtrace(); +} + sub noreturn { if (defined wantarray) { my ($package, $file, $line, $func) = caller(1); diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec index ce0defb..cde28fc 100644 --- a/perl-MDK-Common.spec +++ b/perl-MDK-Common.spec @@ -2,7 +2,7 @@ # do not change the version here, change in MDK/Common.pm.pl %define version THEVERSION -%define release 6mdk +%define release 7mdk Summary: Various simple functions Name: perl-MDK-Common @@ -49,6 +49,10 @@ rm -rf $RPM_BUILD_ROOT # MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common %changelog +* Thu Jul 25 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-7mdk +- add Various::internal_error +- export Various::noreturn + * Tue Jul 23 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-6mdk - MDK::Common::System: add fuzzy_pidofs |