[16192] in Perl-Users-Digest
Perl-Users Digest, Issue: 3604 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 19:39:13 2000
Date: Mon, 10 Jul 2000 16:39:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963272343-v9-i3604@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 10 Jul 2000 Volume: 9 Number: 3604
Today's topics:
Re: Subroutine return value - what is the error? anuragmenon@my-deja.com
Re: Subroutine return value - what is the error? anuragmenon@my-deja.com
suidperl <jws@austclear.com.au>
SV: PPM problems <barbr-en@online.no>
Re: SV: PPM problems <greg2@surfaid.org>
Switch statement in Perl <abel@inlander.es>
Re: Switch statement in Perl <foo@bar.va>
Re: Switch statement in Perl (Keith Calvert Ivey)
Re: Switch statement in Perl (Bart Lateur)
Re: sybperl question (Abigail)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 03 Jul 2000 16:45:21 GMT
From: anuragmenon@my-deja.com
Subject: Re: Subroutine return value - what is the error?
Message-Id: <8jqfus$p9k$1@nnrp1.deja.com>
Thanks for the help there...
I tried the statement you sent me and it prints out the correct values
and that the query should work..$query is the new CGI hand used in the
entire page building. But the bug still remains - If the run the script
from commandline, it works fine - It always has - but the moment I run
it from a page, the Internal Servre error comes up. Hmm...I just have
written real long scrips using the object method that I am feeling a
little lazy to try and change it all to the function method. I have
also not redefined $query in any other block. I am totally at my wits
end....any suggestions? maybe I should consider re-writing the script in
the function method..
Vinod.
> What happens if you just comment out one or the other? The sub works
for
> me when I cut & paste it, so maybe $query is out of scope. You might
find
> CGI function method is easier to use, because it does not need the
> $query-> prefix that object method does.
>
> Extra tmp print statements are always useful to see if variables are
what
> you think they should be. Try inserting this here to see if
$PassString
> has no value or $query is out of scope (like if you defined 'my
$query'
> within another block):
>
> print '$PassString ',
> ($PassString) ? "is $PassString" : "has no value","<br>\n";
> print '$query ', ($query) ? "should work" : "has no value","<br>\n";
>
> ># The rest of the code is continuous as in the script I am trying to
get
> >to work...
> >
> >my $NewValue = TrySub($PassString);
> >
> >print $query->end_html;
> >
> >exit 0;
> >#----------------------------------------------
> >#Subroutine Begings Here
> >
> >sub TrySub{
> >my ($LocalString)= @_;
> >my $StringLength = $LocalString;
> >my $AddString = 'TEST';
> >
> >my $retString = $LocalString.$AddString;
> >return $retString;
> >
> >}
>
> --
> David Efflandt efflandt@xnet.com http://www.de-srv.com/
> http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> http://hammer.prohosting.com/~cgi-wiz/
http://cgi-help.virtualave.net/
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 03 Jul 2000 17:25:46 GMT
From: anuragmenon@my-deja.com
Subject: Re: Subroutine return value - what is the error?
Message-Id: <8jqia5$r65$1@nnrp1.deja.com>
I tried to break my head over what the problem might be and no luck. The
entire script works perfectly if run from the commandline...but it
breaks when run from the webpage. If I comment out that one statement
my $NewValue = TrySub($PassString);
things are totally fine...I am totally lost and tearing my hair out!
Vinod.
In article <8jqfus$p9k$1@nnrp1.deja.com>,
anuragmenon@my-deja.com wrote:
> Thanks for the help there...
>
> I tried the statement you sent me and it prints out the correct values
> and that the query should work..$query is the new CGI hand used in
the
> entire page building. But the bug still remains - If the run the
script
> from commandline, it works fine - It always has - but the moment I run
> it from a page, the Internal Servre error comes up. Hmm...I just have
> written real long scrips using the object method that I am feeling a
> little lazy to try and change it all to the function method. I have
> also not redefined $query in any other block. I am totally at my wits
> end....any suggestions? maybe I should consider re-writing the script
in
> the function method..
>
> Vinod.
>
> > What happens if you just comment out one or the other? The sub
works
> for
> > me when I cut & paste it, so maybe $query is out of scope. You
might
> find
> > CGI function method is easier to use, because it does not need the
> > $query-> prefix that object method does.
> >
> > Extra tmp print statements are always useful to see if variables are
> what
> > you think they should be. Try inserting this here to see if
> $PassString
> > has no value or $query is out of scope (like if you defined 'my
> $query'
> > within another block):
> >
> > print '$PassString ',
> > ($PassString) ? "is $PassString" : "has no value","<br>\n";
> > print '$query ', ($query) ? "should work" : "has no value","<br>\n";
> >
> > ># The rest of the code is continuous as in the script I am trying
to
> get
> > >to work...
> > >
> > >my $NewValue = TrySub($PassString);
> > >
> > >print $query->end_html;
> > >
> > >exit 0;
> > >#----------------------------------------------
> > >#Subroutine Begings Here
> > >
> > >sub TrySub{
> > >my ($LocalString)= @_;
> > >my $StringLength = $LocalString;
> > >my $AddString = 'TEST';
> > >
> > >my $retString = $LocalString.$AddString;
> > >return $retString;
> > >
> > >}
> >
> > --
> > David Efflandt efflandt@xnet.com http://www.de-srv.com/
> > http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
> > http://hammer.prohosting.com/~cgi-wiz/
> http://cgi-help.virtualave.net/
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 10 Jul 2000 13:06:03 +1000
From: Joseph Sirucka <jws@austclear.com.au>
Subject: suidperl
Message-Id: <39693D9B.4415EC9F@austclear.com.au>
Hi Perlers
Recently I've been looking for suidperl. I knew it was part of the perl
distribution. I tried compiling the source and no go, no suidperl
executable. Well if suidperl is not part of the perl source sode or
distribution.
Where do It find it and add it.
I require it to run neomail. Also my machine is a sun sparc 2 running
solaris 7.
please email me at joseph.sirucka@netics.com.au
Hope to hear from someone soon.
--
Joseph Sirucka
------------------------------
Date: Thu, 6 Jul 2000 00:50:23 +0200
From: "Kåre Olai Lindbach" <barbr-en@online.no>
Subject: SV: PPM problems
Message-Id: <uXO85.7671$MS3.156101@news1.online.no>
Greg Griffiths <greg2@surfaid.org> skrev i
meldingsnyheter:395F952A.929BCB33@surfaid.org...
> Having rebuit my machine and re-installed the latest PERL from
> Activestate as well as the PPM fix, I am still getting the following
> error :
>
>
>
> Microsoft(R) Windows 98
> (C)Copyright Microsoft Corp 1981-1998.
>
> C:\WINDOWS\Desktop>ppm
> PPM interactive shell (1.1.4) - type 'help' for available commands.
> PPM> install DBD::ODBC
> Install package 'DBD-ODBC?' (y/N): y
> Retrieving package 'DBD-ODBC'...
>
> unclosed token at line 11, column 43, byte 936 at
> C:/Perl/site/lib/SOAP/Parser.p
> m line 73
> C:\WINDOWS\Desktop>
>
> any ideas ?
>
Have you looked into ppm.log?
--
mvh/regards
Kåre Olai Lindbach
(LLP - 955626397 MVA)
+ 47 61282501(home/job)
+ 47 61282502(fax)
barbr-en@online.no
# Det er bedre med en PERLe i hånden, enn Ti SHell på taket .
------------------------------
Date: Fri, 07 Jul 2000 21:26:11 +0100
From: Greg Griffiths <greg2@surfaid.org>
To: =?iso-8859-1?Q?K=E5re?= Olai Lindbach <barbr-en@online.no>
Subject: Re: SV: PPM problems
Message-Id: <39663CE3.8AFF9257@surfaid.org>
don't have one on the machine
"Kåre Olai Lindbach" wrote:
> Greg Griffiths <greg2@surfaid.org> skrev i
> meldingsnyheter:395F952A.929BCB33@surfaid.org...
> > Having rebuit my machine and re-installed the latest PERL from
> > Activestate as well as the PPM fix, I am still getting the following
> > error :
> >
> >
> >
> > Microsoft(R) Windows 98
> > (C)Copyright Microsoft Corp 1981-1998.
> >
> > C:\WINDOWS\Desktop>ppm
> > PPM interactive shell (1.1.4) - type 'help' for available commands.
> > PPM> install DBD::ODBC
> > Install package 'DBD-ODBC?' (y/N): y
> > Retrieving package 'DBD-ODBC'...
> >
> > unclosed token at line 11, column 43, byte 936 at
> > C:/Perl/site/lib/SOAP/Parser.p
> > m line 73
> > C:\WINDOWS\Desktop>
> >
> > any ideas ?
> >
>
> Have you looked into ppm.log?
>
> --
> mvh/regards
> Kåre Olai Lindbach
> (LLP - 955626397 MVA)
> + 47 61282501(home/job)
> + 47 61282502(fax)
> barbr-en@online.no
> # Det er bedre med en PERLe i hånden, enn Ti SHell på taket .
------------------------------
Date: Fri, 07 Jul 2000 10:29:31 GMT
From: Abel Almazan <abel@inlander.es>
Subject: Switch statement in Perl
Message-Id: <3965B115.758E2CDB@inlander.es>
How is the equivalent to the C++ switch statement??
I want to translate this:
if ($wday==1) $day="Monday";
elsif ($wday==2) $day="Thursday";
.
.
.
else $day="Sunday";
to switch statement
Thanx
------------------------------
Date: Fri, 07 Jul 2000 12:32:47 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Switch statement in Perl
Message-Id: <3965B1CF.DCA4C1F6@bar.va>
Abel,
Abel Almazan wrote:
> How is the equivalent to the C++ switch statement??
Is a FAQ:
$ perldoc -q switch
"How do I create a switch or case statement?"
Best regards,
Marco
------------------------------
Date: Fri, 07 Jul 2000 12:51:23 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Switch statement in Perl
Message-Id: <3967d01a.36897683@nntp.idsonline.com>
Abel Almazan <abel@inlander.es> wrote:
>I want to translate this:
>
>if ($wday==1) $day="Monday";
>elsif ($wday==2) $day="Thursday";
>.
>.
>.
>else $day="Sunday";
>
>to switch statement
For the switch statement specifically, others have already told
you to consult the FAQ. For this particular application, the
normal Perl way would be to use an array:
my @day_name = qw( Sunday Monday Tuesday Wednesday
Thursday Friday Saturday );
my $day = $day_name[$wday];
I'm assuming the conventional values of $wday. If you're using
something else (and your value for Thursday isn't an error),
then adjust the array accordingly.
You can even avoid the @day_names variable like this, but I
think it's a bit awkward:
my $day = ( qw/ Sunday Monday Tuesday Wednesday
Thursday Friday Saturday / )[$wday];
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: Fri, 07 Jul 2000 19:46:17 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Switch statement in Perl
Message-Id: <3966301c.3747697@news.skynet.be>
Abel Almazan wrote:
> want to translate this:
>
>if ($wday==1) $day="Monday";
>elsif ($wday==2) $day="Thursday";
>.
>.
>.
>else $day="Sunday";
>
>to switch statement
Oh damn. What about:
$day = (qw(Sunday Monday Tuesday Wednesday Thursday Friday
Saturday Sunday))[$wday];
And no, it's no mistake that "Sunday" is in there twice. It't there for
both indexes 0 and 7.
It's far more compact and elegant (and probably even faster) than any
switch statement you could possibly get. Or: you're wrong. You don't
want a switch statement.
--
Bart.
------------------------------
Date: 05 Jul 2000 18:58:34 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: sybperl question
Message-Id: <slrn8m7ged.ibb.abigail@alexandra.delanet.com>
Tom Phoenix (rootbeer@redcat.com) wrote on MMCDLXXXVII September MCMXCIII
in <URL:news:Pine.GSO.4.10.10006221330580.4312-100000@user2.teleport.com>:
.. On 22 Jun 2000, Jim Anderson wrote:
..
.. > sybperl appears to be missing the functionality of DBlib's
.. > dbsetmaxprocs. I hope the functionality is really available but
.. > hidden.
..
.. Unless I'm misinformed, no one should be using sybperl any longer. It's
.. really just an offshoot of ancient Perl 4, isn't it? Try this instead:
..
.. http://search.cpan.org/search?dist=DBD-Sybase
No. "sybperl" is the interface to the Sybase DBlib, CTlib and BCP libraries.
While in the perl4 days, "sybperl" was statically linked, what's now
called "sybperl" is just the collection of Sybase::DBlib, Sybase::CTlib,
and Sybase::BCP.
Sybase::* gives you full access to the API Sybase provides, while
DBD-Sybase is a driver for the DBI, which only provides a limited API.
DBI/DBD makes it somewhat easier to switch databases, but you give up
the full feature set of the Sybase API.
I'd pick "sybperl" over DBI/DBD-Sybase any day of the week.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3604
**************************************