diff options
Diffstat (limited to 'scripts/MarkdownBook')
-rw-r--r-- | scripts/MarkdownBook/Section.pm | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/scripts/MarkdownBook/Section.pm b/scripts/MarkdownBook/Section.pm index 7eb441c..c19a0d0 100644 --- a/scripts/MarkdownBook/Section.pm +++ b/scripts/MarkdownBook/Section.pm @@ -18,34 +18,42 @@ use warnings; package MarkdownBook::Section; +sub new +{ + my ($class, $doc, $num, $id, $title) = @_; + my $self; + + $class = ref($class) || $class; + $self = {}; + bless($self, $class); + + $self->{'document'} = $doc; + $self->{'number'} = $num; + $self->{'id'} = $id; + $self->{'title'} = $title; + + return $self; +} + sub number { my ($self, $number) = @_; - my $old = $self->{'number'}; - - $self->{'number'} = $number if defined($number); - return $old; + return $self->{'number'}; } sub id { my ($self, $id) = @_; - my $old = $self->{'id'}; - $self->{'id'} = $id if defined($id); - - return $old; + return $self->{'id'}; } sub title { my ($self, $title) = @_; - my $old = $self->{'title'}; - - $self->{'title'} = $title if defined($title); - return $old; + return $self->{'title'}; } 1; |