diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
commit | 12679ab7d3c2a210f4123163671b532b8b55d5f9 (patch) | |
tree | 0060d13467186ad977f4e73488ee20dd6c0017ab /systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm | |
parent | 62170822e034fdd3f81de7274835d0d3b0467100 (diff) |
CTAN sync 202403150306
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm')
-rw-r--r-- | systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm index c593dc7c39..a574734e5c 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Class/Struct.pm @@ -14,7 +14,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(struct); -$VERSION = '0.66'; +$VERSION = '0.68'; my $print = 0; sub printem { @@ -84,7 +84,7 @@ sub struct { } else { $base_type = 'ARRAY'; - $class = (caller())[0]; + $class = caller(); @decls = @_; } @@ -275,24 +275,24 @@ Class::Struct - declare struct-like datatypes as Perl classes # declare struct with four types of elements: struct( s => '$', a => '@', h => '%', c => 'My_Other_Class' ); - $obj = new Myobj; # constructor + my $obj = Myobj->new; # constructor # scalar type accessor: - $element_value = $obj->s; # element value + my $element_value = $obj->s; # element value $obj->s('new value'); # assign to element # array type accessor: - $ary_ref = $obj->a; # reference to whole array - $ary_element_value = $obj->a(2); # array element value + my $ary_ref = $obj->a; # reference to whole array + my $ary_element_value = $obj->a(2); # array element value $obj->a(2, 'new value'); # assign to array element # hash type accessor: - $hash_ref = $obj->h; # reference to whole hash - $hash_element_value = $obj->h('x'); # hash element value + my $hash_ref = $obj->h; # reference to whole hash + my $hash_element_value = $obj->h('x'); # hash element value $obj->h('x', 'new value'); # assign to hash element # class type accessor: - $element_value = $obj->c; # object reference + my $element_value = $obj->c; # object reference $obj->c->method(...); # call method of object $obj->c(new My_Other_Class); # assign a new object |