[13348] in Perl-Users-Digest
Perl-Users Digest, Issue: 758 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 10 11:21:41 1999
Date: Fri, 10 Sep 1999 08:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 10 Sep 1999 Volume: 9 Number: 758
Today's topics:
Re: Accessing DB2/400 from perl on Linux tupurz9649@my-deja.com
Re: back for more sorting abuse (Larry Rosler)
Extracting data from an HTML file <David@YesYes.com>
Re: Extracting data from an HTML file <bauer@zrz.tu-berlin.de>
Re: Extracting data from an HTML file <rootbeer@redcat.com>
Re: Extracting data from an HTML file (Kragen Sitaker)
Re: foreach oddity <dan@tuatha.sidhe.org>
Re: foreach oddity <rootbeer@redcat.com>
Re: foreach oddity <debr@hpesdebr.fc.hp.com>
Re: fork doesn't like me or .... <rootbeer@redcat.com>
Re: fork? <dan@tuatha.sidhe.org>
Re: Generating random numbers from an array <garethr@cre.canon.co.uk>
Re: Help! HTTP500 error when running Perl script on Fro (Bill Moseley)
Re: Help! HTTP500 error when running Perl script on Fro <rootbeer@redcat.com>
How to perform nslookup functions in perl? <blair.kissel@mts.mb.ca>
Re: How to perform nslookup functions in perl? (Troutman)
Re: IPC daemonization <rootbeer@redcat.com>
Re: is it perl BUG !? <rhomberg@ife.ee.ethz.ch>
Re: MSQL.pm Please Help <cnspots@mindspring.com>
Re: Perl Compilation Roblems on RedHat 6.0 <rootbeer@redcat.com>
Re: Perl fails tests (Anno Siegel)
Re: perl Makefile.PL fails <rootbeer@redcat.com>
Re: perl objects and hashes of hashes (I.J. Garlick)
Re: perl replaces smbpasswd? <rootbeer@redcat.com>
Running perl script with cron (SAMO)
Re: Running perl script with cron <rootbeer@redcat.com>
Re: Running perl script with cron (Kragen Sitaker)
Re: Unix Trouble ljl_ljl@my-deja.com
Re: Unix Trouble <gellyfish@gellyfish.com>
Re: Win32::ODBC help <larkas@eden.rutgers.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 10 Sep 1999 14:50:58 GMT
From: tupurz9649@my-deja.com
Subject: Re: Accessing DB2/400 from perl on Linux
Message-Id: <7rb5sd$ds9$1@nnrp1.deja.com>
In article <7qmt5b$2rj1@SGI3651ef0>,
"Juan Riera" <jriera@retemail.es> wrote:
> hello,
> Does anybody knows if is there any way of
accessing DB2/400 data on an
> AS/400 server from a perl CGI script on a linux
box? I have worked with
> DBI/DBD for MySQL.
>
> TIA
> Juan
>
>
Greetings,
I'm trying to figure out how to do the same
thing, only maybe with postgresql...hasn't been
much fun so far. If I come across something,
I'll thow up a signal.
I downloaded the port off the CPAN page, but it's
extension is .gz and neither winzip(win-32) nor
gunzip(linux) can open the damn thing. Another
funny thing was the fact that the CPAN page
showed the file as being 6.7MB, but the download
was closer to 17MB.
IBM does has a few reference to PERL near the 400
pages off their site.
I tried to e-mail cpan@perl.org, but the mail got
bounced back.
Shawn Pursley(shawn.pursley@service-transport.com)
Network Administrator
Service Transport
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 10 Sep 1999 07:41:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: back for more sorting abuse
Message-Id: <MPG.1242b86a657cef1f989f42@nntp.hpl.hp.com>
In article <7rau9r$b0q$1@lublin.zrz.tu-berlin.de> on 10 Sep 1999
12:41:31 -0000, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> says...
> Uri Guttman <uri@sysarch.com> wrote in comp.lang.perl.misc:
>
> >well, you want to eliminate that slow sort sub. time for some more
> >reading and studying. check out this award winning paper <gloat!> on
> >faster sorting:
> >
> >http://www.sysarch.com/perl/sort_paper.html
>
> Award? Do tell.
OK, I'll tell. Award for the best paper on software development
submitted to the Perl Conference 3.0. In addition to the text in
several formats, the slides are also at
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>.
Uri has already spent his half of the prize money. I'm still
considering...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 10 Sep 1999 20:06:02 +0700
From: "David Taylor" <David@YesYes.com>
Subject: Extracting data from an HTML file
Message-Id: <7ravot$rf9$1@news.ksc.co.th>
Personal Perl Status: Fairly New
To This NewsGroup: First Time
Number of Perl Books to hand: 6 (including CD, all brilliant, but still
absorbing...)
Question:
I am trying to extract several sets of data from an html page
that is located between <!--START--> and <!--END--> tags:
I am using:
open (MYFILE,"/info.html");
$i = 1;
print "Content-type: text/html\n\n";
while (<MYFILE> ) {
if ($i < 4) {
print if (/<!--START-->/ ... /<!--END-->/ | $i++);
}
}
This works fine and prints out exactly what I want to
extract from the html page. However, I want to put that
same data into a variable, so changed the 'while' loop to:
while (<MYFILE> ) {
if ($i < 4)
($lines .= <MYFILE> ) if (/<!--START-->/ ... /<!--END-->/ | $i++);
}
}
print $lines; # To see what data is in $lines
But this produces a completely different, wrong, result.
What am I doing wrong trying to assign the data to $lines ?
------------------------------
Date: Fri, 10 Sep 1999 16:38:27 +0200
From: Christoph Bauer <bauer@zrz.tu-berlin.de>
Subject: Re: Extracting data from an HTML file
Message-Id: <37D917E3.C656B6D0@zrz.tu-berlin.de>
Hi,
David Taylor wrote:
> Question:
> I am trying to extract several sets of data from an html page
> that is located between <!--START--> and <!--END--> tags:
>
> I am using:
>
> open (MYFILE,"/info.html");
> $i = 1;
> print "Content-type: text/html\n\n";
> while (<MYFILE> ) {
> if ($i < 4) {
> print if (/<!--START-->/ ... /<!--END-->/ | $i++);
> }
> }
this if-statement looks really weird to me.
>
> This works fine and prints out exactly what I want to
Let's have some data.
info.html----------------------
<!--START--> li1 <!--END-->
let's make this line different.
<!--START--> line 2 <!--END-->
<!--START--> 3 <!--END-->
<!--START--> 4th line <!--END-->
This one 2.
<!--START--> blablub 5 <!--END-->
<!--START--> 666 <!--END-->
--------------------------------
Now your code executed produces:
Content-type: text/html
<!--START--> li1 <!--END-->
let's make this line different.
<!--START--> line 2 <!--END-->
<!--START--> 3 <!--END-->
<!--START--> 4th line <!--END-->
This one 2.
You really wanted that ?
> extract from the html page. However, I want to put that
> same data into a variable, so changed the 'while' loop to:
>
> while (<MYFILE> ) {
> if ($i < 4)
>
> ($lines .= <MYFILE> ) if (/<!--START-->/ ... /<!--END-->/ | $i++);
> }
> }
> print $lines; # To see what data is in $lines
you really should stop guessing when setting up a regexp search.
Try this one:
LOOP: while (<MYFILE>) {
push (@values,$1) if (/<!-- ?START ?-->([^<]*)<!-- ?END ?-->/i);
last LOOP if ($#values==3);
}
print join "\n",@values;
This one is storing the code between the tags in an array.
If you have to do a multiple line match you'll have to modify the code.
bye
Christoph
------------------------------
Date: Fri, 10 Sep 1999 07:53:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Extracting data from an HTML file
Message-Id: <Pine.GSO.4.10.9909100750530.16999-100000@user2.teleport.com>
On Fri, 10 Sep 1999, David Taylor wrote:
> open (MYFILE,"/info.html");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> while (<MYFILE> ) {
> if ($i < 4)
>
> ($lines .= <MYFILE> ) if (/<!--START-->/ ... /<!--END-->/ | $i++);
You don't want to use the line input operator again inside the loop;
that's reading an extra line of input. Try using $_ instead. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 14:56:30 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Extracting data from an HTML file
Message-Id: <y_8C3.1782$N77.127236@typ11.nn.bcandid.com>
In article <7ravot$rf9$1@news.ksc.co.th>,
David Taylor <David@YesYes.com> wrote:
>I am trying to extract several sets of data from an html page
>that is located between <!--START--> and <!--END--> tags:
. . . which are on separate lines, I take it?
>open (MYFILE,"/info.html");
or die "Couldn't open /info.html: $!";
>This works fine and prints out exactly what I want to
>extract from the html page. However, I want to put that
>same data into a variable, so changed the 'while' loop to:
>
>while (<MYFILE> ) {
> if ($i < 4)
>
> ($lines .= <MYFILE> ) if (/<!--START-->/ ... /<!--END-->/ | $i++);
> }
>}
>print $lines; # To see what data is in $lines
>
>But this produces a completely different, wrong, result.
>What am I doing wrong trying to assign the data to $lines ?
<> is a filehandle-read operator. Once you hit a <!--START-->, every
other line will get appended to $lines, and the other lines will be
tested for <!--END-->.
What you want is $lines .= $_, or possibly push @lines, $_, not $lines
.= <MYFILE>.
I can't remember any longer where I learned what while (<WHATEVER>)
did; probably the perl4 man page. perldoc perlsyn doesn't mention it;
ah, perldoc perlop, section on "I/O Operators". Reading about the
filehandle-in-angle-brackets operator there should help you understand
what's going on.
Hope this helps. (What's HAND?)
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 10 Sep 1999 13:36:25 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: foreach oddity
Message-Id: <tP7C3.177$wW2.4447@news.rdc1.ct.home.com>
David Bradley <debr@hpesdebr.fc.hp.com> wrote:
> Has anyone noticed that if you try
> to return the value of the foreach
> iterator in a function, you are screwed.
> For example
> sub func {
> foreach my $i (1..10) {
> return $i if $i == 4; } }
> print &func();
There's a bug in early versions of 5.005 that cause this. The 1..10 bit in
foreach gets optimized internally to an iterator (instead of expanding to
a list of scalars as it does in earlier versions) and there was a 'whoops'
that would bite you if you tried to pass the 'fake' scalars out of the
foreach.
It's been fixed, though. Upgrade your perl to 5.005_03 and you should see
this go away. (What version are you running, BTW?)
Dan
------------------------------
Date: Fri, 10 Sep 1999 07:21:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: foreach oddity
Message-Id: <Pine.GSO.4.10.9909100715550.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, David Bradley wrote:
> sub func {
> foreach my $i (1..10) {
> return $i if $i == 4; } }
> print &func();
>
> doesn't print anything out.
If you're right, that sure looks like a bug in your perl. If it's version
5.004_05 or 5.005_03, you should probably use perlbug to file a bug
report. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 08:47:24 -0600
From: David Bradley <debr@hpesdebr.fc.hp.com>
Subject: Re: foreach oddity
Message-Id: <37D919FC.AD6B7336@hpesdebr.fc.hp.com>
Dan Sugalski wrote:
>
> David Bradley <debr@hpesdebr.fc.hp.com> wrote:
> > Has anyone noticed that if you try
> > to return the value of the foreach
> > iterator in a function, you are screwed.
>
> > For example
>
> > sub func {
> > foreach my $i (1..10) {
> > return $i if $i == 4; } }
> > print &func();
>
> There's a bug in early versions of 5.005 that cause this.
>
> It's been fixed, though. Upgrade your perl to 5.005_03 and you should see
> this go away. (What version are you running, BTW?)
>
I am running 5.005_02 on HPUX, so that explains
things. Thx.
- Dave
------------------------------
Date: Fri, 10 Sep 1999 07:09:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: fork doesn't like me or ....
Message-Id: <Pine.GSO.4.10.9909100708140.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, Luc Arits wrote:
> $pid=fork();
> if ($pid == 0){ #child
If you're fearing fork troubles, why aren't you checking for an error
return from fork?
die "Can't fork: $!" unless defined( $pid = fork );
unless ($pid) { # child
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 13:32:10 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: fork?
Message-Id: <uL7C3.176$wW2.4447@news.rdc1.ct.home.com>
Kai Henningsen <kaih=7ObHEaFHw-B@khms.westfalen.de> wrote:
> dan@tuatha.sidhe.org (Dan Sugalski) wrote on 07.09.99 in <RlbB3.390$9v5.5433@news.rdc1.ct.home.com>:
>> Dan Sugalski <dan@tuatha.sidhe.org> wrote:
>>
>> > (And threads are *not* tough to program--they're really a snap. I don't
>> > understand the mental blocks folks have about 'em. OTOH, signals drive me
>> > loopy. To each his own...)
>>
>> As I've had pointed out to me in private mail, this is defintely a matter
>> of opinion. Some folks (like me) find threads really easy to deal with.
>> And others don't. That I find them easy probably just means I'm weird...
> Threads *are* a very nice programming paradigma. But to use them right,
> you need to
> (1) *understand* about concurrency issues (such as the dining philosopher
> problem and so on)
Or at least know where the dicey places are and how to avoid them.
Which'll probably serve most people well enough, though true understanding
is better. (But isn't it always?)
> (2) be able to find the right abstractions to minimize thread interaction
> (a useful skill in general, but one that's in sadly short supply in the
> general programming public)
You could've stopped that sentence after abstraction and the parenthetical
statement would still apply. :)
The two things I really want to supply with threaded perl is a bunch of
good modules to provide various abstractions, and lots of docs on what to
do and not do. (I'd include the comp.programming.threads FAQ, all 700+K of
it, if I thought it'd help)
There's already a mostly-working Thread::Object base class you can @ISA
from to get a thread per object, and I'm hoping to get continuations and
iterators going too.
> Object oriented programming style is actually a pretty good match for
> threads; you get to hide all the ugly locking inside your object
> implementation. Getting it right with procedural style is quite a bit
> harder.
The big win that objects usually bring is encapsulation of data--it's not
so much that they make locking easier as they tend to collect all the bits
that need locking in a single place. (Or so it's always seemed to me, but
YMMV of course)
> In any case, try to find a style of locking that works, and then *USE*
> *IT* *EVERYWHERE*! That helps a lot.
> Once you get the basics right, threads can express a lot of stuff in a far
> more readable way. Servers are an obvious example. GUI code is another.
> Anything that needs to keep track of several independent, interleaved,
> complex operations qualifies.
Oh, yes. And one of the most important things to know is when *not* to use
threads. Like objects, they have this 'cool' factor that makes folks want
to use them in places they ought not be.
Dan
------------------------------
Date: Fri, 10 Sep 1999 13:32:15 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Generating random numbers from an array
Message-Id: <siso4mj3j4.fsf@cre.canon.co.uk>
tmcandr@sears.com wrote:
> Would anyone happen to know how to generate a random number from
> a set of array elements?
The expression `int rand $n' gives a uniformly distributed random
integer in the range [0,$n), so $ARRAY[int rand @ARRAY] gives a random
element from @ARRAY, unless @ARRAY is empty.
--
Gareth Rees
------------------------------
Date: Fri, 10 Sep 1999 06:06:04 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Help! HTTP500 error when running Perl script on Frontpage
Message-Id: <MPG.1242a2174d2c2a5798972f@nntp1.ba.best.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
gilbert (gilbert@yahoo.com) seems to say...
> I found the error log. It says "httpd: could not create new process: 193"
Take a look at
http://www.activestate.com/ActivePerl/docs/Perl-Win32/perlwin32faq6.html
Tom Phoenix's response to your question is the best advice anyone can
give.
This is the wrong news group for your question, and you provided very
little information about the problem. "My car's broken. What's wrong
with it?" is not helpful. A lot of really smart people have spent many
hours creating FAQs to help you. Please don't waste their time.
Good luck,
BTW - That error message above is a good reason to consider junking MS
and going for Apache.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Fri, 10 Sep 1999 07:44:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help! HTTP500 error when running Perl script on Frontpage
Message-Id: <Pine.GSO.4.10.9909100741250.16999-100000@user2.teleport.com>
On Fri, 10 Sep 1999, gilbert wrote:
> Bill Moseley <moseley@best.com> wrote in message
> news:MPG.124158c9acd9bd0a989729@nntp1.ba.best.com...
> > So far, this isn't a problem with perl.
> Thank Bill,
> I try to find the web server log by searching my harddisk, but I
> couldn't find it. Please tell me where can I check the error log.
This still isn't a problem with perl. You may need to check the docs,
FAQs, and newsgroups about Frontpage and related issues. If you (or
someone else reading this) don't know what those are or how to search for
them, please let me know. Follow-ups set, in case there is a perl-related
follow-up.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 09:34:52 -0500
From: Blair Kissel <blair.kissel@mts.mb.ca>
Subject: How to perform nslookup functions in perl?
Message-Id: <37D9170C.9C6380F9@mts.mb.ca>
I need to perform the following:
nslookup
ls -t a foo.com
This returns a list of A records for the domain. I need to do this in
perl and then store the resulting A records (hostname and ip address) in
a hash. I have looked at the Net::DNS module but can't seem to find a
way to do it. Can somebody help me please?
Thank you,
Blair
------------------------------
Date: 10 Sep 1999 10:56:17 -0500
From: mike@nospam.troutman.org (Troutman)
Subject: Re: How to perform nslookup functions in perl?
Message-Id: <8E3D63354miketroutmanorg@news.wheatintl.com>
blair.kissel@mts.mb.ca (Blair Kissel) graced us with the following:
>I need to perform the following:
>
>nslookup
>ls -t a foo.com
>
>This returns a list of A records for the domain. I need to do this in
>perl and then store the resulting A records (hostname and ip address) in
>a hash. I have looked at the Net::DNS module but can't seem to find a
>way to do it. Can somebody help me please?
I believe you can just do a system call....
$record="(`system nslookup etc.com`);
or something like that.
--
___________________________________________
Mike Troutman
http://www.troutman.org
------------------------------
Date: Fri, 10 Sep 1999 07:38:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: IPC daemonization
Message-Id: <Pine.GSO.4.10.9909100729210.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, Bill Moseley wrote:
> I want to fork a child and then let the parent exit with the child
> running. (The parent happens to be a CGI script.)
Make sure that the child closes the filehandles which connect it to the
server, so that the server will know that the child is not going to
contribute to the output.
> I'm wondering if the child's code can be in the parent's script (or if
> I have to have a separate script), and how to actually code thing.
The child's code can be in the parent's script. In fact, at least some of
it nearly always is.
> I'm also unclear if I need to do anything special to keep the web
> server from killing the child.
You may need to do that. There may be nothing you can do about it. But
your webserver's docs (and maybe the person who configured it) should tell
you more.
Generally, though, once your child process has closed STDIN and STDOUT and
maybe used setpgrp, it should be fine. But be cautious about creating
long-running processes over the web, so that someone who (accidentally or
maliciously) hammers on a Submit button won't leave you the victim of a
DoS attack.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 15:20:28 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: is it perl BUG !?
Message-Id: <37D9059C.1A560EC9@ife.ee.ethz.ch>
Ryan Ngi wrote:
>
> while i was testing my fool-algorithm -- it's about
> finding ($c**$d) mod $n where $c,$d are such big integers
> ($c=63709,$d above 30000 respectively)
> so i have to mod and then multiply and mod then multiply ...
>
> it's :
>
> modmul(63709,100000,70747);
First, I could not reproduce your error.
Second, you are computing an O(n^3) problem with O(n^2*2^n) steps. This
might increase your computing time slightly :-) (by a factor of 2^121
for 128 bits)
Check "Knuth: The Art of Computer Programming".
Or see the end for a short summary
Third, if you get overflow, try the Math::BigInt package.
For Modulo exponentiation, try the Math::BigInteger package from CPAN,
which has fast modulo exponentiation. See
http://theory.uwinnipeg.ca/scripts/CPAN/authors/id/GARY/Math-BigInteger-1.0.readme
http://theory.uwinnipeg.ca/scripts/CPAN/authors/id/GARY/Math-BigInteger-1.0.tar.gz
> my computer can test a perl program to compute 2**1023
> it's very big integer ( java can only compute 2**62 in "long" type)
On both types of 64 bit computers, Perl could only calc with about 32
bit, so somewhere near 2^31-2^32, there's the limit. For longer
Integers, use one of the packages mentioned above.
- Alex
PS: to calculate a^9, you can do
a*a*a*a*a*a*a*a*a, with eight multiplications, or
((a^2)^2)^2*a with 3 squares and one mul (=4 mults)
essentially, you do $a**$e: (UNTESTED CODE)
$sq = $a; $res=1;
while ($e) {
$res *= $sq if $e & 1; # if lowest bit set (MOD $MODULO)
$sq *=$sq; $e >>=1; # (MOD MODULO)
}
PPS: Thailand? Sawadi kaap :-)
--
_________________________________________________________________
/ \
| Alex Rhomberg Tel: +41 1 632 49 18 |
| Institut fuer Elektronik Fax: +41 1 632 12 10 |
| ETH Zuerich Zentrale: +41 1 632 11 11 |
| Gloriastrasse 35 |
| 8092 Zuerich email: rhomberg@ife.ee.ethz.ch |
\_________________________________________________________________/
------------------------------
Date: Fri, 10 Sep 1999 10:13:20 -0400
From: "CNspots" <cnspots@mindspring.com>
Subject: Re: MSQL.pm Please Help
Message-Id: <7rb4vo$vrn$1@nntp4.atl.mindspring.net>
I Aplologize I'm still pretty much a novice with Perl but My error log shows
no errors and I dont know how to grab the error besides that. How would I do
that?
Jon Peterson <jpeterson@office.colt.net> wrote in message
news:ws3C3.108$xa4.1397@news.colt.net...
> CNspots <cnspots@mindspring.com> wrote:
> > Could someone please tell me what is wrong with thiscode I have been
racking
> > my brains for a week and I still can't figure it out.. Also can anyone
> > reccomend a good source for learning msql.pm Thanfs
>
> > #!/usr/local/bin/perl
> > use CGI;
> > use Msql;
> > use DBI;
>
> Well, I'd start by inserting 'use strict;' as the second line in the
program.
> And I'd continue by appending ' -w' to the first line of the program.
>
> > # CODE BREAKS HERE
>
> It breaks, sure I believe you - but WHAT IS THE ERROR MESSAGE?? It's
_really_
> hard to debug without the error message.
>
>
>
------------------------------
Date: Fri, 10 Sep 1999 06:55:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl Compilation Roblems on RedHat 6.0
Message-Id: <Pine.GSO.4.10.9909100637300.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999 dckinder@mountain.net wrote:
> I consistently fail one "make test" when compiling perl5.005_03 on
> RedHat 6.0: "lib/anydbm FAILED at test 12"
If that's your only trouble, and if you don't need the DBM routines, you
could probably safely ignore that failure. But it's better to fix it, if
you can.
> This happens when I use all the defaults in the perl Configure. I
> have also attempted specifically to state that gcc rather than cc is
> the compiler, but this makes no difference.
I suspect that your cc is gcc. But it doesn't sound like a compiler issue
in any case. I'd guess that there's a problem with the library routines
you're using for the DBM, or the way Perl is interfacing to them. Are you
using gdbm or ndbm? Maybe you should change that: Just because Configure
thinks it's a good default doesn't mean it's correct. You way find out
something with a command like 'ls -l /usr/include/*dbm.h'.
> What is worse the CD-1.21 GD:pm will not compile.
I don't know what that is. A module? But I'm suspecting that, once you get
your new perl binary and related files properly installed (even if the DBM
routines are busted) you'll have much better luck with installing new
modules. If you try to install a module before you've got a working perl,
you won't get a working module.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Sep 1999 13:34:35 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl fails tests
Message-Id: <7rb1db$b4a$1@lublin.zrz.tu-berlin.de>
Justin Smith <jsmith@mcs.drexel.edu> wrote in comp.lang.perl.misc:
>I heard (on another newsgroup) that there's something wrong with the db library in Redhat, so I downloaded
>
>the REAL Berkeley db implementation (from www.sleepycat.com) and tried to build BerkeleyDB.pm
>
>(the Perl hook into the current Berkeley DB) and the resulting perl STILL failed the AnyDB test!
Two snags to consider with Berkeley DB 2.7.5: You must build a shared
library and place it where perl can find it. (dll `which perl` will
show you where it looks). Also, you must recompile the DB_File
extension with the include file db.h from 2.7.5 in place (usually in
/usr/include).
Anno
------------------------------
Date: Fri, 10 Sep 1999 07:28:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl Makefile.PL fails
Message-Id: <Pine.GSO.4.10.9909100726310.16999-100000@user2.teleport.com>
On Thu, 9 Sep 1999, mikej wrote:
> # perl Makefile.PL
> perl: not found
Make sure you have /usr/bin and /usr/local/bin in your $PATH environment
variable, and then make sure that usr/bin/perl and /usr/local/bin/perl are
symlinks to the real perl binary. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 14:06:43 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: perl objects and hashes of hashes
Message-Id: <FHuKJ7.MJu@csc.liv.ac.uk>
In article <37D855D2.22572DF2@blur.com>,
duane powell <duane@blur.com> writes:
[snip]
> Now I realize you don't have to define it in the constructor.
>
> You just code something like
>
> $self->{_hashREF}->{$var}->{_deeperHashREF}->{$someOtherVar}++;
Sorry. I do this all the time and don't think about it. Consequentially I
keep forgetting it may not be obvious. :-)
BTW you can drop all the -> after the first eg.
$self->{_hashREF}{$var}{_deeperHashREF}{$someOtherVar}++;
is the same. I find it easier to identify it as a hash call rather than a
call to an inherited method. It's just style, perl lets you get away with
murder on style stuff where it doesn't effect parsing.
> in a method and it springs into existence.
>
> Damn, perl is amazing.
I know. Grand ain't it?
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Your conscience never stops you from doing anything. It just stops you
from enjoying it.
------------------------------
Date: Fri, 10 Sep 1999 07:01:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl replaces smbpasswd?
Message-Id: <Pine.GSO.4.10.9909100657180.16999-100000@user2.teleport.com>
On 9 Sep 1999, Mr. Chow Wing Siu wrote:
> I would like to know if there's any perl program may replace the
> smbpasswd to change SMB password and add/del users?
I'm sure that there is. It's still an open question whether anyone has
written it yet. :-)
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service.
If you need information on how the smbpasswd command works so that you can
emulate it, perhaps you can search for the docs, FAQs, mailing lists, and
newsgroups about Samba and related issues. If you (or anyone else reading
this) aren't sure what those are and how to search for them, please let me
know.
>
Honestly, even if you hadn't signed your message, I would have gladly
believed that it was from you. But I'll understand if you worry that this
message isn't really from me.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 14:03:41 GMT
From: "Saeed Moradi-Maram (SAMO)" <Saeed.X.Moradi@telia.se>
Subject: Running perl script with cron
Message-Id: <37D90FBD.7EE7D6A1@telia.se>
This is a multi-part message in MIME format.
--------------EA399BCB830D0A41E673CB94
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hiiya ppl :)
I have written my very first perl script. It's kinda
love n' hate feeling right now...
The script does alot!
simply:
cd to $exeDir directory
check few files,
convert mixed ascii/binary to ascii text,
ci, co, rcdiff etc...
open files, write files, etc
and finally report the changes and other info
by sending mail to users in the list...
(note that SUB sendMail gets executed last!)
It works fine if I run it manually! No problemo.
Doesn't matter where I run the script, it does cd.
Det idea is to put it in crontab so it runs few
times each n every week days.
So what's the problem?
Yeah, the problem is that when run via cron, the output
is not correct.
What it does is that:
- it takes the output lines mostly the print
statements and sends THEM to users!
- It doesn't paste/write the collected information!
- (Strange) but it takes the $subject and %users
that I defined
- (so it runs my sendMail SUB) but the $body is
somehow corrupted (contains wrong info)!
Any idea?
btw: in crontab I have redirected stderr 2>/dev/nul
Thanks in advance
/Saeed
--------------EA399BCB830D0A41E673CB94
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Xref: malmo.trab.se comp.lang.perl:22533
Newsgroups: comp.lang.perl
Path: malmo.trab.se!news
From: "Saeed Moradi-Maram (SAMO)" <Saeed.X.Moradi@telia.se>
Subject: Running perl script with cron
X-Nntp-Posting-Host: beverley.malmo.trab.se
Content-Type: text/plain; charset=us-ascii
Message-ID: <37D90DE8.CCC4AA9E@telia.se>
Sender: news@malmo.trab.se
Content-Transfer-Encoding: 7bit
Organization: Produkt Partner Telia Prosoft AB
X-Accept-Language: en
Mime-Version: 1.0
Date: Fri, 10 Sep 1999 13:55:52 GMT
X-Mailer: Mozilla 4.61 [en] (WinNT; I)
Hiiya ppl :)
I have written my very first perl script. It's kinda
love n' hate feeling right now...
The script does alot!
simply:
cd to $exeDir directory
check few files,
convert mixed ascii/binary to ascii text,
ci, co, rcdiff etc...
open files, write files, etc
and finally report the changes and other info
by sending mail to users in the list...
(note that SUB sendMail gets executed last!)
It works fine if I run it manually! No problemo.
Doesn't matter where I run the script, it does cd.
Det idea is to put it in crontab so it runs few
times each n every week days.
So what's the problem?
Yeah, the problem is that when run via cron, the output
is not correct.
What it does is that:
- it takes the output lines mostly the print
statements and sends THEM to users!
- It doesn't paste/write the collected information!
- (Strange) but it takes the $subject and %users
that I defined
- (so it runs my sendMail SUB) but the $body is
somehow corrupted (contains wrong info)!
Any idea?
btw: in crontab I have redirected stderr 2>/dev/nul
Thanks in advance
/Saeed
--------------EA399BCB830D0A41E673CB94--
------------------------------
Date: Fri, 10 Sep 1999 07:59:59 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Running perl script with cron
Message-Id: <Pine.GSO.4.10.9909100754320.16999-100000@user2.teleport.com>
On Fri, 10 Sep 1999, Saeed Moradi-Maram (SAMO) wrote:
> Yeah, the problem is that when run via cron, the output
> is not correct.
You generally have a different environment under cron. The environment
variables and starting directory are asking for your attention.
> - it takes the output lines mostly the print
> statements and sends THEM to users!
Maybe you've got a buffering issue, too. Check out $| in perlvar.
> btw: in crontab I have redirected stderr 2>/dev/nul
Since that's not /dev/null, I hope that that means that you actually are
able to hear any cries for help which are coming from perl or any other
programs you're running.
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Sep 1999 15:00:56 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Running perl script with cron
Message-Id: <I29C3.1788$N77.127516@typ11.nn.bcandid.com>
In article <37D90FBD.7EE7D6A1@telia.se>,
Saeed Moradi-Maram (SAMO) <Saeed.X.Moradi@telia.se> wrote:
>- (so it runs my sendMail SUB) but the $body is
> somehow corrupted (contains wrong info)!
Maybe someone else's PSI::ESP module is more advanced than mine, but I
think I'd probably need more information to diagnose the problem.
>btw: in crontab I have redirected stderr 2>/dev/nul
What kind of OS are you running that has /dev/nul? Windows NT?
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 10 Sep 1999 13:19:37 GMT
From: ljl_ljl@my-deja.com
Subject: Re: Unix Trouble
Message-Id: <7rb0gt$9f9$1@nnrp1.deja.com>
> Also, see if your ISP provides telnet access. If they offer telnet
access, then
> telnet into the UNIX shell and learn about UNIX and to learn a UNIX
text editor.
> I personally use Pico which is easy and fun and available on most
systems.
>
> Once you have seen what Perl cgi scripts can do you will be curious
about Perl
> and you will want to get into learning it.
>
> (This post may have seemed off topic but it comes back to Perl in the
end.)
>
> Neil
>
i have telnet access, but i'm not sure where to connect it to.
i also dun really know how to use telnet.
could u explain more in detail to me??
thanx in advance
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 10 Sep 1999 15:34:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Unix Trouble
Message-Id: <37d916fa_2@newsread3.dircon.co.uk>
ljl_ljl@my-deja.com wrote:
>
>
>> Also, see if your ISP provides telnet access. If they offer telnet
> access, then
>> telnet into the UNIX shell and learn about UNIX and to learn a UNIX
> text editor.
>> I personally use Pico which is easy and fun and available on most
> systems.
>>
>> Once you have seen what Perl cgi scripts can do you will be curious
> about Perl
>> and you will want to get into learning it.
>>
>> (This post may have seemed off topic but it comes back to Perl in the
> end.)
>>
>> Neil
>>
>
> i have telnet access, but i'm not sure where to connect it to.
> i also dun really know how to use telnet.
> could u explain more in detail to me??
>
I would ask this in a general Unix newsgroup - there is no Perl content
here.
/J\
--
"My codpiece layeth awkwardly across the nadgers" - Declan Donnelly
------------------------------
Date: Fri, 10 Sep 1999 09:30:50 -0400
From: Larry Kasoff <larkas@eden.rutgers.edu>
Subject: Re: Win32::ODBC help
Message-Id: <37D9080A.BEA7FBA9@eden.rutgers.edu>
"Harlan Carvey, CISSP" wrote:
> > > > > $stmt = "INSERT INTO ITEST1 (HostID,RegKey,Value,Data)".
> > > > > "VALUES ('$server','$rkey','$valkey','$value')";
> > > >
> > > > There is an SQL syntax error in the contents of $stmt
> > >
> > > Where?
> >
> > Try printing out $stmt to see what it actually looks like. Hint: white
> > space!
>
> I've tried that...I've tried using perl -d test1.pl...
>
> What I don't understand is why the sub that simply INSERTs into a database
> table works fine, but the sub that reads from one table and inserts into
> another doesn't.
>
> Yes, and I caught the thing about the whitespace at the end of the first
> line..so I added a
> space and guess what? Nothing happened. I'm not getting an error back
> from the
> Sql($stmt) call...but nothings being inserted into the database.
>
> carv
Chances are good that the problem is the fact you are using strings. SQL
requires that all strings be enclosed in ' type quotation marks. Perl uses '
that do indicate strings too. Hence, you must make sure the string values have
two ' everytime you want to insert it in a database (on both ends) for Perl
and SQL to be happy.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
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 758
*************************************