perl - Newbie Moose, MooseX::Storage, and MooseX::Log4Perl problem: Can't store object -
I am writing my first base base program. At the end of the program, I want to save the "State" object in a file, the program creates a "state" object that is composed of several other object objects. I am trying to use MooseX :: Storage to do this. I am getting an error (below) which means that he is trying to sort the MooseX :: Log :: Log4perl object.
Object (Log :: log4perl :: Logger = HASH (0x2211c800)) & amp; Pack method is not, /usr/lib/perl5/site_perl/5.8.8/ MooseX / Storage / Engine.pm Line 205 MooseX :: Storage :: Engine :: __ ANON__ ('Log :: Log4perl: : Logger = HASH (0x2211c800) ',' HASH (0x20c54890) ') which is called / usr / lib / perl5 /site_perl/5.8.8/MooseX/Storage/Engine.pm line 88 MooseX :: Storage :: Engine: 'Collapse_attribute_value' ('MooseX :: archive :: engine = HASH (0x2211cac0)', 'Moose :: Meta :: attribute = HASH (0x20419510)', 'HSH (0x20c54890)' which is / usr / lib / perl5 / site_perl / 5.8.8 / MooseX / Storage / Angeli PM line 60 MooseX :: archive :: engine :: collapse_attribute ('MooseX :: storage :: engine = hash (0x2211cac0)', 'mousse :: meta :: attribution = hash (0x20419510)', 'hash (0x20c54890)' ) Which has been called at /usr/lib/perl5/site_perl/5.8.8 / MOXX / Storage / Angin. PM line 141 MooseX :: archive :: engine :: map_right ('MooseX :: archive :: engine = HAAH (0x2211cac0)', 'collapse_attribute', 'hsph (0x20c54890)') / usr / lib / perl5 / site_perl / 5.8.8 / moosex / storage / engine.pm line 37 MooseX :: archive :: engine :: collapse_object ('MooseX :: archive :: engine = hash (0x2211cac0') which /usr/lib/perl5/site_perl/5.8 .8 / MooseX / Storage / Basic.pm is called 13 MooseX :: Storage :: Basic :: Pack ('ScanTrr :: Stat = Hash (0x2100ee40')) which is / usr / lib / perl5 / site_perl / 5.8.8 / MooseX / Storage / Format / JSON.pm line has been called on 24 MooseX :: Storage :: Pro Format: JSON :: Freeze ('ScanTraft :: Stat = HSH (0x2100ee40'), which is called on /usr/lib/perl5/site_perl/5.8.8/MooseX/ storage / IO / file. Pm line 19 This is my setup. I have a square called "ScanCtr :: ScanMe" and it only does this:
Package ScanCtr: : ScanMe; Use mousse; With 'MooseX :: log :: log4perl'; Use namespace: Autoclane; Use log: Log4perl qw (: easy); BEGIN {log :: login 4-PL- & gt; Easy_init ({level = & gt; $ DEBUG, file = & gt; "gt; & gt; /var/log/sc.log", layout = & gt; '% d% p [% P]% L% M% n ',}); }; 1; This object, along with the expansion of my object (which may be my problem), therefore, I am going to $ self-> Log-& gt; I can do stuff like debug ("debug message"). ; For each of my articles, for example: package ScanCtr :: state; Use ScanCtr :: Request; Use mousse; 'ScanCtr :: ScanMe' is extensively; Moose :: Util :: Use TypeConstraints; MooseX :: Use Storage; Our $ version = '0.01'; With storage ('format' = & gt; 'JSON', 'IO' = & gt; 'file'); Use namespace: Autoclane; 'Request' = & gt; (Hash =), has => 'rw', isa = & gt; hashff [scannedtread :: request] ', default => sub {{}}, handle = & To get 'Count', go to = 'Go', Set =>, 'Set', Confirm Deletion & & gt; 'Delete', request_keys = & gt; ; 'Keys', kv = & gt; 'kv',}); 1; So is there any way to exclude MooseX :: Log :: Log4perl from storage? Is there a better way to avoid this problem? Am I making the mistakes of other novices?
Thanks for any help, Todd.
It should work (but I have not tested it) . Inside ScanCtr :: ScanMe you override the logger attribute and apply MooseX :: Storage DoNotSerialize attribute. Package ScanCtr :: ScanMe; Use mousse; With 'MooseX :: log :: log4perl'; Use namespace: Autoclane; Use log: Log4perl qw (: easy); BEGIN {log :: login 4-PL- & gt; Easy_init ({level = & gt; $ DEBUG, file = & gt; "gt; & gt; /var/log/sc.log", layout = & gt; '% d% p [% P]% L% M% n ',}); }; 'Logger' = & gt; {Symptoms = & gt; ['DoNotSerialize']}; 1;
Comments
Post a Comment