]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - Xchat/XPI.pm
Autogenerate accessors
[perl/scripts/xchat.git] / Xchat / XPI.pm
index f71bb1e84efcaf1cd77c83eaba6f433f8f481d52..f5a91d1b8f672013acf542402f5a57800efc1d19 100644 (file)
@@ -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;