r69436 - in /branches/upstream/libexception-handler-perl: ./ current/ current/t/

takaki at users.alioth.debian.org takaki at users.alioth.debian.org
Thu Feb 24 05:51:47 UTC 2011


Author: takaki
Date: Thu Feb 24 05:51:40 2011
New Revision: 69436

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69436
Log:
[svn-inject] Installing original source of libexception-handler-perl (1.004)

Added:
    branches/upstream/libexception-handler-perl/
    branches/upstream/libexception-handler-perl/current/
    branches/upstream/libexception-handler-perl/current/COPYING
    branches/upstream/libexception-handler-perl/current/Changes
    branches/upstream/libexception-handler-perl/current/Handler.pm
    branches/upstream/libexception-handler-perl/current/MANIFEST
    branches/upstream/libexception-handler-perl/current/META.yml
    branches/upstream/libexception-handler-perl/current/Makefile.PL
    branches/upstream/libexception-handler-perl/current/README
    branches/upstream/libexception-handler-perl/current/t/
    branches/upstream/libexception-handler-perl/current/t/1_canuseit.t
    branches/upstream/libexception-handler-perl/current/t/2_isa.t
    branches/upstream/libexception-handler-perl/current/t/3_can.t
    branches/upstream/libexception-handler-perl/current/t/4_empty_subclass.t

Added: branches/upstream/libexception-handler-perl/current/COPYING
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/COPYING?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/COPYING (added)
+++ branches/upstream/libexception-handler-perl/current/COPYING Thu Feb 24 05:51:40 2011
@@ -1,0 +1,2 @@
+This library is free software, you may redistribute it and/or modify it
+under the same terms as Perl itself.

Added: branches/upstream/libexception-handler-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/Changes?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/Changes (added)
+++ branches/upstream/libexception-handler-perl/current/Changes Thu Feb 24 05:51:40 2011
@@ -1,0 +1,15 @@
+Revision history for Perl extension Exception::Handler.pm
+
+   1.00_4
+      Thu Dec 21 18:04:23 CST 2006
+      Added new method ::error() to retrieve the contents of the most recently
+		thrown error in a given Exception::Handler object
+
+   1.00_3
+      Fri Sep 19 00:37:33 CDT 2003
+      Corrected slight grammatical/spelling error in stack dumps produced
+      by method Exception::Handler::trace()
+
+   1.00_2
+      12/23/02, 1:44 am
+      Initial release of Exception::Handler.pm

Added: branches/upstream/libexception-handler-perl/current/Handler.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/Handler.pm?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/Handler.pm (added)
+++ branches/upstream/libexception-handler-perl/current/Handler.pm Thu Feb 24 05:51:40 2011
@@ -1,0 +1,183 @@
+package Exception::Handler;
+use strict;
+use vars qw( $VERSION );
+$VERSION = 1.00_4; # Thu Dec 21 18:04:23 CST 2006
+
+# --------------------------------------------------------
+# Constructor
+# --------------------------------------------------------
+sub new { 
+	my($this) = bless({ }, shift(@_));
+	$this->{'errors'} = [@_];
+	return $this
+}
+
+# --------------------------------------------------------
+# Exception::Handler::error()
+# --------------------------------------------------------
+sub error { @{ $_->{'errors'} } } # very bad; very easy
+
+
+# --------------------------------------------------------
+# Exception::Handler::fail()
+# --------------------------------------------------------
+sub fail  {
+
+   my($this) = shift(@_);
+   my($throw_count) = $this->{'tflag'} || 0;
+
+   {
+     # I refuse to manually initialize a standard environment
+     # variable.  This is an example where the warnings pragma
+     # is going too far.  It's something we live with.
+     local($^W) = undef;
+
+     # if we're running in a CGI gateway iface, we need
+     # to output the necessary HTTP headers
+     if ( $ENV{'REQUEST_METHOD'} ) {
+
+       print(<<__crash__) and exit;
+Content-Type: text/html; charset=ISO-8859-1
+
+<pre>
+PROCESS TERMINATED DUE TO ERRORS
+@{[ $this->trace(@_) ]}
+</pre>
+__crash__
+     }
+     else {
+
+       print(<<__crash__) and exit;
+PROCESS TERMINATED DUE TO ERRORS
+@{[ $this->trace(@_) ]}
+__crash__
+     }
+   }
+
+   exit
+}
+
+
+# --------------------------------------------------------
+# Exception::Handler::trace()
+# --------------------------------------------------------
+sub trace {
+
+   my($this)    = shift(@_);
+   my(@errors)  = @_; $this->{'errors'} = [@errors];
+   my($errfile) = '';
+   my($caught)  = '';
+   my(
+      $pak,    $file,  $line,  $sub,
+      $hasargs, $wantarray, $evaltext, $req_OR_use,
+      @stack,   $i,    $ialias
+   );
+
+   $ialias = 0;
+
+   while (
+      (
+         $pak,    $file,  $line,  $sub,
+         $hasargs, $wantarray, $evaltext, $req_OR_use
+      ) = caller( $i++ )
+     )
+   {
+      $ialias = $i - 2; next unless ($ialias > 0);
+
+      if ( (split(/\:\:/, $sub))[0] ne __PACKAGE__ ) {
+
+         push @stack, <<__ERR__
+$ialias. $sub
+    -called at line ($line) of $file
+       @{[ ($hasargs)
+            ? '-was called with args'
+            : '-was called without args' ]}
+       @{[ ($evaltext)
+            ? '-was called to evalate text'
+            : '-was not called to evaluate anything' ]}
+__ERR__
+      }
+      else {
+         $caught = qq[\012] . uc(qq[exception was raised at])
+           . qq[ line ($line) of $file];
+     }
+   }
+
+   $i = 0;
+
+   if ( scalar(@errors) == 0 ) {
+
+     push ( @errors, qq[[Unspecified error.  Frame no. $ialias...]] );
+   }
+
+   foreach (@errors) {
+
+      $_ = ( defined($_) ) ? $_ : '';
+
+      if (!length($_)) { $_ = qq[Something is wrong.  Frame no. $ialias...]; }
+      else {
+
+         $_ =~ s/^(?:\r|\n)//o; $_ =~ s/(?:\r|\n)$//o;
+
+         $_ = qq[\012$_\012];
+      }
+
+      ++$i;
+   }
+
+   join(qq[\012] x 2, @errors)
+   . ($caught ? $caught . qq[\012] : '')
+   . qq[\012] . join(qq[\012] x 2, @stack);
+}
+
+
+# --------------------------------------------------------
+# Exception::Handler::DESTROY()
+# --------------------------------------------------------
+sub DESTROY { } sub AUTOLOAD { }
+1;
+
+=pod
+
+=head1 NAME
+
+Exception::Handler - Report exceptions with formatted text call-stack
+
+=head1 VERSION
+
+1.00_2
+
+=head1 @EXPORT, @EXPORT_OK
+
+None.
+
+=head1 Methods
+
+   new()
+   fail()
+   trace()
+   error()
+
+=head2 AUTOLOAD-ed methods
+
+None.
+
+=head1 PREREQUISITES
+
+None.
+
+=head1 AUTHOR
+
+Tommy Butler <cpan at atrixnet.com>
+
+=head1 COPYRIGHT
+
+Copyright(c) 2001-2003, Tommy Butler.  All rights reserved.
+
+=head1 LICENSE
+
+This library is free software, you may redistribute
+and/or modify it under the same terms as Perl itself.
+
+=cut
+

Added: branches/upstream/libexception-handler-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/MANIFEST?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/MANIFEST (added)
+++ branches/upstream/libexception-handler-perl/current/MANIFEST Thu Feb 24 05:51:40 2011
@@ -1,0 +1,11 @@
+COPYING
+Changes
+Handler.pm
+MANIFEST
+Makefile.PL
+README
+t/1_canuseit.t
+t/2_isa.t
+t/3_can.t
+t/4_empty_subclass.t
+META.yml                                Module meta-data (added by MakeMaker)

Added: branches/upstream/libexception-handler-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/META.yml?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/META.yml (added)
+++ branches/upstream/libexception-handler-perl/current/META.yml Thu Feb 24 05:51:40 2011
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Exception-Handler
+version:      1.004
+version_from: Handler.pm
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libexception-handler-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/Makefile.PL?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/Makefile.PL (added)
+++ branches/upstream/libexception-handler-perl/current/Makefile.PL Thu Feb 24 05:51:40 2011
@@ -1,0 +1,21 @@
+use ExtUtils::MakeMaker;
+require 5.6.0;
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile
+   (
+   'ABSTRACT'     => 'Report exceptions with formatted call-stack',
+   'AUTHOR'       => 'Tommy Butler <cpan at atrixnet.com>',
+   'INSTALLDIRS'  => 'site',
+   'NAME'         => 'Exception::Handler',
+   'VERSION_FROM' => 'Handler.pm',
+   'linkext'      => { LINKTYPE => '' }, # no link needed
+   'dist'         =>
+      {
+         'COMPRESS'  => 'gzip -9f',
+         'SUFFIX'    => 'gz',
+         'ZIP'       => '/usr/bin/zip',
+         'ZIPFLAGS'  => '-rl',
+      }
+   );

Added: branches/upstream/libexception-handler-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/README?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/README (added)
+++ branches/upstream/libexception-handler-perl/current/README Thu Feb 24 05:51:40 2011
@@ -1,0 +1,49 @@
+Exception::Handler version 1.00_3
+=================================
+
+DESCRIPTION
+Report exceptions with formatted text call-stack
+
+
+CHANGES IN LAST FEW RELEASES
+(listed in reverse cronological order by date and subversion)
+
+   1.00_3
+      Fri Sep 19 00:37:33 CDT 2003
+      Corrected slight grammatical/spelling error in stack dumps produced
+      by method Exception::Handler::trace()
+
+   1.00_2
+      12/23/02, 1:44 am
+      Initial release of Exception::Handler.pm
+
+
+INSTALLATION
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+On windows machines use nmake rather than make; those running cygwin don't have
+to worry about this.  If you don't know what cygwin is, use nmake and check out
+<URL: http://cygwin.com/> after you're done installing this module if you want
+to find out.
+
+
+DEPENDENCIES
+None.
+
+
+AUTHOR
+   Tommy Butler <cpan at atrixnet.com>
+
+
+COPYRIGHT
+   Copyright (C) Tommy Butler 2001-2003, all rights reserved.
+
+
+LICENCE
+   This library is free software, you may redistribute it and/or modify it
+   under the same terms as Perl itself.

Added: branches/upstream/libexception-handler-perl/current/t/1_canuseit.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/t/1_canuseit.t?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/t/1_canuseit.t (added)
+++ branches/upstream/libexception-handler-perl/current/t/1_canuseit.t Thu Feb 24 05:51:40 2011
@@ -1,0 +1,15 @@
+
+use strict;
+use Test;
+
+# use a BEGIN block so we print our plan before MyModule is loaded
+BEGIN { plan tests => 1, todo => [] }
+
+# load your module...
+use lib './';
+use Exception::Handler;
+
+# check object constructor
+ok(ref(Exception::Handler->new()),'Exception::Handler');
+
+exit;

Added: branches/upstream/libexception-handler-perl/current/t/2_isa.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/t/2_isa.t?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/t/2_isa.t (added)
+++ branches/upstream/libexception-handler-perl/current/t/2_isa.t Thu Feb 24 05:51:40 2011
@@ -1,0 +1,18 @@
+
+use strict;
+use Test;
+
+# use a BEGIN block so we print our plan before MyModule is loaded
+BEGIN { plan tests => 1, todo => [] }
+BEGIN { $| = 1 }
+
+# load your module...
+use lib './';
+use Exception::Handler;
+
+my($f) = Exception::Handler->new();
+
+# check to see if Exception::Handler ISA [foo, etc.]
+ok(UNIVERSAL::isa($f,'Exception::Handler'));
+
+exit;

Added: branches/upstream/libexception-handler-perl/current/t/3_can.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/t/3_can.t?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/t/3_can.t (added)
+++ branches/upstream/libexception-handler-perl/current/t/3_can.t Thu Feb 24 05:51:40 2011
@@ -1,0 +1,27 @@
+
+use strict;
+use Test;
+
+# use a BEGIN block so we print our plan before MyModule is loaded
+BEGIN { plan tests => 6, todo => [] }
+BEGIN { $| = 1 }
+
+# load your module...
+use lib './';
+use Exception::Handler;
+
+my($f) = Exception::Handler->new();
+
+# check to see if non-autoloaded Exception::Handler methods are can-able ;O)
+map { ok(ref(UNIVERSAL::can($f,$_)),'CODE') } qw
+   (
+      new
+      fail
+      trace
+
+      VERSION
+      DESTROY
+      AUTOLOAD
+   );
+
+exit;

Added: branches/upstream/libexception-handler-perl/current/t/4_empty_subclass.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libexception-handler-perl/current/t/4_empty_subclass.t?rev=69436&op=file
==============================================================================
--- branches/upstream/libexception-handler-perl/current/t/4_empty_subclass.t (added)
+++ branches/upstream/libexception-handler-perl/current/t/4_empty_subclass.t Thu Feb 24 05:51:40 2011
@@ -1,0 +1,35 @@
+
+use strict;
+use Test;
+
+# use a BEGIN block so we print our plan before module is loaded
+BEGIN { use Exception::Handler }
+BEGIN { plan tests => scalar(@Exception::Handler::EXPORT_OK), todo => [] }
+BEGIN { $| = 1 }
+
+# load your module...
+use lib './';
+
+# automated empty subclass test
+
+# subclass Exception::Handler in package _Foo
+package _Foo;
+use strict;
+use warnings;
+use Exception::Handler qw( :all );
+$Foo::VERSION = 0.00_0;
+ at _Foo::ISA = qw( Exception::Handler );
+1;
+
+# switch back to main package
+package main;
+
+# see if _Foo can do everything that Exception::Handler can do
+map {
+
+   ok ref(UNIVERSAL::can('_Foo', $_)) eq 'CODE'
+
+} @Exception::Handler::EXPORT_OK;
+
+
+exit;




More information about the Pkg-perl-cvs-commits mailing list