| 1 | # $Id: /mirror/gungho/lib/Gungho/Base.pm 31143 2007-11-27T06:57:15.188797Z lestrrat $ | ||
| 2 | # | ||
| 3 | # Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> | ||
| 4 | # All rights reserved. | ||
| 5 | |||
| 6 | package Gungho::Base; | ||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | use base qw(Gungho::Base::Class Class::Accessor::Fast); | ||
| 10 | |||
| 11 | __PACKAGE__->mk_accessors($_) for qw(config); | ||
| 12 | |||
| 13 | sub new | ||
| 14 | { | ||
| 15 | my $class = shift; | ||
| 16 | my $self = bless { @_ }, $class; | ||
| 17 | return $self; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub mk_virtual_methods | ||
| 21 | { | ||
| 22 | my $class = shift; | ||
| 23 | foreach my $method (@_) { | ||
| 24 | my $slot = "${class}::${method}"; | ||
| 25 | { | ||
| 26 | no strict 'refs'; | ||
| 27 | *{$slot} = sub { die(ref($_[0]) . "::${method} is not overridden") }; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | __END__ |