« blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/Dwarf/Module/SocialMedia/Mixi.pm
↑ Summary
blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/Dwarf/Accessor.pm »
| 1 | package Dwarf::Session; | ||
| 2 | use Dwarf::Pragma; | ||
| 3 | use parent 'HTTP::Session'; | ||
| 4 | |||
| 5 | sub param { | ||
| 6 | my $self = shift; | ||
| 7 | if (@_ > 1) { | ||
| 8 | $self->set(@_); | ||
| 9 | } | ||
| 10 | return $self->get($_[0]); | ||
| 11 | } | ||
| 12 | |||
| 13 | sub id { shift->session_id(@_) } | ||
| 14 | sub dataref { shift->as_hashref(@_) } | ||
| 15 | sub refresh { shift->regenerate_session_id(@_) } | ||
| 16 | |||
| 17 | sub flush { | ||
| 18 | my ($self, ) = @_; | ||
| 19 | |||
| 20 | if ($self->is_fresh) { | ||
| 21 | if ($self->is_changed || !$self->save_modified_session_only) { | ||
| 22 | $self->store->insert( $self->session_id, $self->_data ); | ||
| 23 | $self->is_fresh(0); | ||
| 24 | } | ||
| 25 | } else { | ||
| 26 | if ($self->is_changed) { | ||
| 27 | $self->store->update( $self->session_id, $self->_data ); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |