[7355] in Perl-Users-Digest
Perl-Users Digest, Issue: 980 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 5 10:08:16 1997
Date: Fri, 5 Sep 97 07:00:29 -0700
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, 5 Sep 1997 Volume: 8 Number: 980
Today's topics:
Re: Communication between objects and global subroutine <seay@absyss.fr>
Re: Communication between objects and global subroutine (Chris Nandor)
Re: complex pattern?!? it shouldn't be, i think :) <markus.moll@off1.siemens.de>
Re: complex pattern?!? it shouldn't be, i think :) <markus.moll@off1.siemens.de>
Re: complex pattern?!? it shouldn't be, i think :) <tom@mitra.phys.uit.no>
Re: Does tie hash require an flock? <pmh@edison.ioppublishing.com>
Re: Emailing from CGI's scripts on Win32 <mturk@globalserve.net>
fcntl() and &F_GETLK <Chuck.Foster@serendipity.drwho.org>
help w/dbm deleting records <jay@monmouth.com>
Re: help w/dbm deleting records (Mike Heins)
INCLUDE <manolis@cytanet.com.cy>
Re: installing perl <eglamkowski@mathematica-mpr.com>
Re: Is Perl for Win32 really as brain damaged as it see (Mark Cartwright)
Latest Version of the perl distribution (was: Help: Per (Terje Bless)
Re: perl and XEmacs (Terje Bless)
Re: perl and XEmacs (Terje Bless)
Perl on win32 book <jont@uunet.pipex.com>
Re: Perl's support on Win NT (Scott McMahan)
perl/msql <alex@whatson.com>
Re: perl/msql (Nigel Reed)
Perl5.004 on AIX 4.2 Installation problem <rey@ilo.org>
Re: Shakespearian insult program (Bart Lateur)
Re: split question (Bart Lateur)
Re: Using sendmail from NT <jerry_hicks@bigfoot.com>
Re: Using sendmail from NT <warrenkb@aom.bt.co.uk>
Re: Wrote new module, need help with system dependencie (Bart Lateur)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 05 Sep 1997 11:16:29 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Communication between objects and global subroutines in Perl
Message-Id: <340FCDED.676D0A9B@absyss.fr>
Dan Sumption wrote:
<SNIP>
> but because of the object-oriented nature, both will be obtained using
> the object's display_form_html method.
>
> I could of course code a different display_form_html method for each
> subclass (although this still restricts me from varying the template
> within members of a single class), but one of my key aims is to make
> the program easy to adapt to different circumstances - the person
> customising the program for an individual website should only have to
> plug the new strings into the object, rather than having to override
> subroutines.
You want a file with
$MYCLASS::SUBCCLASS1::display_format = "yadda $yadda";
$MYCLASS::SUBCCLASS2::display_format = "yabba $dabba $doo";
or something like that, right? This lets the local admin just muck with
a single file and everything changes. I'm stumped on getting
"method = $object->method()"
to work. You could take the approach
$MYCLASS::SUBCCLASS1::display_format = "yadda
$MYCLASS::SUBCLASS::yadda";
and have the display_form_html() method update the whole familly of
MYCLASS::SUBCLASS variables to reflect the current object and its
values. Yucho. I'm sorry, but I don't see an obvious solution. You
want to call a method (function) from inside an interpolated string.
> (I finally forked out for the 2nd edition of Programming Perl today -
> the previous edition is not much help in the kind of territory I'm
> getting into. Unfortunately, the book is so well written that I can't
> help re-reading all the basic stuff again, so it'll be a while before
> I'm on to objects....)
Yeah, but you learn so much about other stuff to justify the time. And
here your problem isn't really objects, it is function calls.
- doug
------------------------------
Date: Fri, 05 Sep 1997 08:39:03 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Communication between objects and global subroutines in Perl
Message-Id: <pudge-ya02408000R0509970839030001@news.idt.net>
In article <340f4b15.708098@news.demon.co.uk>, dan@gulch.demon.co.uk (Dan
Sumption) wrote:
# but because of the object-oriented nature, both will be obtained using
# the object's display_form_html method.
Well, if the data is in a object hash key, you can get it via $$object{key}
instead of $object->{key}. If it is in an object method, then I would do
%hash = $object->method or $hashref = $object->method.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Fri, 05 Sep 1997 13:02:00 +0200
From: Markus Moll <markus.moll@off1.siemens.de>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <340FE6A8.400DDD3F@off1.siemens.de>
Hey !
What do you do with all those brackets?
The solution of your problem is quite easy !
You've trouble with the brackets in comments, right ?
You've also trouble with multiple-lines-comments ?
Pas de problhme !
Voil` :
(no I'm not a French!)
The subject is a single scalar, right? ok. So there is just one single
line (with lots of "\n" in it)
So all you have to do is to first substitute all comments like this :
$Scalar =~ s/(<!--)(.*?)(-->)//g;
Then you treat all the other tags the same way:
$Scalar =~ s/(<)(.*?)(>)//g;
Can't see any problem (Am I blind ? : P )
This is a two-line-but-100%-working-script!
Would be glad to get answers !
------------------------------
Date: Fri, 05 Sep 1997 13:16:51 +0200
From: Markus Moll <markus.moll@off1.siemens.de>
To: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <340FEA23.A3E057B1@off1.siemens.de>
Eli the Bearded wrote:
> Have some more valid HTML comments to play with (each is single
> line for readibility, do not assume it will be so in a web page):
>
> <!-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
> <!-- <<<<<<<<<<<<<<<!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
> <!-- <<< -- -- >>!!>> ---- <<<<<<<<<<<<<<<<<<<<<<<<<! -->
> <!-- <"< -- -- ">">"> ---- <<<""<<<<<<!<<<<<<----<<<< -->
> <!-- <-> -- -- <----< ---- >----> ---- <----< ---- >> -->
>
Why that's cheating !What's that last line doing there? D'you know how
Netscape Navigator 4.01 prints this ?
It showed me :
---- <----< ---- >> -->
in the browser window. So why should a small program/script treat this
right if big Netscape
can't ! The only answer I can imagine is that this tag is NOT a valid
HTML-tag !!!!!!!!!!
OK, the other Tags are valid (and that's why they can, of course, be
used with my program which is posted here too !)
------------------------------
Date: 05 Sep 1997 15:31:14 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: complex pattern?!? it shouldn't be, i think :)
Message-Id: <nqo67sfvqe5.fsf@mitra.phys.uit.no>
Markus Moll <markus.moll@off1.siemens.de> writes:
> Hey !
> What do you do with all those brackets?
>
> The solution of your problem is quite easy !
Maybe. Try a proper HTML::Parser.
> You've trouble with the brackets in comments, right ?
> You've also trouble with multiple-lines-comments ?
>
> Pas de problhme !
> Voil` :
Are you sure?
> $Scalar =~ s/(<!--)(.*?)(-->)//g;
>
> Then you treat all the other tags the same way:
>
> $Scalar =~ s/(<)(.*?)(>)//g;
>
> Can't see any problem (Am I blind ? : P )
<img src="aa.png" alt="<what now?>">
(Yes, of course it's easy to correct your solution to handle this
particular case, but you're sinking deeper into the quagmire for every
step now.)
> This is a two-line-but-100%-working-script!
Two-line perhaps. You're 50% correct.
Please, *please* listen to what Eli says. The problem is *not*
trivial. You *do* actually need to use a proper HTML::Parser, and
somebody already did all the hard work for you, so all you have to do
is take advantage of it. Go to CPAN *now*.
> Would be glad to get answers !
Here you are. Hope you're glad.
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: Fri, 5 Sep 1997 09:46:44 +0100
From: Peter Haworth <pmh@edison.ioppublishing.com>
Subject: Re: Does tie hash require an flock?
Message-Id: <ML-2.3.873449204.6838.pmh@edison>
John Callender wrote:
> Peter Haworth wrote:
> >
> > In article <5tsdsc$a5t$2@nntp2.ba.best.com>,
> > Zenin <zenin@best.com> writes:
> > > Robert Nicholson <steffi@shell8.ba.best.com> wrote:
> > >> Is there an implicit flock at the time of an unbind?
> > > Depends on how the tied classes is designed. Check the
> > > docs for the one you're using. I don't think many (or any)
> > > of the DBM classes shipped with perl flock anything by
> > default.
> >
> > GDBM_File does. And with perl 5.004, it's implementation of flock() is
> > the
> > same as perl's.
>
> Forgive me for being dense, but I'm faced with just this issue at the
> moment, and am trying to figure it out.
>
> Does this mean I can use Perl's flocking mechanism to lock and unlock
> the GDBM filehandle I've opened in 'WRCREAT' mode, just as I would a
> regular filehandle?
No, it means that you don't have to do any locking yourself at all.
When gdbm opens a database file for reading, it *always* calls flock(LOCK_SH)
and database files opened for writing are always flock(LOCK_EX)'d. I don't know
if there's a way to get at the filehandle that gdbm uses, but I can't see a use
for it anyway.
When I said perl and gdbm implemented flock() in the same way, I meant that if
you just wanted to lock the file, without accessing the data, you could just
open() the gdbm file and flock() it. Note that there's no point in locking the
file, then tie'ing a hash to it, or tie'ing a hash then locking it because gdbm
does its own locking.
--
Peter Haworth pmh@edison.ioppublishing.com
"Then anyone who leaves behind him a written manual, and likewise anyone who
receives it, in the belief that such writing will be clear and certain, must
be exceedingly simple-minded..." -- Plato, _Phaedrus_
------------------------------
Date: Fri, 05 Sep 1997 07:14:41 -0400
From: Mike Turk <mturk@globalserve.net>
Subject: Re: Emailing from CGI's scripts on Win32
Message-Id: <340FE9A1.4EAC@globalserve.net>
Amias wrote:
>
> Does anyone know how to go about sending emails from HTML froms when
> your using an NT server ? I know that with unix there's that sendmail
> thingy but NT (or at least my installation) dosen't have anything
> comparable to shell to . The nearest i've got is to do an OLE thing with
> a Win32 mail program , this is just about OK on my machine but when i
> put it on the server it's going to explode .
> I' m using CGI.pm with Activeware's PERL for win32 (no more than 2
> months old) . Thanks in advance
>
> Toodle-pip
> Amias
I use Blat on an NT Server box here on my company's intranet with no
problems... the hompage for it is
http://gepasi.dbs.aber.ac.uk/softw/Blat.html
A quick script I hacked from the Blat example follows... what I do in
real life is slurp the data or message into a temp file and send the
temp file as the body of the message... you'll have to add that yourself
...
# Scalar definitions
$recipient1 = "person\@where.com";
$message = "message.txt ";
$blatpath = "c:\\Winnt\\system32\\Blat.exe ";
$subject = "Test message";
# Get message ready
$commandline = $blatpath;
$commandline .= $message;
$commandline .= "-s \"$subject\" ";
$commandline .= "-t \"$recipient1\" ";
# Send mail
system($commandline);
Mike Turk
------------------------------
Date: Fri, 5 Sep 1997 14:04:58 +0100
From: Chuck Foster <Chuck.Foster@serendipity.drwho.org>
Subject: fcntl() and &F_GETLK
Message-Id: <Pine.GSO.3.95.970905135724.18728B-100000@solpipe.internal.pipex.net>
Hi,
I've been trying to retrieve the lock structure for an existing lock via
the fcntl() call, and don't seem to be getting very far. If anyone could
spot / correct what the problem might be, or if it simply isn't possible
with the fcntl() function call within Perl, that would be great.
I've included the test code, plus a C program I knocked up which worked
first time (I did that to prove to myself that it did work and I wasn't
going down a blind alley!).
Thanks in advance!
Chuck
---------
use FileHandle;
use Fcntl;
$pos = $ARGV[0];
open X, "+< LOCK";
X->autoflush(1);
$slock = &setfcntl(&F_WRLCK, 0, $pos, 1);
print "Setlk\n"; &show($slock);
unless (fcntl(X, &F_SETLK, $slock)) {
print "couldn't setlk: $!\n"; &show($slock);
unless ($v = fcntl(X, &F_GETLK, $slock)) {
print "couldn't getlk: $!\n"; &show($slock);
exit;
}
print "after getlk - $v\n"; &show($slock);
exit;
}
$x = <STDIN>;
exit;
sub setfcntl {
my($type, $whence, $start, $len) = @_;
my $lock = pack 'sslllsl', $type, $whence, $start, $len, 0, 0, 0;
return $lock;
}
sub getfcntl {
return unpack 'sslllsl', $_[0];
}
sub show {
local @info = &getfcntl($_[0]);
print "Lock Type: $info[0]\n";
print "Whence: $info[1]\n";
print "Start: $info[2]\n";
print "Length: $info[3]\n";
print "SysID: $info[4]\n";
print "PID: $info[5]\n";
print "\n";
}
--------------- C program -------------------
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
main(int argc, char **argv) {
int pos = 0;
struct flock mine;
int x;
int fd;
if (argv[1]) {
pos = atoi(argv[1]);
}
fd = open("LOCK", O_RDWR);
mine.l_type = F_WRLCK;
mine.l_whence = 0;
mine.l_start = pos;
mine.l_len = 1;
x = fcntl(fd, F_GETLK, &mine);
if (x) {
printf("error %d\n", x);
exit(0);
}
printf("pid is %d\n", mine.l_pid);
}
------------------------------
Date: Fri, 05 Sep 1997 05:33:05 -0400
From: Jason Brossa <jay@monmouth.com>
Subject: help w/dbm deleting records
Message-Id: <340FD1D0.43A96CB8@monmouth.com>
I am trying to search through a Berkeley db database file
looking for today's date in the value, split the value into an array
check if one of the parts equals the current date
if so delete the record if not move on to the
next record and so on...
This script finds the matches and deletes some of them
but it always misses a few the place where it is missing
them is in the ($value =~ $date) part
i have tried "$date" or /$date/ but with the same results
i'm guessing the problem lies in the fact that i am altering
the file and continuing to search through it because it
doesn't happen if i just print out the matches rather than
delete the record
Any help would be greatly appreciated Thank you.
oh yea i'm new to perl so please go easy on me
Here is the code....
#!/usr/bin/perl5
use DB_File;
use Fcntl;
$get_date = "/bin/date";
$sdate = `$get_date +"%D"`;
chop($sdate);
$file = "databasefile";
# This is where i check to ensure post, and split up stdin
# left out for brevity
print "Content-type: text/html\n\n";
print "Today's Date is: $sdate<br><br>\n";
$database=tie(%db, 'DB_File', $file, O_RDWR, 0770) || die "can't open
dbase file: $!\n";
while (($key,$value)= each(%db)) {
if ($value =~ "$sdate"){
print "There is a value match: $key<br>\n";
@part = split(/:/,$value);
print "Date 1 is: $part[4] Date 2 is: $part[5]<br>\n";
if ($part[4] ne "$sdate")
{
print "deleted not equal part4<br><br>\n";
delete $db{$key};
}
elsif ($part[5] eq "")
{
print "deleted part 5 equals nothing<br><br>\n";
delete $db{$key};
}
else
{
print "Not deleted<br><br>\n";
}
}
}
untie(%db);
undef($database);
exit;
------------------------------
Date: 5 Sep 1997 10:46:23 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: help w/dbm deleting records
Message-Id: <5uontv$aq3$1@vixen.cso.uiuc.edu>
Jason Brossa (jay@monmouth.com) wrote:
: I am trying to search through a Berkeley db database file
: looking for today's date in the value, split the value into an array
: check if one of the parts equals the current date
: if so delete the record if not move on to the
: next record and so on...
I wish your nesting were more obvious....
It looks like you are trying to delete within an each() --
an FAQ and a no-no.
Regards,
Mike Heins
------------------------------
Date: Fri, 05 Sep 1997 16:28:11 +0300
From: Manolis <manolis@cytanet.com.cy>
Subject: INCLUDE
Message-Id: <341008EB.3F5DDB@cytanet.com.cy>
how do i include the vars+procedures of a perl file into another?
(ike header files in c)
--
cheers!
Andreas
------------------------------
Date: Fri, 05 Sep 1997 09:09:26 -0400
From: the count <eglamkowski@mathematica-mpr.com>
Subject: Re: installing perl
Message-Id: <34100486.5112@mathematica-mpr.com>
Paul Hovnanian wrote:
> the count wrote:
> > We just got a new server and I am trying to install perl but the
> > configure script is complaining that I don't have a working C compiler
> > (which is silly, cause I've been compiling lots of C programs for the
> > new system and they all work fine...)
> >
> > % uname -a
> > SunOS mpr-nj 5.5.1 Generic_103640-08 sun4u sparc SUNW,Ultra-2
> >
> > % cc -V
> > cc: SC4.0 18 Oct 1995 C++ 4.1
> >
> > From running Configure:
> >
> > Use which C compiler? [cc]
> >
> > Checking for GNU cc in disguise and/or its version number...
> >
> > *** WHOA THERE!!! ***
> > Your C compiler "cc" doesn't seem to be working!
> > You'd better start hunting for one and let me know about it.
>
> Is cc an ANSI C compiler (like gcc) or is it that crappy "bundled"
> one that seems to come with alot of Suns? I can't tell from its
> version number. I don't think perl will build without an ANSI-compliant
> compiler.
I believe it is ANSI compliant. I've gotten past the above error
(I had to manually go through the Configure script and add
#include <stdlib.h> everywhere it was running a C program that used
the exit() function). Now I have another problem - it fails to find
a lot of the standard C functions:
Checking for an efficient way to convert floats to strings.
Trying gconvert
gconvert NOT found.
Trying gcvt
gcvt NOT found.
Trying sprintf
sprintf NOT found.
access() found.
<unistd.h> defines the *_OK access constants.
alarm() found.
Checking whether your compiler can handle __attribute__ ...
Your C compiler doesn't seem to understand __attribute__ at all.
bcmp() found.
bcopy() found.
etc. etc. etc.
Now all this is really quite silly, cause I've been compiling other
programs (though none that use a configure or automake script)
using some of these functions without any problems at all.
I've included all the relevent library directories, and it successfully
found libc.so, since it successfully extracted the symbols.
*sigh*
Back to reading the Configure script... ;P
------------------------------
Date: Fri, 05 Sep 1997 12:32:24 GMT
From: cartwrightm@ssg.gunter.af.mil (Mark Cartwright)
Subject: Re: Is Perl for Win32 really as brain damaged as it seems?
Message-Id: <340ffbbd.1750799@news>
You wouldn't happen to have a URL for Zip Magic, would you? <g>
On Fri, 05 Sep 1997 11:11:41 +1100, Ron Savage
<rpsavage@ozemail.com.au> wrote:
>Bart Lateur wrote:
>>
>> jdm@thetics.europa.com (Jessica) wrote:
>>
>> >I tried using backticks to execute the command and it would run the
>> >command correctly and return the correct output to my script, but for
>> >no apparent reason, _it would access a:\ every time the external command
>> >was executed_.
>> [snip]
>
>I get this too, on Win95. I have WinZip, but have just installed ZipMagic (which is _much_ cleverer), and I
>still get the effect.
Mark A Cartwright
HQ SSG/SSXL Lan Administration
Gunter AFB, AL
------------------------------
Date: Fri, 05 Sep 1997 14:57:30 +0200
From: link@tss.no (Terje Bless)
Subject: Latest Version of the perl distribution (was: Help: Perl)
Message-Id: <link-0509971457300001@news.uit.no>
In article <5tkqjf$5f5@news-central.tiac.net>,
mike@stok.co.uk (Mike Stok) wrote:
>In recent perl distributions (5.004_03 being the latest off the presses)
No it's not. <URL:http://www.perl.org/CPAN/src/latest.tar.gz> is Perl
5.004_01. Same with <URL:http://www.perl.org/CPAN/src/5.0/latest.tar.gz>.
Until *at* *least* one of those links to it, it isn't an "official" release
IMO. Preferably there would have been an announcement to
comp.lang.perl.announce first too.
--
Party? Party, lord? Yes, lord. Right away, lord.
- Beopunk Cyberwulf
------------------------------
Date: Fri, 05 Sep 1997 15:13:28 +0200
From: link@tss.no (Terje Bless)
Subject: Re: perl and XEmacs
Message-Id: <link-0509971513280001@news.uit.no>
In article <EFvtGq.639@nonexistent.com>,
Rajappa Iyer <rsi@earthling.net> wrote:
>I think the embedded comments [in regexs] are along the lines of
>
> j = i++; /* increment i by one after assigning its value to j */
>
>Useful only if you want idiot managers reading your code and getting
>warm fuzzies. Give me idiomatic code without microdocs any day.
Or for someone who is unfamiliar with the particular language may think
that that there is equivalent to Perl
$j = 'i++';
For a short and sweet regex it's possible to use the ordinary syntax, but
once you get to monster regexes like matching the ABNF of an URL etc. you
need some way to break it up into managable pieces and explain, quite
possibly to yourself, what is going on.
BTW.
Why do you use a Reply-To field that is essentially identical
to your From field?
--
Party? Party, lord? Yes, lord. Right away, lord.
- Beopunk Cyberwulf
------------------------------
Date: Fri, 05 Sep 1997 15:20:16 +0200
From: link@tss.no (Terje Bless)
Subject: Re: perl and XEmacs
Message-Id: <link-0509971520160001@news.uit.no>
In article <5unt7r$4ql$3@nntp2.ba.best.com>,
Zenin <zenin@best.com> wrote:
>If it was hard to write, dammit it should be hard to read!
Well, then. Then Perl fails on both counts. :-)
--
Party? Party, lord? Yes, lord. Right away, lord.
- Beopunk Cyberwulf
------------------------------
Date: Fri, 5 Sep 1997 12:08:16 +0100
From: "Jonathan Tracey" <jont@uunet.pipex.com>
Subject: Perl on win32 book
Message-Id: <5uop74$e96$1@soap.uunet.pipex.com>
There is now a perl for win32 book available form O`reilly its a rewrite of
the learning perl (llama) book and is very good for NT perl people
Jon
------------------------------
Date: 5 Sep 1997 11:53:34 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Perl's support on Win NT
Message-Id: <5uorru$23l$2@mainsrv.main.nc.us>
Larry Nguyen (Larry_P_Nguyen@qmail2.sp.trw.com) wrote:
: I'm in the process of selecting a computer language/tool to write CGI
: programs. Could some one please let me know what are the best choices
: now? How is Perl supported on the Win NT platform? How do I get/purchase
: the software?
www.perl.hip.com
While Perl is available, Perl + CGI + NT is a total loss and will
frustrate you to no end. There's no documentation on it that
I've ever seen, and it works poorly.
Scott
------------------------------
Date: Fri, 05 Sep 1997 06:24:33 -0600
From: Alex Schajer <alex@whatson.com>
Subject: perl/msql
Message-Id: <873457967.10511@dejanews.com>
I have a perl/msql question.
I have a foreach loop which makes a query to the msql each time it loops.
This doesn't work, it works once then stops and gives this error:
Can't call method "numrows" without a package or object reference at
dynamic.pl line 106.
Any ideas?
Thanks,
Alex
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 5 Sep 1997 11:36:06 GMT
From: nigelr@convex.hp.com (Nigel Reed)
Subject: Re: perl/msql
Message-Id: <5uoqr6$7tv$1@news.rsn.hp.com>
Alex Schajer (alex@whatson.com) wrote:
: I have a perl/msql question.
: I have a foreach loop which makes a query to the msql each time it loops.
: This doesn't work, it works once then stops and gives this error:
: Can't call method "numrows" without a package or object reference at
: dynamic.pl line 106.
Sure, you've not connected properly to the database.
use Msql;
$hdr = Msql->connect; #if it's on the local host
$hdr -> selectdb ("dbname"); #put the database name in here
$qry = $hdr->query("select * from table where column='value'");
$numrows = $qry->numrows; #see how many rows we have
if ($numrows > 0) {
for ($cnt = 1; $cnt < $numrows; $cnt++) { #I love for loops!
@row = $qry->fetchrow; #put the row into a scaler
print $row[0], " ", $row[3],"\n"; #print some data!
}
}
There ya go, That'll work. I would guess you have a type where the
variable $hdr or $qry is as I've fallen foul of that before.
Regards
Nigel
------------------------------
Date: Fri, 05 Sep 1997 14:11:52 +0200
From: Dominique REY <rey@ilo.org>
Subject: Perl5.004 on AIX 4.2 Installation problem
Message-Id: <340FF708.7F9@ilo.org>
I installed Perl5.004 on AIX 3.2.5.1 without any problem, but I try to
install on AIX 4.2 using all default values, I received "Failed 22 test
scripts out of 152, 82.89% okay...." when executing make test.
Failing tests produce "Segmentation fault(coredump)".
Could you Help Me ?
Dominique REY
System Engineer
International Labour Office
rey@ilo.org
------------------------------
Date: Fri, 05 Sep 1997 09:31:10 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Shakespearian insult program
Message-Id: <3419cd70.6028458@news.tornado.be>
Stuart Cooper <stuartc@ind.tansu.com.au> wrote:
># NEW GUTS
>srand;
>$word_1 = $column_1[int($#column_1+1)];
>$word_2 = $column_2[int($#column_2+1)];
>$word_3 = $column_3[int($#column_3+1)];
>
>print "\nThou $word_1 $word_2 $word_3!\n\n";
In your haste, you have forgotten the rand call. Also, try @column_1
instead of ($#column_1+1).
$word_1 = $column_1[int(rand(@column_1))];
HTH,
Bart.
------------------------------
Date: Fri, 05 Sep 1997 09:31:14 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: split question
Message-Id: <341acd7e.6042299@news.tornado.be>
Paul Keller <pkeller@cisco.com> wrote:
> ($date, $time, $username, $jobid) = split(' ', $_);
>
> But if several lines were to read:
>
> 08/27/97 10:00 <firstname middle lastname> 14252
> 08/27/97 10:00 <username> 14252
>
> How would I get split to ignore the spaces occuring between
> the angle braces of the first line so the 4th field is always
> the integer following whatever is enclosed in '<>'?
This looks like another FAQ question:
How can I split a [character] delimited string except when
inside [character]? (Comma-separated files)
It's in PERLFAQ4.POD: "perlfaq4 - Data Manipulation"
HTH,
Bart.
------------------------------
Date: 5 Sep 1997 08:31:16 GMT
From: "Jerry Hicks" <jerry_hicks@bigfoot.com>
Subject: Re: Using sendmail from NT
Message-Id: <01bcb9d6$76d17670$89741fcc@jhicks>
Well, it's not *really* sendmail, but if you're willing to do a little
work, have a look at the MAPI service in Perisphere's WeeklyMFC. (see
http://www.weeklymfc.com).
This way, you can use the native mail spooler under to deliver messages.
The MAPI service providers operate under authentication, so you should
If only local (not Internet) email is supported on a system, then your
application would still work.
The aforementioned library is not free, but I have been a fantastically
satisfied customer and use their library in conjuction with embedded Perl
5.00401 inside of a MFC C++ app. Works great!
You might be able to dig around and find something similar for free.
Hope that helps!
Jerry Hicks.
jerry_hicks@bigfoot.com
Jesper Lai Petersen <lai@cs.auc.dk> wrote in article
<340FA952.D6014199@cs.auc.dk>...
> I hope someone can help me out on this one:
>
> I'm writing a script in wich I need to get data from a html form,
> process the data
> and send the result to a recipient by mail.
>
[snip]
------------------------------
Date: Fri, 05 Sep 1997 11:16:20 +0100
From: Kevin Warren <warrenkb@aom.bt.co.uk>
Subject: Re: Using sendmail from NT
Message-Id: <340FDBF4.3B0C@aom.bt.co.uk>
Jesper Lai Petersen wrote:
>
> I hope someone can help me out on this one:
>
> I'm writing a script in wich I need to get data from a html form,
> process the data and send the result to a recipient by mail.
>
> The problem is that when using a pipe to postmail.exe, the mail-program
> 'hangs'. The readme file that comes with postmail says that this
> is due to a bug in perl.
>
> The only soultion seems to be to make a file and let postmail send that
> file. However, due to security reasons this is not acceptable.
>
> Does anyone know a way to send a mail from a perl script on NT without
> having to create a file? Could I use another sendmail program?
One solution would be to spawn an external program called, "Blat!".
Available from:
http://gepasi.dbs.aber.ac.uk/softw/Blat.html
The documentation doesn't mention that it can accept a mail message from
STDIN, but it can. Specify '-' as the input file. The documentation
refers to this option as using the console.
------------------------------
Date: Fri, 05 Sep 1997 09:31:03 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Wrote new module, need help with system dependencies.
Message-Id: <3410bd22.1867120@news.tornado.be>
Todd Beverly <beverly@kodak.com> wrote:
>This class reads a binary file created from a scientific instrument
>called a spectrophotometer. The file consists of double floats,
>strings, characters and integers and I'm using 'read' and 'unpack'
>routines to decipher the results. The files will always be written on a
>MS Windows machine, which means, on a UNIX machine, a 'reverse' of the
>string before unpacking a float.
I wrote a TIFF file reader some while back. TIFF files can be in both
big-endian and little-endian order, depending on the first two bytes of
the file: "MM" (Mororola, big-endian) or "II" (Intel, little-endian).
Fortunately, TIFF files only use short (2 bytes) and long (4 bytes)
integers. So I came up with something like this:
sysread(TIFF,$_,2);
if($_ eq 'MM') {
$short = "n"; $long = "N";
elsif($_ eq 'II') {
$short = "v"; $long = "V";
} else {
die "Not a TIFF file";
}
This can be used like this:
($nom,$denom) = unpack("$long$long", $rational); # 8 bytes
No byte swapping necessary.
Now, another warning: even if floats can be IEEE compliant, there are
still different ways to encode a float, in particlar with a different
count of exponent and mantissa bits, and encoding of negative numbers.
You should try out encoding a constant float on your encoding machine,
like "3.14159". Include this in a portable way (but packed), like
UUencoded.
If, while decoding, you get the same number, you're probably in the
clear. Still, test for negative numbers separately.
HTH,
Bart.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 980
*************************************