Skip to content

Commit

Permalink
add override_stringify config option
Browse files Browse the repository at this point in the history
  • Loading branch information
zmughal committed Mar 4, 2013
1 parent 22c8655 commit 2a4b87c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/Devel/REPL/Plugin/DataPrinter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ around 'format_result' => sub {
);
if (@to_dump != 1 || ref $to_dump[0]) {
if (@to_dump == 1) {
if ( overload::Method($to_dump[0], '""') ) {
if ( overload::Method($to_dump[0], '""')
and not exists $config{override_stringify}{ref $to_dump[0]} ) {
$out = "@to_dump";
}
else {
Expand Down Expand Up @@ -75,6 +76,25 @@ C<use_prototypes> and C<return_value>. Note that C<dataprinter_config> only
applies to the printing that the REPL does; if you invoke C<p()> in your REPL
session yourself, these settings are B<not> applied.
=head2 Devel::REPL::Plugin::DataPrinter specific customization
=over
=item override_stringify
If the reference being printed has a stringification overloaded method and you
do not want to use it by default, you can configure an override:
$_REPL->dataprinter_config({
caller_info => 0,
override_stringify => {
'DateTime' => 1,
},
});
=cut
=head1 SEE ALSO
* L<Devel::REPL>
Expand Down

0 comments on commit 2a4b87c

Please sign in to comment.