Advertisement
hackloper775

persona.pm

Dec 29th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.58 KB | None | 0 0
  1. package persona;
  2.  
  3. sub new {
  4.     my $class = shift;
  5.     my $self = {};
  6.     bless $self,$class;
  7.     return $self;
  8. }
  9.  
  10. sub setName {
  11.     my ($self,$n) = @_;
  12.     $self->{NOMBRE} = $n;
  13. }
  14.  
  15. sub getName {
  16.     my $self = shift;
  17.     #$self->borraNombre();
  18.     if ($self->{NOMBRE}) {
  19.         return $self->{NOMBRE};
  20.     } else
  21.     {
  22.         return "Sin sombre";
  23.     }
  24. }
  25.  
  26. sub borraNombre {
  27.     my $self = shift;
  28.     if ($self->{NOMBRE})
  29.     {
  30.         $self->{NOMBRE} = "Borre el nombre";
  31.     }
  32. }
  33. sub destruye
  34. {
  35.    my $self=shift;
  36.    delete ($self->{NOMBRE});
  37. }
  38. 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement