Changeset 1736

Show
Ignore:
Timestamp:
01/11/06 19:23:06
Author:
miyagawa
Message:

fix new subclass problem

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Text-Emoticon/trunk/Changes

    r1735 r1736  
    11Revision history for Perl extension Text::Emoticon 
     2 
     30.03  Wed Jan 11 10:21:14 UTC 2006 
     4        - Fixed new so it doesn't break the direct invocation of subclasses 
    25 
    360.02  Wed Jan 11 10:15:39 UTC 2006 
  • Text-Emoticon/trunk/META.yml

    r1735 r1736  
    22#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX# 
    33name:         Text-Emoticon 
    4 version:      0.02 
     4version:      0.03 
    55version_from: lib/Text/Emoticon.pm 
    66installdirs:  site 
  • Text-Emoticon/trunk/lib/Text/Emoticon.pm

    r1735 r1736  
    22 
    33use strict; 
    4 our $VERSION = '0.02'; 
     4our $VERSION = '0.03'; 
    55 
    66use UNIVERSAL::require; 
     
    1010sub new { 
    1111    my $class  = shift; 
    12     my $driver = shift; 
    13     my $args   = @_ == 1 ? $_[0] : {@_}; 
     12    if ($class eq __PACKAGE__) { 
     13        my $driver = shift; 
     14        my $args   = @_ == 1 ? $_[0] : {@_}; 
    1415 
    15     my $subclass = "Text::Emoticon::$driver"; 
    16        $subclass->require or die $@; 
    17  
    18     bless { %{$subclass->default_config}, %$args }, $subclass; 
     16        my $subclass = "Text::Emoticon::$driver"; 
     17        $subclass->require or die $@; 
     18        return bless { %{$subclass->default_config}, %$args }, $subclass; 
     19    } else { 
     20        my $args   = @_ == 1 ? $_[0] : {@_}; 
     21        return bless { %{$class->default_config}, %$args }, $class; 
     22    } 
    1923} 
    2024