Tie/Expression.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
TIEHASH
1.0
CRAP 1.0
« Percent/Underscore.pm ↑ Summary
1 package Tie::Expression;
2 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 our $VERSION = sprintf "%d.%02d", q$Revision: 0.1 $ =~ /(\d+)/g;
5 2 ▶sub TIEHASH($) { bless \eval { my $scalar }, shift }
Subroutine TIEHASH: called CC=1 SCAR=0.0
6 6 ▶sub FETCH($$) { $_[1] }
Subroutine FETCH: called CC=1 SCAR=0.0
7 4 1;
8  
9 =head1 NAME
10  
11 Tie::Expression - Let any %hash interpolate any expression.
12  
13 =head1 VERSION
14  
15 $Id: Expression.pm,v 0.1 2008/07/01 17:56:27 dankogai Exp dankogai $
16  
17 =head1 SYNOPSIS
18  
19 use Tie::Expression;
20 tie my %expression, 'Tie::Expression';
21 print "PI = $expression{ 4 * atan2(1,1) }.\n";
22  
23 =head1 DISCUSSION
24  
25 This module makes any tied hash a I<universal interpolator>. Just
26 feed its key any expression and the result of the expression becomes
27 the value.
28  
29 It is known that C< @{[ expression ]} > is a univasal
30 interpolator but the solution with this module is more elegant.
31  
32 The implementation is deceptively simple. Just check the source and
33 you will find this module is just six lines long!
34  
35 =head1 SEE ALSO
36  
37 L<Percent::Underscore>
38  
39 =head1 EXPORT
40  
41 Nothing.
42  
43 =head1 AUTHOR
44  
45 Dan Kogai, C<< <dankogai at dan.co.jp> >>
46  
47 =head1 BUGS
48  
49 Please report any bugs or feature requests to C<bug-tie-expression at rt.cpan.org>, or through
50 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tie-Expression>. I will be notified, and then you'll
51 automatically be notified of progress on your bug as I make changes.
52  
53 =head1 SUPPORT
54  
55 You can find documentation for this module with the perldoc command.
56  
57 perldoc Tie::Expression
58  
59  
60 You can also look for information at:
61  
62 =over 4
63  
64 =item * RT: CPAN's request tracker
65  
66 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tie-Expression>
67  
68 =item * AnnoCPAN: Annotated CPAN documentation
69  
70 L<http://annocpan.org/dist/Tie-Expression>
71  
72 =item * CPAN Ratings
73  
74 L<http://cpanratings.perl.org/d/Tie-Expression>
75  
76 =item * Search CPAN
77  
78 L<http://search.cpan.org/dist/Tie-Expression>
79  
80 =back
81  
82 =head1 ACKNOWLEDGEMENTS
83  
84 None so far.
85  
86 =head1 COPYRIGHT & LICENSE
87  
88 Copyright 2008 Dan Kogai, all rights reserved.
89  
90 This program is free software; you can redistribute it and/or modify it
91 under the same terms as Perl itself.
« Percent/Underscore.pm ↑ Summary