2 #---------------------------------------------------------------------
4 #---------------------------------------------------------------------
11 my $class = ref($type) || $type;
13 my @valid_parm = ( 'member_one' );
16 foreach my $givenp ( keys %parm ) {
17 foreach my $validp ( @valid_parm ) {
18 $isvalid{$givenp} = 1 if( $givenp eq $validp );
20 die "ERROR in Example->new: Parameter $givenp is not valid\n"
21 unless( $isvalid{$givenp} );
24 my $this = ref($type) ?
$type : {};
26 die("Example->new: Scalar parameter member_one is of wrong type:" . ref(\
$parm{'member_one'}))
27 if (defined $parm{'member_one'}) and !(ref(\
$parm{'member_one'}) eq 'SCALAR');
28 $this -> {'member_one'} = defined $parm{'member_one'} ?
$parm{'member_one'} : 1;
32 # Start of Non-Dia code #
34 print "Entering \t".ref($this)." -> new\n" if ($this -> {'debug'});
35 print "This is code inside the constructor\n";
36 print "Leaving \t".ref($this)." -> new\n" if ($this -> {'debug'});
38 # End of Non-Dia code #
47 # Start of Non-Dia code #
48 print "Entering \t".ref($self)." -> member_one\n" if ($self -> {'debug'});
49 print "And this is code inside member_one accessor\n";
50 print "Leaving \t".ref($self)." -> member_one\n" if ($self -> {'debug'});
52 # End of Non-Dia code #
55 $self -> {'member_one'} = $parm;
57 return $self -> {'member_one'};
64 my @valid_parm = ( 'parm_one' );
67 foreach my $givenp ( keys %parm ) {
68 foreach my $validp ( @valid_parm ) {
69 $isvalid{$givenp} = 1 if( $givenp eq $validp );
71 die "ERROR in Example->method_one: Parameter $givenp is not valid\n"
72 unless( $isvalid{$givenp} );
75 die("Example->method_one: Scalar parameter parm_one is of wrong type:" . ref(\
$parm{'parm_one'}))
76 if (defined $parm{'parm_one'}) and !(ref(\
$parm{'parm_one'}) eq 'SCALAR');
77 my $parm_one = $parm{'parm_one'};
81 # Start of Non-Dia code #
83 print "Entering \t".ref($self)." -> method_one\n" if ($self -> {'debug'});
84 print "This is code inside method_one\n";
85 print "Leaving \t".ref($self)." -> method_one\n" if ($self -> {'debug'});
87 # End of Non-Dia code #
89 return \
@return_value;