|
Re: Subroutine foo redefined a bar: msg#00401perl-beginners
2009/7/28 John W. Krahn <jwkrahn@xxxxxxx>: > Dermot wrote: >> >> 2009/7/28 John W. Krahn <jwkrahn@xxxxxxx>: >> >> Thanx for gettig back to me. >> >>> Which error? Copy and paste the error message you are receiving. >> >> Opps sorry. Here you are. Every time I start the httpd I get >> > > That message means that you have defined two addItemsToBasket subroutines > and also two addItemToBasket subroutines in the current package. I can't confirm this from where I am right now but I have a sneaky feeling that this might be the case. The file was in subversion and was reported as conflicted when I updated. I made some edits but I wonder if there are multiple instances of those routines. > You could be importing a module before MyApp::Basket that has these > subroutines or they could be defined in the main package. > > Why are you reading from your program file while importing modules? Sorry John, I don't understand won't you mean by "reading from your program file while importing modules". > How about something like this: > > sub addItemsToBasket { > my $bid = shift; > my $items = ref $_[0] ? $_[0] : \@_; > Perhaps you can expand, if $_[0] was a scalar wouldn't that get assigned to $items? I venture this but only because I suspect I am missing something in your example: my $items = ( ref($_[0]) eq 'ARRAY' ) ? $_[0] : \@_; Thanx for your help, Dp. -- To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |