Moose subclassing for Asset/File/*

This commit is contained in:
Colin Kuskie 2010-04-09 10:36:16 -07:00
parent c35f3b9ffb
commit d3a3c4d37e
4 changed files with 36 additions and 36 deletions

View file

@ -85,7 +85,7 @@ C<options> is a hash reference of options and is currently not used.
=cut
sub applyConstraints {
override applyConstraints => sub {
my $self = shift;
my $options = shift;
my $gallery = $self->getGallery;
@ -108,8 +108,8 @@ sub applyConstraints {
$self->generateThumbnail;
$self->setSize;
$self->updateExifDataFromFile;
$self->SUPER::applyConstraints( $options );
}
super();
};
#-------------------------------------------------------------------
@ -247,10 +247,10 @@ Get a hash reference of template variables shared by all views of this asset.
=cut
sub getTemplateVars {
override getTemplateVars => sub {
my $self = shift;
my $session = $self->session;
my $var = $self->SUPER::getTemplateVars;
my $var = super();
### Download resolutions
for my $resolution ( @{ $self->getResolutions } ) {
@ -275,7 +275,7 @@ sub getTemplateVars {
}
return $var;
}
};
#----------------------------------------------------------------------------
@ -338,10 +338,10 @@ Make the default title into the file name minus the extention.
=cut
sub processPropertiesFromFormPost {
override processPropertiesFromFormPost => sub {
my $self = shift;
my $form = $self->session->form;
my $errors = $self->SUPER::processPropertiesFromFormPost || [];
my $errors = super() || [];
# Return if errors
return $errors if @$errors;
@ -366,7 +366,7 @@ sub processPropertiesFromFormPost {
}
return undef;
}
};
#----------------------------------------------------------------------------
@ -376,11 +376,11 @@ Extend the superclass setFile to automatically generate thumbnails.
=cut
sub setFile {
override setFile => sub {
my $self = shift;
$self->SUPER::setFile(@_);
super();
$self->generateThumbnail;
}
};
#----------------------------------------------------------------------------