I'd been using Data::Dump::Streamer as a method of writing coderefs to a file. When I needed to put a coderef into a string to display in a tk widget, it didn't take long to figure out how:
use strict; use warnings; use Data::Dump::Streamer; my $coderef=sub{ my $var = shift; print "$var is a test\n";}; print $coderef."\n"; $coderef->("this"); my $string= Dump($coderef)->Out(); print $string."\n";
In reply to coderef as a string by g0n
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |