From perldoc -f bless:
bless REF,CLASSNAMEThis function tells the thingy referenced by
REFthat it is now
an object in theCLASSNAMEpackage.
Is there any way of obtaining an unblessed structure without unnecessary copying?
Data::Structure::Util
unbless($ref)Remove the blessing from any objects found within the passed data structure.
#!/usr/bin/perl use strict; use warnings; use Scalar::Util qw( refaddr ); use Data::Structure::Util qw( unbless ); my $x = bless { a => 1, b => 2 } => 'My'; printf "%s : %s\n", ref $x, refaddr $x; unbless $x; printf "%s : %s\n", ref $x, refaddr $x; Output:
My : 237356 HASH : 237356
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With