This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge branch 'dual/Safe' into blead
[perl5.git] / cpan / Pod-Simple / lib / Pod / Simple / TiedOutFH.pm
1
2 use strict;
3 package Pod::Simple::TiedOutFH;
4 use Symbol ('gensym');
5 use Carp ();
6 use vars qw($VERSION );
7 $VERSION = '3.14';
8
9 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
11 sub handle_on { # some horrible frightening things are encapsulated in here
12   my $class = shift;
13   $class = ref($class) || $class;
14   
15   Carp::croak "Usage: ${class}->handle_on(\$somescalar)" unless @_;
16   
17   my $x = (defined($_[0]) and ref($_[0]))
18     ? $_[0]
19     : ( \( $_[0] ) )[0]
20   ;
21   $$x = '' unless defined $$x;
22   
23   #Pod::Simple::DEBUG and print "New $class handle on $x = \"$$x\"\n";
24   
25   my $new = gensym();
26   tie *$new, $class, $x;
27   return $new;
28 }
29
30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
32 sub TIEHANDLE {  # Ties to just a scalar ref
33   my($class, $scalar_ref) = @_;
34   $$scalar_ref = '' unless defined $$scalar_ref;
35   return bless \$scalar_ref,  ref($class) || $class;
36 }
37
38 sub PRINT {
39   my $it = shift;
40   foreach my $x (@_) { $$$it .= $x }
41
42   #Pod::Simple::DEBUG > 10 and print " appended to $$it = \"$$$it\"\n";
43
44   return 1;
45 }
46
47 sub FETCH {
48   return ${$_[0]};
49 }
50
51 sub PRINTF {
52   my $it = shift;
53   my $format = shift;
54   $$$it .= sprintf $format, @_;
55   return 1;
56 }
57
58 sub FILENO { ${ $_[0] } + 100 } # just to produce SOME number
59
60 sub CLOSE { 1 }
61
62 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 1;
64 __END__
65
66 Chole
67
68  * 1 large red onion
69  * 2 tomatillos
70  * 4 or 5 roma tomatoes (optionally with the pulp discarded)
71  * 1 tablespoons chopped ginger root (or more, to taste)
72  * 2 tablespoons canola oil (or vegetable oil)
73  
74  * 1 tablespoon garam masala
75  * 1/2 teaspoon red chili powder, or to taste
76  * Salt, to taste (probably quite a bit)
77  * 2 (15-ounce) cans chick peas or garbanzo beans, drained and rinsed
78  * juice of one smallish lime
79  * a dash of balsamic vinegar (to taste)
80  * cooked rice, preferably long-grain white rice (whether plain,
81     basmati rice, jasmine rice, or even a mild pilaf)
82
83 In a blender or food processor, puree the onions, tomatoes, tomatillos,
84 and ginger root.  You can even do it with a Braun hand "mixer", if you
85 chop things finer to start with, and work at it.
86
87 In a saucepan set over moderate heat, warm the oil until hot.
88
89 Add the puree and the balsamic vinegar, and cook, stirring occasionally,
90 for 20 to 40 minutes. (Cooking it longer will make it sweeter.)
91
92 Add the Garam Masala, chili powder, and cook, stirring occasionally, for
93 5 minutes.
94
95 Add the salt and chick peas and cook, stirring, until heated through.
96
97 Stir in the lime juice, and optionally one or two teaspoons of tahini.
98 You can let it simmer longer, depending on how much softer you want the
99 garbanzos to get.
100
101 Serve over rice, like a curry.
102
103 Yields 5 to 7 servings.
104
105