perlynewby has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks, I have created some simple modules but it fails because it says I may need to install them first(maybe...I don't know?).
my question to you is,do I have to install them every time before even testing them?
it seems like alot of work before I even get to see them work correctly and,if not, debug and re-install can be a hassle
is there a way to circumvent that during testing ?
these are the code for your review, I will appreciate any criticism to improve format and readability. Looking for your advice in improving my scripts as always ;-)
package Dreamcar; sub modello{ my ($macchina, $modello) = @_; $modello && ($macchina->{'Modello'}=$modello); return $macchina->{'Modello'}; } 1;
package Scuderia; use Dreamcar; @ISA = qw[Dreamcar]; sub tipo{ my ($macchina, $tipo)=@_; if ($tipo){$macchina->{'Tipo'}=$tipo}; return $macchina_>{'Tipo'}; } 1;
package Da_corsa; use Scuderia;; @ISA= "Scuderia"; # we say that ISA e' macchina da corsa nella scuderi +a famosa #declaring a class of racing car sub class{ my($class)=@; my $macchina ={}; #empty anonomous hash bless $macchina, $class; return $macchina; } sub tempo_sul_giro { my ($macchina, $tempo)=@_; $tempo && ($macchina->{'Tempo_sul_Giro'}=$tempo); return $macchina->{'Tempo_sul_Giro'}; }
#testing the modules use strict; use warnings; use Data::Dump qw(dump); use Da_corsa; #inheritance adesso my $da_corsa = Da_corsa->class(); $da_corsa-> modello('Ferrari'); $da_corsa-> tipo('LaFerrari'); $da_corsa -> tempo_sul_giro('2.8 secondi'); print "the Racing car is from ", $da_corsa->modello()," and the type i +s ",$da_corsa->tipo(), " and can do 0-60MPH in : ", $da_corsa->tempo_dal_giro(),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PM module question/improvements
by 1nickt (Canon) on Nov 07, 2015 at 01:11 UTC | |
by perlynewby (Scribe) on Nov 07, 2015 at 02:34 UTC | |
by 1nickt (Canon) on Nov 07, 2015 at 03:16 UTC | |
by Anonymous Monk on Nov 07, 2015 at 03:26 UTC | |
by perlynewby (Scribe) on Nov 07, 2015 at 04:05 UTC | |
|
Re: PM module question/improvements
by stevieb (Canon) on Nov 07, 2015 at 03:11 UTC | |
by perlynewby (Scribe) on Nov 09, 2015 at 21:44 UTC | |
by Anonymous Monk on Nov 10, 2015 at 00:23 UTC | |
by perlynewby (Scribe) on Nov 10, 2015 at 01:56 UTC |