From: Vincent Pit Date: Wed, 2 Sep 2009 19:15:50 +0000 (+0200) Subject: Autogenerate accessors X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=e20ffe1ad5d1657a1872d3f04c429ab5f64ddcf5;hp=b9c3e00cbf52ff5ddb0d79fd66a6877f6feb508d;p=perl%2Fscripts%2Fxchat.git Autogenerate accessors --- diff --git a/Xchat/XPI.pm b/Xchat/XPI.pm index 032957d..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;