|
Lines 379-384
sub add_message {
Link Here
|
| 379 |
return $self; |
379 |
return $self; |
| 380 |
} |
380 |
} |
| 381 |
|
381 |
|
|
|
382 |
=head3 $object->stash |
| 383 |
|
| 384 |
Add the ability to stash things in an object |
| 385 |
|
| 386 |
$object->stash({ key => $value }); |
| 387 |
$object->stash({ key1 => $value1, key2 => $value2 }); |
| 388 |
|
| 389 |
my $value = $object->stash($key); |
| 390 |
|
| 391 |
my $stash = $object->stash; |
| 392 |
|
| 393 |
=cut |
| 394 |
|
| 395 |
sub stash { |
| 396 |
my ( $self, $params ) = @_; |
| 397 |
|
| 398 |
if ( !$params ) { |
| 399 |
return $self->{_stash}; |
| 400 |
} |
| 401 |
elsif ( ref $params eq 'HASH' ) { |
| 402 |
$self->{_stash}->{$_} = $params->{$_} for keys %$params; |
| 403 |
} |
| 404 |
else { |
| 405 |
return $self->{_stash}->{$params}; |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 382 |
=head3 $object->TO_JSON |
409 |
=head3 $object->TO_JSON |
| 383 |
|
410 |
|
| 384 |
Returns an unblessed representation of the object, suitable for JSON output. |
411 |
Returns an unblessed representation of the object, suitable for JSON output. |
| 385 |
- |
|
|