1 package toy_module; 2 3 sub new { 4 my ($class, $args) = @_; 5 my $self = { 6 simple_hash => $args->{simple_hash}, 7 simple_test_scalar => $args->{simple_test_scalar}, 8 }; 9 print "********** INSIDE SUBROUTINE NEW **********\n"; 10 print "simple scalar: ".$self->{simple_test_scalar}."\n"; 11 print "$_\n" for keys %$self->{simple_hash}; 12 return bless $self, $class; 13 } 14 15 sub show_simple_hash { 16 my $self = shift; 17 print "********** INSIDE SUBROUTINE SHOW_SIMPLE_HASH **********\n"; 18 print "simple scalar: ".$self->{simple_test_scalar}."\n"; 19 print "$_\n" for keys %$self->{simple_hash}; 20 } 21 22 1; #### 1 use strict; 2 use warnings; 3 use lib '~/working/toys'; 4 use toy_module; 5 6 my %little_test_hash = ( 7 COL_1 => 0, 8 COL_2 => 1, 9 COL_3 => 2, 10 COL_4 => 3, 11 COL_5 => 4, 12 ); 13 my $little_test_hash_ref = %little_test_hash; 14 15 my $test_object = toy_module->new({simple_hash=>$little_test_hash_ref, simple_test_scalar=>5}); 16 my $next_test = $test_object->show_simple_hash; #### MacBook-Pro:toys mcrepeau$ perl test_toy_module.pl Using a hash as a reference is deprecated at toy_module.pm line 11. Using a hash as a reference is deprecated at toy_module.pm line 19. ********** INSIDE SUBROUTINE NEW ********** simple scalar: 5 Type of argument to keys on reference must be unblessed hashref or arrayref at toy_module.pm line 11.