[Namazu-cvs 861] r270 - in MMagic/trunk: . t

cvsd @ vaj.namazu.org cvsd @ vaj.namazu.org
2006年 6月 26日 (月) 16:07:25 JST


Author: knok
Date: 2006-06-26 16:07:25 +0900 (Mon, 26 Jun 2006)
New Revision: 270

Added:
   MMagic/trunk/t/05-subclass.t
Modified:
   MMagic/trunk/ChangeLog
   MMagic/trunk/MMagic.pm
Log:
Applied subclass patch made by Michael Hendricks.


Modified: MMagic/trunk/ChangeLog
===================================================================
--- MMagic/trunk/ChangeLog	2006-06-09 05:56:14 UTC (rev 269)
+++ MMagic/trunk/ChangeLog	2006-06-26 07:07:25 UTC (rev 270)
@@ -1,3 +1,7 @@
+2006-06-26  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
+
+	* Applied subclass patch, made by Michael Hendricks.
+
 2006-05-23  NOKUBI Takatsugu  <knok @ daionet.gr.jp>
 
 	* MMagic.pm: Version 1.27.

Modified: MMagic/trunk/MMagic.pm
===================================================================
--- MMagic/trunk/MMagic.pm	2006-06-09 05:56:14 UTC (rev 269)
+++ MMagic/trunk/MMagic.pm	2006-06-26 07:07:25 UTC (rev 270)
@@ -422,8 +422,7 @@
 	     '\.html$' => 'text/html',
 	     '\.htm$' => 'text/html',
     };
-    bless($self);
-    return $self;
+    return bless $self, $class;
 }
 
 sub addSpecials {

Added: MMagic/trunk/t/05-subclass.t
===================================================================
--- MMagic/trunk/t/05-subclass.t	2006-06-09 05:56:14 UTC (rev 269)
+++ MMagic/trunk/t/05-subclass.t	2006-06-26 07:07:25 UTC (rev 270)
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+my $mm = Example::Module->new();
+isa_ok( $mm, 'Example::Module', 'subclassed object' );
+isa_ok( $mm, 'File::MMagic', 'subclassed object' );
+is( $mm->checktype_filename(), 'foo/bar', 'override method' );
+
+package Example::Module;
+use base qw( File::MMagic );
+
+sub checktype_filename { 'foo/bar' }




Namazu-cvs メーリングリストの案内