|
From: <ix...@us...> - 2001-12-02 09:47:22
|
ixjonez 01/12/02 01:47:21
Added: lib/LiveFrame Photo.pm
Log:
add a class representing an individual Photo
Revision Changes Path
1.1 commons/lib/LiveFrame/Photo.pm
Index: Photo.pm
===================================================================
# -*- Mode: Perl; indent-tabs-mode: nil; -*-
package LiveFrame::Photo;
use File::Basename ();
use strict;
sub new {
my ($type, $path) = @_;
my $class = ref($type) || $type;
my $self = bless
{
caption => undef,
height => undef,
path => $path,
width => undef,
}, $class;
return $self;
}
## accessor methods
sub caption {
my $self = shift;
$self->{caption} = shift if @_;
return $self->{caption};
}
sub height {
my $self = shift;
$self->{height} = shift if @_;
return $self->{height};
}
sub path {
my $self = shift;
$self->{path} = shift if @_;
return $self->{path};
}
sub width {
my $self = shift;
$self->{width} = shift if @_;
return $self->{width};
}
## public methods
sub basename {
my ($self) = @_;
return File::Basename::basename($self->path());
}
sub clone {
my ($self) = @_;
return ref($self)->new($self->path());
}
sub dirname {
my ($self) = @_;
return File::Basename::dirname($self->path());
}
1;
|