File Coverage

blib/lib/Tie/Expression.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 13 13 100.0


line stmt bran cond sub pod time code
1             package Tie::Expression;
2 3     3   64951 use warnings;
  3         6  
  3         93  
3 3     3   17 use strict;
  3         5  
  3         479  
4             our $VERSION = sprintf "%d.%02d", q$Revision: 0.1 $ =~ /(\d+)/g;
5 2     2   19 sub TIEHASH($) { bless \eval { my $scalar }, shift }
  2         29  
6 6     6   4271 sub FETCH($$) { $_[1] }
7             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. 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
38              
39             =head1 EXPORT
40              
41             Nothing.
42              
43             =head1 AUTHOR
44              
45             Dan Kogai, C<< >>
46              
47             =head1 BUGS
48              
49             Please report any bugs or feature requests to C, or through
50             the web interface at L. 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
67              
68             =item * AnnoCPAN: Annotated CPAN documentation
69              
70             L
71              
72             =item * CPAN Ratings
73              
74             L
75              
76             =item * Search CPAN
77              
78             L
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.