```{index} single: get_view (Peta::LMDB::Txn) ``` ```{index} single: Peta::LMDB::Txn::get_view ``` # get_view Look up a key and make a variable the value itself, without copying it: for large values read once. ## Synopsis ```perl my $view; if ($txn->get_view($db, $key, $view)) { print length $view } ``` ## What you get back True when the key is stored, with `$view` a read-only string over the value in the database's memory map; false when not, with `$view` undef. ## Edge cases - `$view` becomes undef when the transaction ends, and in a write transaction at its next write: copy what must outlive that (`my $copy = $view`). - Assigning to `$view` croaks `Modification of a read-only value attempted`; a later `get_view` into the same variable replaces it. - The view must be a plain scalar variable, given as the argument: a returned value would be copied by the assignment. ## See also - `get` - a copy of the value