CharlesClarkson has asked for the wisdom of the Perl Monks concerning the following question:
While using Tie::FlipFlop, I ran into a problem.
Which prints:use Tie::FlipFlop; tie my $flipflop => Tie::FlipFlop => ( 'white', 'black' ); print qq|$flipflop\n|; print qq|$flipflop\n|; print qq|$flipflop\n|; print qq|$flipflop\n|;
While this:black black black black
Prints this:use Tie::FlipFlop; tie my $flipflop => Tie::FlipFlop => ( 'white', 'black' ); print $flipflop, qq|\n|; print $flipflop, qq|\n|; print $flipflop, qq|\n|; print $flipflop, qq|\n|;
white black white black
After a little investigating, I found that, when quoted, FETCH was being called twice in the module for each print. Why is the value fetched twice? And can this be trapped to return the desired result?
TIA,Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: FETCHing twice in Tie::FlipFlop
by sauoq (Abbot) on Dec 20, 2003 at 00:51 UTC | |
Re: FETCHing twice in Tie::FlipFlop
by Sandy (Curate) on Dec 20, 2003 at 17:04 UTC | |
Re: FETCHing twice in Tie::FlipFlop
by eclark (Scribe) on Dec 20, 2003 at 00:03 UTC | |
by CharlesClarkson (Curate) on Dec 20, 2003 at 00:45 UTC | |
Re: FETCHing twice in Tie::FlipFlop
by petdance (Parson) on Dec 21, 2003 at 17:40 UTC | |
by ysth (Canon) on Dec 21, 2003 at 18:13 UTC |
Back to
Seekers of Perl Wisdom