| 1 | package DBIx::dbMan::Extension::SQLResultPreprocess; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base 'DBIx::dbMan::Extension'; | ||
| 5 | |||
| 6 | our $VERSION = '0.06'; | ||
| 7 | |||
| 8 | 1; | ||
| 9 | |||
| 10 | sub IDENTIFICATION { return "000001-000054-000006"; } | ||
| 11 | |||
| 12 | sub preference { return 50; } | ||
| 13 | |||
| 14 | sub known_actions { return [ qw/SQL_RESULT/ ]; } | ||
| 15 | |||
| 16 | sub handle_action { | ||
| 17 | my ($obj,%action) = @_; | ||
| 18 | |||
| 19 | $action{processed} = 1; | ||
| 20 | if ($action{action} eq 'SQL_RESULT' and not $action{sql_result_preprocess} and ref $action{result} eq 'ARRAY') { | ||
| 21 | @$_ = map { (defined) ? join '',(map { ($_ >= 32 && $_ != 255 && $_ != 127)?chr:sprintf "<%02x>",$_; } unpack "C*",$_) : undef } @$_ for @{$action{result}}; | ||
| 22 | |||
| 23 | $action{sql_result_preprocess} = 1; | ||
| 24 | delete $action{processed}; | ||
| 25 | } | ||
| 26 | |||
| 27 | return %action; | ||
| 28 | } |