| Server IP : 162.241.219.206 / Your IP : 216.73.216.195 Web Server : Apache System : Linux box5669.bluehost.com 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64 User : signavd5 ( 2863) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/perl-Hash-FieldHash/example/ |
Upload File : |
#!perl -w
use strict;
package MyClass;
use Hash::FieldHash qw(:all);
fieldhash my %foo => 'foo';
sub new{
my $class = shift;
my $self = bless {}, $class;
return from_hash($self, @_);
}
package MyDerivedClass;
use parent -norequire => 'MyClass';
use Hash::FieldHash qw(:all);
fieldhash my %bar => 'bar';
package main;
my $o = MyDerivedClass->new(foo => 10, bar => 20);
my $p = MyDerivedClass->new('MyClass::foo' => 10, 'MyDerivedClass::bar' => 20);
use Data::Dumper;
print Dumper($o->to_hash());
# $VAR1 = { foo => 10, bar => 20 }
print Dumper($o->to_hash(-fully_qualify));
# $VAR1 = { 'MyClass::foo' => 10, 'MyDerived::bar' => 20 }