develooper Front page | perl.beginners | Postings from March 2002

RE: &&

Thread Previous | Thread Next
From:
Nikola Janceski
Date:
March 28, 2002 08:10
Subject:
RE: &&
Message ID:
1449413DA482D311B67000508B5A12F50592DF90@nyexchange01.summithq.com
good info.. but this doesn't look like a method call.

I prefer prototypes for modules that I write for internal use at my company,
especially when I don't feel like explaining to 60 people everytime why
thier code doesn't work, when they forget to pass an extra argument.

> -----Original Message-----
> From: Chas Owens [mailto:alas@widomaker.com]
> Sent: Thursday, March 28, 2002 11:03 AM
> To: beginners@perl.org
> Subject: RE: &&
> 
> 
> On Thu, 2002-03-28 at 10:50, Nikola Janceski wrote:
> > There in lies your problem.. you are not passing to the subroutine
> > correctly.
> > 
> > try declaring your sub like so:
> > sub extract_data (\@\@\@){
> > but if you do this don't call extract_data with &
> > use 
> > extract_data(@datum, @seminare, @staedte); 
> > 
> > or pass the ref of the arrays:
> > extract_data(\@datum, \@seminare, \@staedte); 
> 
> Passing as refs appears to be the preferred method.  Subroutine
> prototypes are flaky and don't work properly with OO based Perl
> (prototypes can only handle stuff at compile time, while OO 
> method calls
> happen at runtime). 
> 
> > 
> > 
> > > -----Original Message-----
> > > From: MarcusWillemsen@compuserve.de
> > > [mailto:MarcusWillemsen@compuserve.de]
> > > Sent: Thursday, March 28, 2002 10:39 AM
> > > To: Chas Owens
> > > Cc: beginners@perl.org
> > > Subject: Re: &&
> > > 
> > > 
> > > Hi Chas,
> > > 
> > >  
> > > thanks for your reply.
> > > The code was the simplified code of a subroutine (below). 
> The Data 
> > > originates from a Webformula and is passed on to the 
> Subroutine like
> > >  
> > > snippet
> > > &extract_data(@datum, @seminare, @staedte); 
> > > ..
> > > ..
> > > ..
> > > 
> > > sub extract_data {
> > >     my $dates = shift;
> > >     my $themes = shift;
> > >     my $cities = shift;
> > >     my @dates = split /\s+/, "$dates";
> > >     my @themes = split /\s+/, "$themes";
> > >     my @cities = split /\s+/, "$cities";
> > >     if(@dates && !@themes && !@cities) {
> > >     my $date_count = @dates;
> > >         if($date_count > 1) {
> > >             $sth_between = $dbh->prepare( qq{SELECT * 
> FROM termine 
> > > WHERE beginn BETWEEN ? and ?});
> > >             $sth_between->execute($dates[0],$dates[1]);
> > >             my $result = $sth_between->fetchrow_hashref();
> > >             if($result){
> > >                 print $form->p("$result->{beginn}");
> > >                 #print out rest of fields
> > >             }
> > >         }
> > >         else {
> > >             $sth_exact = $dbh->prepare(qq {SELECT * FROM 
> > > termine WHERE 
> > > beginn < ? ORDER BY beginn ASC});
> > >             $sth_exact->execute($dates[0]);
> > >             my $result = $sth_exact->fetchrow_hashref();
> > >             if($result){
> > >                 while($result){
> > >                     print $form->p("$result->{beginn}");
> > >               #print out rest of fields  
> > >               }
> > >             }
> > >             else{
> > >                     print $form->p("Tut mir leid nichts 
> gefunden");
> > >                 }
> > >             }
> > >     }
> > > #here should be all the other if else loop seven in total 
> > > each printing 
> > > #out search results depending on which array or which 
> combination of 
> > > #arrays contains data 
> > > 
> > > 
> > > }
> > > Marcus
> > > 
> > > 
> > > 
> > > -- 
> > > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > > For additional commands, e-mail: beginners-help@perl.org
> > > 
> > 
> > 
> --------------------------------------------------------------
> --------------
> > --------------------
> > The views and opinions expressed in this email message are 
> the sender's
> > own, and do not necessarily represent the views and 
> opinions of Summit
> > Systems Inc.
> > 
> > 
> > -- 
> > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > For additional commands, e-mail: beginners-help@perl.org
> > 
> > 
> -- 
> Today is Boomtime the 14th day of Discord in the YOLD 3168
> Umlaut Zebra über alles!
> 
> Missile Address: 33:48:3.521N  84:23:34.786W
> 
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About