Created
April 22, 2012 20:34
-
-
Save anazawa/2466717 to your computer and use it in GitHub Desktop.
呼び出し可能なサブルーチンを限定する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| my %foo = ( | |
| start => 0, | |
| template => 0, | |
| entries => 0, | |
| filter => 1, | |
| skip => 1, | |
| interpolate => 1, | |
| head => 1, | |
| sort => 1, | |
| date => 1, | |
| story => 1, | |
| foot => 1, | |
| last => 1, | |
| end => 1, | |
| ); | |
| sub _foo { | |
| my $sub = shift; | |
| $sub =~ s/.*:://o; | |
| $foo{$sub}; | |
| } | |
| } | |
| sub new { | |
| my $sub = ( caller(1) )[3]; | |
| croak unless _foo( $sub ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment