Creé un módulo llamado PerlEasyCar
Es simple
package PerlEasyCart;
use strict;
use warnings;
use CGI::Session;
our $VERSION = '0.01000_13';
my $session = new CGI::Session();
use vars qw($VERSION @EXPORT);
require Exporter;
@EXPORT = qw(
addItem
items
);
sub new{
my ($class, @args) = @_;
my $self = {};
bless $self, $class;
return $self;
}
sub addItem{
my ( $self, $id, $cantidad ) = @_;
#my $hash = $session->param('productos');
#$hash->{$id} = $cantidad;
$session->param('prd-'.$id,$cantidad);
$session->flush();
return 1; ...