Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Breaking Tie::Hash into three modules

by afoken (Chancellor)
on Sep 08, 2018 at 18:26 UTC ( [id://1221954]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package My::Hash;
    use strict;
    use warnings;
    use parent 'Tie::Hash';
    1;
    
  2. or download this
    package My::Hash;
    use strict;
    use warnings;
    use parent 'Tie::StdHash';
    1;
    
  3. or download this
    package My::Hash;
    use strict;
    ...
    use Tie::Hash ();
    our @ISA='Tie::StdHash';
    1;
    
  4. or download this
    package My::Hash;
    # NO use strict; or things will break!
    ...
    require Tie::Hash;
    @ISA='Tie::StdHash';
    1;
    
  5. or download this
    # @ISA = qw(Tie::Hash);         # would inherit new() only
    
  6. or download this
    package Tie::ExtraHash;
    
    ...
    sub SCALAR   { scalar %{$_[0][0]} }
    
    1;
    
  7. or download this
    # The Tie::StdHash package implements standard perl hash behaviour.
    # It exists to act as a base class for classes which only wish to
    ...
    sub SCALAR   { scalar %{$_[0]} }
    
    1;
    
  8. or download this
    use Tie::StdHash;
    use Tie::ExtraHash;
    
  9. or download this
    
    =head1 NAME
    ...
    
    =cut
    
  10. or download this
    diff -Naur old/lib/Tie/ExtraHash.pm new/lib/Tie/ExtraHash.pm
    --- old/lib/Tie/ExtraHash.pm    1970-01-01 01:00:00.000000000 +0100
    ...
    +sub SCALAR   { scalar %{$_[0]} }
    +
    +1;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1221954]
Approved by marto
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-23 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found