Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: MVC Catalyst Architecture - City, State Zip locator

by ChristinaH (Initiate)
on Jul 18, 2008 at 18:49 UTC ( [id://698705] : note . print w/replies, xml ) Need Help??


in reply to Re: MVC Catalyst Architecture - City, State Zip locator
in thread MVC Catalyst Architecture - City, State Zip locator

Ohhh.. believe me, I've been without a hat since I broke the fancy thing. The table name and the only file it points to (zips.pm) match. So I'm really at a lost. Here is the controller if you're interested.
package WeilMclain::Controller::ContractorLocator; use strict; use warnings; use base 'Catalyst::Controller'; =head1 NAME WeilMclain::Controller::ContractorLocator - Catalyst Controller =head1 DESCRIPTION Catalyst Controller. =head1 METHODS =cut =head2 index =cut sub index : Private { my ( $self, $c ) = @_; $c->stash->{template} = 'contractorlocator/index'; } sub search : Local { my ( $self, $c ) = @_; # Figure out hte zip code we are dealing with in case user gives c +ity,state my $zip_code = 0; if ($c->request->param('city') && $c->request->param('state')) { $zip_code = $c->model('WeilMclainDB::Zips')->get_zip($c->reque +st->param('city'),$c->request->param('state')); } elsif (!$c->request->param('zip')) { $c->response->redirect('/cont +ractorlocator'); } else { $zip_code = $c->request->param('zip'); } my $zips = [$c->model('WeilMclainDB::Zips')->get_closest($zip_code +,$c->request->param('miles'))]; # Get contractors in $zips if (scalar @{$zips} > 0) { $c->stash->{contractors} = [$c->model(' +WeilMclainDB::Contractor')->locate_by_zip($zips)]; } $c->stash->{template} = 'contractorlocator/search'; } =head1 AUTHOR Copyright 2006 Denny D. Daugherty <ddaugherty@kujoe.com> =head1 LICENSE =cut 1;