Add hashwide getters for AdSpace and Ad.pm
Fix a bug in Ad/set where if no properties were passed it would die.
This commit is contained in:
parent
d82e5a590a
commit
15d3ec323a
2 changed files with 11 additions and 3 deletions
|
|
@ -158,7 +158,11 @@ The name of the property to retrieve the value for.
|
|||
sub get {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
return $self->{_properties}{$name};
|
||||
if (defined $name) {
|
||||
return $self->{_properties}{$name}
|
||||
}
|
||||
my %copyOfProperties = %{ $self->{_properties} };
|
||||
return \%copyOfProperties;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -115,7 +115,11 @@ The name of the property to retrieve the value for.
|
|||
sub get {
|
||||
my $self = shift;
|
||||
my $name = shift;
|
||||
return $self->{_properties}{$name};
|
||||
if (defined $name) {
|
||||
return $self->{_properties}{$name}
|
||||
}
|
||||
my %copyOfProperties = %{ $self->{_properties} };
|
||||
return \%copyOfProperties;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -239,7 +243,7 @@ The number of times the user has paid for this ad to be displayed on the site.
|
|||
|
||||
sub set {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $properties = shift || {};
|
||||
$self->{_properties}{title} = $properties->{title} || $self->{_properties}{title} || "Untitled";
|
||||
$self->{_properties}{clicksBought} = $properties->{clicksBought} || $self->{_properties}{clicksBought};
|
||||
$self->{_properties}{impressionsBought} = $properties->{impressionsBought} || $self->{_properties}{impressionsBought};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue