summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-01-03 07:04:08 +0000
committerfukachan <fukachan>2003-01-03 07:04:08 +0000
commit55dc071d41fbc98b4e851b374f69983c24503ac9 (patch)
tree8ee76c6cb1acc203d2ce9c016bfec0c420bc92b3
parenta72be4fd3804989977f295c6b1fef2608720d3d3 (diff)
downloadfml8-55dc071d41fbc98b4e851b374f69983c24503ac9.tar.gz
fml8-55dc071d41fbc98b4e851b374f69983c24503ac9.tar.bz2
fml8-55dc071d41fbc98b4e851b374f69983c24503ac9.zip
implement regexp() method.
FNF-ify.
-rw-r--r--fml/lib/FML/Restriction/Base.pm47
1 files changed, 40 insertions, 7 deletions
diff --git a/fml/lib/FML/Restriction/Base.pm b/fml/lib/FML/Restriction/Base.pm
index 0b964844..1f4b8455 100644
--- a/fml/lib/FML/Restriction/Base.pm
+++ b/fml/lib/FML/Restriction/Base.pm
@@ -1,9 +1,9 @@
#-*- perl -*-
#
-# Copyright (C) 2001,2002 Ken'ichi Fukamachi
+# Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Base.pm,v 1.15 2002/09/22 14:56:55 fukachan Exp $
+# $FML$
#
package FML::Restriction::Base;
@@ -19,8 +19,8 @@ FML::Restriction::Base -- define safe data representations
=head1 SYNOPSIS
use FML::Restriction::Base;
- $safe = new FML::Restriction::Base;
- my $regexp = $safe->basic_variable();
+ my $safe = new FML::Restriction::Base;
+ my $regexp = $safe->regexp( 'type' );
if ($data =~ /^($regexp)$/) {
# o.k. do something ...
@@ -111,16 +111,49 @@ my %basic_variable =
);
-# Descriptions: return HASH_REF of basic variable regexp list
-# Arguments: none
+=head2 basic_variable()
+
+return basic variable regexp list as HASH_REF.
+
+=cut
+
+
+# Descriptions: return basic variable regexp list as HASH_REF.
+# Arguments: OBJ($self)
# Side Effects: none
# Return Value: HASH_REF
sub basic_variable
{
+ my ($self) = @_;
+
return \%basic_variable;
}
+=head2 regexp( class )
+
+return the allowed regexp for C<class>.
+
+=cut
+
+
+# Descriptions: return allowed regexp for $class.
+# Arguments: OBJ($self) STR($class)
+# Side Effects: none
+# Return Value: STR or UNDEF
+sub regexp
+{
+ my ($self, $class) = @_;
+
+ if (defined $basic_variable{ $class }) {
+ return $basic_variable{ $class };
+ }
+ else {
+ return undef;
+ }
+}
+
+
#
# debug
#
@@ -141,7 +174,7 @@ Ken'ichi Fukamachi
=head1 COPYRIGHT
-Copyright (C) 2001,2002 Ken'ichi Fukamachi
+Copyright (C) 2001,2002,2003 Ken'ichi Fukamachi
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.