in reply to Re^2: Destringify class
in thread Destringify class

Here's a demonstration of what I was writing about:

use strict; use warnings; package My::Self; sub new { bless $_[1] } package main; my $obj = My::Self->new({ authentic => int rand 1_000_000 }); my $to_be_required = './deleteme.pl'; open my $out_fh, '>', $to_be_required or die "Can't write '$to_be_required': $!"; print {$out_fh} <<"END_OF_SUBSCRIPT"; print "My name is '$to_be_required'\n"; print "I've heard of this self: ", \$main::self_everyone_knows->{authentic}, "\n"; print "Have a nice day!\n"; END_OF_SUBSCRIPT ; close $out_fh; $main::self_everyone_knows = $obj; require $to_be_required; print "Did it know $obj->{authentic}?\n"; unlink $to_be_required or die "Can't unlink '$to_be_required': $!"; __END__ My name is './deleteme.pl' I've heard of this self: 507287 Have a nice day! Did it know 507287?

Some things to note: