From e6c09e50a8d6e16b563823199b739e44275af912 Mon Sep 17 00:00:00 2001 From: Emmanuel Rodriguez Date: Sun, 17 May 2009 22:52:02 +0200 Subject: [PATCH] Create the getters/setters for Champlain::MapSourceDesc --- bindings/perl/Champlain/lib/Champlain.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bindings/perl/Champlain/lib/Champlain.pm b/bindings/perl/Champlain/lib/Champlain.pm index 99ac0a6..38164f2 100644 --- a/bindings/perl/Champlain/lib/Champlain.pm +++ b/bindings/perl/Champlain/lib/Champlain.pm @@ -146,5 +146,23 @@ sub dl_load_flags { $^O eq 'darwin' ? 0x00 : 0x01 } __PACKAGE__->bootstrap($VERSION); -1; +package Champlain::MapSourceDesc; + +BEGIN { + # Create getters and setters for the properties + my @properties = qw( + id name license license_uri min_zoom_level max_zoom_level projection + ); + foreach my $property (@properties) { + my $get_name = join '::', __PACKAGE__, "get_$property"; + my $set_same = join '::', __PACKAGE__, "set_$property"; + my $getter = sub {return $_[0]->{$property};}; + my $setter = sub {return $_[0]->{$property} = $_[1];}; + no strict; + *{$get_name} = $getter; + *{$set_same} = $setter; + } +} + +1; -- 2.39.5