annotate GD/Group.pm @ 0:e94de0ea3351 draft default tip

Uploaded
author dereeper
date Wed, 11 Sep 2013 09:08:15 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
1 package GD::Group;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
2
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
3 # Simple object for recursive grouping. Does absolutely nothing with GD,
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
4 # but works nicely with GD::SVG.
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
5
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
6 use strict;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
7
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
8 our $AUTOLOAD;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
9 our $VERSION = 1.00;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
10
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
11 sub AUTOLOAD {
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
12 my ($pack,$func_name) = $AUTOLOAD =~ /(.+)::([^:]+)$/;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
13 my $this = shift;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
14 $this->{gd}->currentGroup($this->{group});
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
15 $this->{gd}->$func_name(@_);
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
16 }
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
17
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
18 sub new {
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
19 my $this = shift;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
20 my ($gd,$group) = @_;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
21 return bless {gd => $gd,
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
22 group => $group},ref $this || $this;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
23 }
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
24
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
25 sub DESTROY {
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
26 my $this = shift;
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
27 my $gd = $this->{gd};
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
28 my $grp = $this->{group};
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
29 $gd->endGroup($grp);
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
30 }
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
31
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
32
e94de0ea3351 Uploaded
dereeper
parents:
diff changeset
33 1;