You are right that when I think it through carefully there
are plenty of cases where it doesn't work. But if you have
objects in a class which are backed by available data that
you want to get a chance to save to disk, well then
protecting that class in a Flyweight pattern gives you an
opportunity to allow the data to be saved correctly.
I whipped up a proof of concept at Class::FlyweightWrapper. Take a
look at how that works then look at the root node of this
thread. I believe that if GMS::MemberFile was made
into a wrapper around a private implementation through my
new module, then DESTROY would work as desired. Sure, you
can find situations where it would break, but it is at least
a solution to the problem at hand.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|