Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Perl snippet puzzle....

Status
Not open for further replies.

greaver

Programmer
Apr 29, 2002
31
CA
Hey Guys,

What does the bolded code do? I thought at first it was a code reference but there is no key subroutine in this class nor its parent (Exporter).

Code:
require 5.0;
package Change;
use strict;
use vars qw(@ISA @EXPORT);
use lib '.';
use convert;
use integer;
use Carp;
use Time::Local;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw ( timestamp datetime author change_description changelist
               filelist new get unget finished put submit);


sub new
{
  my ($class,$hash)=@_;
  my $change=bless [],$class;
  my $key;

  if(defined($hash)) {
    foreach $key (keys(%$hash)) {
      [b]$change->$key( $$hash{$key} );[/b]
    }
  }

  return $change;
}
 
I think $change->$key( ); is a reference to a sub with the value $$hash{$key} where $hash is the name of the hash and the key is $key
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top