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";
In reply to PM module question/improvements by perlynewby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |