X-Git-Url: http://source.jalview.org/gitweb/?p=jpred.git;a=blobdiff_plain;f=jpred%2Flib%2FRoot.pm;h=7e79a07d07f712442c2a134400a92edc80f91a59;hp=e25c776c58ebd88294a20aad751ddf0a5d3d7961;hb=eb3001dc41bf6cd46e20fd13fe3efbe9dedf6013;hpb=2cf032f4b987ba747c04159965aed78e3820d942 diff --git a/jpred/lib/Root.pm b/jpred/lib/Root.pm index e25c776..7e79a07 100644 --- a/jpred/lib/Root.pm +++ b/jpred/lib/Root.pm @@ -19,38 +19,41 @@ This modules provides a new method for other classes to use if they so wish. =head2 new(foo => "bar") -This constructs an object of the right class and returns it. Any arugments passed to the constructer will be parsed as a hash with the first argument from the pair acting as the method that should be called and the second being the argument for that method. +This constructs an object of the right class and returns it. Any arugments passed to the constructer +will be parsed as a hash with the first argument from the pair acting as the method that should +be called and the second being the argument for that method. =cut sub new { - my ($class, %args) = @_; - my $self = bless {}, ref($class) || $class; + my ( $class, %args ) = @_; + my $self = bless {}, ref($class) || $class; - for (keys %args) { - croak "No such method '$_'" unless $self->can($_); - $self->$_($args{$_}); - } + for ( keys %args ) { + croak "No such method '$_'" unless $self->can($_); + $self->$_( $args{$_} ); + } - return $self; + return $self; } sub trace { - my ($self) = @_; + my ($self) = @_; - my $i = 1; + my $i = 1; - while (my @caller = caller $i) { - #print join("#", map { defined $_ ? $_ : ""} @caller), "\n"; - print $caller[0], ":", $caller[2], " ", $caller[3], "\n"; - $i++; - } + while ( my @caller = caller $i ) { + + #print join("#", map { defined $_ ? $_ : ""} @caller), "\n"; + print $caller[0], ":", $caller[2], " ", $caller[3], "\n"; + $i++; + } } sub warn { - my ($self, @message) = @_; - print STDERR join("\n", @message), "\n"; - $self->trace; + my ( $self, @message ) = @_; + print STDERR join( "\n", @message ), "\n"; + $self->trace; } 1;