PHP::Session array issue

miyagawa on 2004-10-10T17:43:17

Someone has requested me to add a new feature to get PHP array back as a Perl array, in PHP::Session.

I think it can be done if we have a new method get_array(), to implicitly get array variables as Perl arrray ref:

sub get_array {
    my($self, $key) = @_;
    my $hashref = $self->get($key);
    return [ map $hashref->{$_}, sort { $a <=> $b } keys %$hashref ];
}


Additionaly, we can allow an object option (like auto_interpolate_array) to allow automatic conversion from PHP array to Perl array.

Suggestions are welcome.