sathish_cudd has asked for the wisdom of the Perl Monks concerning the following question:
Hey Guys,
I am trying to edit the object parse. But am not successful, Please provide your thoughts and inputs.
This is my First class
and my main program,#!/usr/bin/perl use strict; use warnings; use Data::Dumper; package First; use Params::Validate qw(validate :types); our @EXPORT = qw(teller); our %params = ( 'A' => {'TYPE' => SCALAR}, 'B' => {'TYPE' => SCALAR} ); sub new { my ($class, @parameters) = @_; my $validate = {%params}; my $self = {validate(@parameters, $validate)}; return bless ($self,$class); } sub teller(){ my ($a) = shift; print Data::Dumper->Dump([$a]),"\n"; return 0; }
I am expecting to see the A value as Yellow, but it red. Can some one tell how to change the values of object? Please ignore the for loop. its just for testing.#!/usr/bin/perl use strict; use warnings; use First qw(teller); my $obj = new First('A' => 'red','B'=>'green'); for (1..3 ) { # print ref($obj),"\n"; $obj->teller('Called', 'A' => 'Yellow'); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Modify the Object
by Athanasius (Archbishop) on Oct 02, 2012 at 13:02 UTC | |
by tobyink (Canon) on Oct 02, 2012 at 16:02 UTC | |
by Your Mother (Archbishop) on Oct 02, 2012 at 17:06 UTC | |
Re: Modify the Object
by 2teez (Vicar) on Oct 02, 2012 at 13:13 UTC |
Back to
Seekers of Perl Wisdom