]> err.no Git - libchamplain/commitdiff
Create the getters/setters for Champlain::MapSourceDesc
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sun, 17 May 2009 20:52:02 +0000 (22:52 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 18 May 2009 20:12:21 +0000 (16:12 -0400)
bindings/perl/Champlain/lib/Champlain.pm

index 99ac0a688a464809f59a3c7e9cbe1a85629c1919..38164f21c9899bec2250b8485fef0ac21cb760dc 100644 (file)
@@ -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;