[prev] [thread] [next] [lurker] [Date index for 2004/07/02]
--Apple-Mail-12-941668700 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Hi list, following instructions in Pixie::Complicity to make DateTime objects persistent I'm facing a error message while accessing object: Can't locate object method "ymd" via package "Memento::DateTime" at /Library/Perl/5.8.1/darwin-thread-multi-2level/Pixie/Proxy.pm line 194. It seems Pixie::Proxy::px_restore is not returning the object created in Memento::DateTime::px_thaw but rather creates a new one. Did I something wrong in my script? Any advice is appreciated! --Apple-Mail-12-941668700 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="test.pl" Content-Disposition: attachment; filename=test.pl use Pixie; use Data::Dumper; use DateTime; my $DATABASE2 = '192.168.202.133'; my @Pixie =( 'dbi:mysql:PIXIE:' . $DATABASE2, user => 'root' ); my $pixie = Pixie->new()->connect( @Pixie ); my $q = HOT::Query->new( ); $q->parameter( CITY => 'Madrid', COUNTRY => 'ES', CI_DATE => DateTime->new( year => 2004, month => 8, day => 3)); #print Dumper( $q); my $cookie = $pixie->insert( $q); undef $q; my $b = $pixie->get( $cookie); #print Dumper( $b); print $b->{CI_DATE}->ymd(); sub DateTime::px_is_storable { 1 } sub DateTime::px_freeze { my $self = shift; return bless { year => $self->year(), month => $self->month(), day => $self->day() , hour => $self->hour()}, 'Memento::DateTime'; } sub Memento::DateTime::px_thaw { my $self = shift; return DateTime->new(%$self); } package HOT::Query; sub new { my $class = shift; bless {},$class; } sub parameter { my $self = shift; my (%args,$key); if (@_){ #set parameter %args = @_> 1 ? (@_) : %{$_[0]}; foreach $key (qw/CITY COUNTRY CI_DATE/){ next unless defined($args{$key}); $self->{$key}=$args{$key}; } } return \%args; } 1; --Apple-Mail-12-941668700 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Cheers, Dieter =^..^= --Apple-Mail-12-941668700--
Generated at 09:01 on 03 Aug 2004 by mariachi 0.52