exilepanda has asked for the wisdom of the Perl Monks concerning the following question:
package Whatever; sub new { bless { foo => 'bar' }, shift; } 1; package main; use Storable; my $obj = new -> Whatever; store $obj , "somefile.sto";
Given a condition like the code above, the Storable file will store the data structure with it's class. But what I want to do is only store { foo => 'bar' } without the blessed ref.
I can actually do this with unbless from Data::Structure::Util qw( unbless );
However, I remember I did get this job done with a simpler way yrs ago without using module. Seem I had played with of sort of de-referencing trick, but I really forget how to make that up anyway. Do you know how?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Store only object data but not the whole class
by salva (Canon) on Aug 30, 2016 at 10:41 UTC | |
by exilepanda (Friar) on Aug 30, 2016 at 11:58 UTC | |
|
Re: Store only object data but not the whole class
by Discipulus (Canon) on Aug 30, 2016 at 10:57 UTC | |
|
Re: Store only object data but not the whole class
by NetWallah (Canon) on Aug 30, 2016 at 13:56 UTC | |
by AnomalousMonk (Archbishop) on Aug 30, 2016 at 18:37 UTC | |
by kcott (Archbishop) on Aug 31, 2016 at 06:01 UTC | |
by NetWallah (Canon) on Aug 30, 2016 at 19:00 UTC | |
by exilepanda (Friar) on Aug 30, 2016 at 15:13 UTC | |
by stevieb (Canon) on Aug 30, 2016 at 15:19 UTC |