in reply to How to return $ref from: $ref = $sth->fetchall_arrayref;
DBI does some tricky optimizations. You should consider that reference to be owned by the $sth so when you closed your database connection, it appears you also cleared your results. Try making a shallow copy of the data first and if that doesn't work, make a deep copy.
sub select_query { # shallow copy my @results = @{ $sth->fetchall_arrayref() || [] }; return \ @result; } use Storable 'dclone'; sub select_query { # deep copy my @results = @{ dclone( $sth->fetchall_arrayref() ) || [] }; return \ @result; }
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|