#### #!/usr/bin/perl use Person; use strict; use warnings; use Employee; my $dirToBePassed = "/path/Dir"; my $object = new Person( "Thanos", "Test", 123456); my $firstName = $object->getFirstName(); print "This is the first name: $firstName\n"; my $secondObject = new Employee( "refToBeUsed" ); my $solution = $secondObject->somethingCalledFromMain(); print "This is the solution : $solution\n"; #### #!/usr/bin/perl use strict; use warnings; package Employee; sub new { my $class = shift; my $self = { refFromMain => shift, }; bless $self, $class; return $self; } sub somethingCalledFromMain { my( $self ) = @_; =comment do something here; warn "I was not able to complete the process!\n"; =cut return $self->{refFromMain}; } my %WARNS; local $SIG{__WARN__} = sub { my $message = shift; return if $WARNS{$message}++; logger('warning', $message); }; sub logger { my ($level, $msg) = @_; if (open my $out, '>>', 'log.txt') { chomp $msg; print $out "$level - $msg\n"; close $out; } } 1; #### This is the first name: Thanos This is the solution : refToBeUsed