artist has asked for the wisdom of the Perl Monks concerning the following question:
I have multiple instances of Source and Destination object and Storage class stores historical values as well which Destination objects uses any time.
Where do I declare the $storage object? I try to use 'our' That doesn't seem to present $storage in the other packages.
I am trying to achieve something like
The storeData and useData should have access to the single $storage object all the time. I would rather not pass data around via objects. As multiple classes can access the same data using the storage object as desire.use Storage; our $storage = new Storage(); use Source; use Destination; my $input = 'source.txt'; while (<IN>) { $source = new Source($_); $destination = new Destination(); $source->storeData(); $destination->useData(); }
Thanks,
Seeking art of storage
Artist
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Storage Object
by jkahn (Friar) on Sep 11, 2002 at 20:54 UTC | |
by artist (Parson) on Sep 11, 2002 at 21:36 UTC | |
|
Re: Storage Object
by broquaint (Abbot) on Sep 11, 2002 at 21:25 UTC |