sub base :Chained('/') :PathPart('admin') :CaptureArgs(0) { my ($self, $c) = @_; $c->stash( users => $c->model('DB::Tech')); $c->log->debug('*** INSIDE BASE METHOD ***'); } sub list :Chained('base') :PathPart('list') :Args(0) { my ($self, $c) = @_; $c->stash( users => $c->model('DB::Tech')->search_rs ); $c->stash(template => 'admin/list.tt2'); } sub add :Chained('base') :PathPart('add') :Args(0) { my ($self, $c) = @_; $c->stash(template => 'admin/new.tt2'); } sub add_do :Chained('base') :PathPart('add_do') :Args(0) { my ($self, $c) = @_; # Retrieve the values fro mthe form my $username = $c->request->params->{username}; my $password = $c->request->params->{password}; my $fname = $c->request->params->{fname}; my $lname = $c->request->params->{lname}; my $email = $c->request->params->{email}; my $phone = $c->request->params->{phone}; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime time; $year += 1900; my @month_abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my $date = "$year-$month_abbr[$mon]-$mday"; # Create the tech my $user = $c->model('DB::Tech')->create({ id => $username, password => $password, firstname => $fname, lastname => $lname, email => $email, phone => $phone, managementrating => '5', managementcomments => q[], date => $date, ismanagement => '0', }); $Data::Dumper::Useperl = 1; $c->stash(users => $user, template => 'admin/create_done.tt2'); }