X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Xchat%2FXPI.pm;h=f5a91d1b8f672013acf542402f5a57800efc1d19;hb=e20ffe1ad5d1657a1872d3f04c429ab5f64ddcf5;hp=f71bb1e84efcaf1cd77c83eaba6f433f8f481d52;hpb=263b6777b90548951a13bd56419fa911b010eb9b;p=perl%2Fscripts%2Fxchat.git diff --git a/Xchat/XPI.pm b/Xchat/XPI.pm index f71bb1e..f5a91d1 100644 --- a/Xchat/XPI.pm +++ b/Xchat/XPI.pm @@ -53,53 +53,8 @@ sub new { return $ph; } -sub tag { - my $ph = shift; - return unless $ph; - return *$ph->{tag}; -} - -sub name { - my $ph = shift; - return unless $ph; - return *$ph->{name}; -} - -sub version { - my $ph = shift; - return unless $ph; - return *$ph->{version}; -} - -sub desc { - my $ph = shift; - return unless $ph; - return *$ph->{desc}; -} - -sub author { - my $ph = shift; - return unless $ph; - return *$ph->{author}; -} - -sub email { - my $ph = shift; - return unless $ph; - return *$ph->{email}; -} - -sub url { - my $ph = shift; - return unless $ph; - return *$ph->{url}; -} - -sub banner { - my $ph = shift; - return unless $ph; - return *$ph->{banner}; -} +eval "sub $_ { *\$_[0]->{$_} }" + for qw/tag name version desc author email url banner/; sub print { my $ph = shift; @@ -155,10 +110,12 @@ sub PRINT { shift->print(@_) } sub PRINTF { shift->printf(@_) } -my $ph = new __PACKAGE__, name => 'Extended Xchat Perl Interface', - desc => 'Adds extended support for Perl scripts', - author => 'Vincent Pit (VPIT)', - email => 'perl@profvince.com', - url => 'http://www.profvince.com'; +my $ph = __PACKAGE__->new( + name => 'Extended Xchat Perl Interface', + desc => 'Adds extended support for Perl scripts', + author => 'Vincent Pit (VPIT)', + email => 'perl@profvince.com', + url => 'http://www.profvince.com', +); 1;