in reply to Saving code from an anonymous coderef
You'd have to serialize codeStr and then eval it when you load, but you won't be able to escape that anyhow, I think.new ObjectName( codeStr => 'sub { do some perl stuff with @_ }' ); package ObjectName; #... sub new { #...., not forgetting to set $self->{codeStr} from args $self->{code}=eval $self->{codeStr}; } #...
|
|---|