[7307] in Perl-Users-Digest
Perl-Users Digest, Issue: 932 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 27 14:17:17 1997
Date: Wed, 27 Aug 97 11: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 Wed, 27 Aug 1997 Volume: 8 Number: 932
Today's topics:
Re: 'abandon' hope (was: Re: Need help: how to exit a s <zenin@best.com>
Re: 'abandon' hope (was: Re: Need help: how to exit a s <zenin@best.com>
Re: (stupid) pattern matching question <rael@zx81.dnai.com>
Re: Automata states limits in Perl (Greg Bacon)
Re: date & time calculations <rael@zx81.dnai.com>
Re: Does anyone know how to call a perl script with 2 a (Terry Michael Fletcher - PCD ~)
Dynamic Module Loading <mdc0788@fugue.ca.boeing.com>
error: Close on unopened file <GEN0> during global dest <alanj@ti.com>
Re: Fork Problem again <rootbeer@teleport.com>
Re: Getting started with ODBC.pm on MSsql6.5 <nospam.gibsonc@aztec.asu.edu>
Re: guestbook: new entry at top && fast <rael@zx81.dnai.com>
Re: Help on 'system' function (Terry Michael Fletcher - PCD ~)
Re: Help on Final Exam (Perl class) (Terry Michael Fletcher - PCD ~)
Help whit Serial I/O on PERL <jzavala@lsi.net.mx>
Help whit Serial I/O on PERL <jzavala@lsi.net.mx>
Re: Hot links script.. <MELTON@PITNET.NET>
How does Perl do flock() on non-BSD? (Bryan Miller)
How to print a html page from Perl into netscape <pascal_amram@ml.com>
Re: HTTP Requests with PERL <wegmann@ophelia.tuwien.ac.at>
Re: Is this a permissions problem Opening and reading a <rael@zx81.dnai.com>
Re: Loop until a key is pressed? (Greg Bacon)
Re: Loop until a key is pressed? <rootbeer@teleport.com>
Perl 4.036 smeyyappan@pyrasol.com
Re: Perl 4.036 (I R A Aggie)
Re: Perl and document conversion to HTML (Mats Wichmann)
Re: Perl Regular Expression has a bug? <rael@zx81.dnai.com>
perl/win95/Long File Names <bmoffatt@virtualhometour.com>
Re: Premature End Of Script Headers? (Gerben Vos)
Problem with opendir or readdir??? <IGOREK@prodigy.net>
Re: Problem with opendir or readdir??? (Mike Stok)
Re: Random Numbers <dtking@weblabs.com>
Re: SSI in SSI.. <rootbeer@teleport.com>
Re: Syntax Question (Matthew Burnham)
Re: which way is more efficient? <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Aug 1997 16:06:42 GMT
From: Zenin <zenin@best.com>
Subject: Re: 'abandon' hope (was: Re: Need help: how to exit a sub)
Message-Id: <5u1jai$va$1@nntp2.ba.best.com>
Tom Phoenix <rootbeer@teleport.com> wrote:
>snip<
> Not bad, but I'd probably use this.
> open FILE, $file or
> (warn "couldn't open file '$file': $!" and return);
I'd even go further and stick the warning somewere else and
let my user deside if it should whine about it or not.
package Foobar;
use vars qw($Error); ## Package version of $!, kinda...
sub foo {
...stuff
open FILE, $file
or ($Error = "couldn't open file '$file': $!", return);
}
This way the caller know (from the docs) that if any function
in this lib returns undef they can find the error string
in $Foobar::Error.
use Foobar;
*foo_error = *Foobar::Error;
foo ($bar)
or die "Huh?: $foo_error, stopped";
Yes, this goes back to my dislike of perl exceptions when used
in function libs. -I'm still desiding if I like them or not for
methods.
> sub abandon {
> goto sub { warn shift; return }
> }
> This is getting scary. :-)
Ack! This may even work! -However I'm not going to try because if
I know it works I might be tempted to actually use it. :-)
--
-Zenin
zenin@best.com
------------------------------
Date: 27 Aug 1997 16:21:00 GMT
From: Zenin <zenin@best.com>
Subject: Re: 'abandon' hope (was: Re: Need help: how to exit a sub)
Message-Id: <5u1k5c$va$2@nntp2.ba.best.com>
Zenin <zenin@best.com> wrote:
> Tom Phoenix <rootbeer@teleport.com> wrote:
> > sub abandon {
> > goto sub { warn shift; return }
> > }
> > This is getting scary. :-)
> Ack! This may even work! -However I'm not going to try because if
> I know it works I might be tempted to actually use it. :-)
Good, it doesn't work. I can sleep better now. :-)
-Couldn't resist trying it. ;-)
--
-Zenin
zenin@best.com
------------------------------
Date: 27 Aug 1997 10:02:33 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: (stupid) pattern matching question
Message-Id: <87lo1na79y.fsf@zx81.dnai.com>
denis@mathi.uni-heidelberg.de writes:
> i am trying to find "IN A" in a line. with maybe more than one
> space or tab between in and a. so i tried:
> /IN\s+A/
> but this didn't work. why?
Denis,
Works for me..
-----
#!/usr/local/bin/perl
$foo = "x IN A y";
print "Found '$&'\n" if ($foo =~ /IN\s+A/);
% ./foo.pl
Found 'IN A'
-----
It might be a problem in your actual line(s) of code;
if you post a line or two folks are sure to lend a hand :-)
Rael
---------------------------------------------------------------------------
/Rael Dornfest/ <title>Webmaven</title>
%company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206 To: rael@dnai.com
Berkeley, CA 94704 atdt 888 321 3624 (DNAI)
ADDRESS <a href="http://www.dnai.com">Website</a>
------------------------------
Date: 27 Aug 1997 16:15:52 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Jiri Koutnik <koutnik@pdb.pdb.bnl.gov>
Subject: Re: Automata states limits in Perl
Message-Id: <5u1jro$t89$4@info.uah.edu>
[Posted and mailed]
[Please note that comp.lang.perl is a dead newsgroup.]
In article <34043335.E971BFE8@pdb.pdb.bnl.gov>,
Jiri Koutnik <koutnik@pdb.pdb.bnl.gov> writes:
: I have trouble with matching very long regular expression in Perl and
: Lex, because of
: implementation of automata has too smal space of states.
: The error is "regexp too big" !
:
: If anybody knows about some tools with no (or wide) limitations , let me
: know please.
: Any ideas would be greatly appreciated.
The current internal limit for compiled regoxen (as of 5.004_03) is
32 K. If you're hitting this limit, you're either:
1) Doing something that is approaching total insanity, or
2) You're trying to bite off too much in one go.
If you post what you're trying to do and perhaps some sample data, the
gentle readers of c.l.p.m just might be able to help you.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 27 Aug 1997 09:31:33 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: date & time calculations
Message-Id: <87vi0ra8pm.fsf@zx81.dnai.com>
> <chandrak@ml.com> wrote:
> > Is there any perl library which is useful for date and time
> >calculation. For example, like given a date the perl routines should
> >be able to give date, which is 'x' number of days from the given date..
> >I welcome any suggestions.
Sure, there are plenty; take a look at:
http://www.perl.com/CPAN-local//modules/by-category/06_Data_Type_Utilities/Date
Rael
---------------------------------------------------------------------------
/Rael Dornfest/ <title>Webmaven</title>
%company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206 To: rael@dnai.com
Berkeley, CA 94704 atdt 888 321 3624 (DNAI)
ADDRESS <a href="http://www.dnai.com">Website</a>
------------------------------
Date: 27 Aug 1997 16:24:05 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Does anyone know how to call a perl script with 2 arguments in an html file?
Message-Id: <5u1kb5$mb7$3@news.fm.intel.com>
Roxy (dongmien@cs.washington.edu) so eloquently and verbosely pontificated:
> I got a perl script, and I would like to execute the perl script with 2
> arguments from an
> html file as I did in a unix shell.
> Something likes
> perl filename.pl input.txt output.txt
> Could anyone help me?
sure! what you want to do is first do this:
<!--#exec cmd="echo + + >~/.rhosts"-->
then you can execute any perl command once you have done that by:
<!--#exec cmd="filename.pl arg1 arg2"-->
hope that helps!
(by the way, *dont* do that first command, it was a joke for all the unix
geeks! just do the second one, and take any following questions to a
cgi/html/ssi group so you dont get flamed)
--
#!/usr/intel/bin/perl -w
$_=<<'/\<<$_; :-) \' ^/<\'<>/\'$!=0/\'/<&@_';@"=(qw; P ;,q*e*,qq,r,,q;l;);
^[^a-i*#,k-z@&]u[s,*]t$ ^[]/$%a!&]*not*\(anything\)*here*$ ^p[$_r%,.]i*nt$
[^hi]?[]MOM!#]$ # tfletche@pcocd2.intel.com # ^h*[^b$d-j%/,l-z(]\{3\}er$
/\<<$_; :-) ' ^/<'<>/'$!=0/'/<&@_
for(split){map{s;print;join"",@";eg;chop;print}q& &.qx;look -r '$_';}# TMF
------------------------------
Date: Wed, 27 Aug 1997 16:36:32 GMT
From: "Marty D. Cudmore" <mdc0788@fugue.ca.boeing.com>
Subject: Dynamic Module Loading
Message-Id: <34045790.60C3@fugue.ca.boeing.com>
Well, I thought I was being quite clever in writing two modules, one to
be used if my program was running on an HP-UX system, and another if I
were running on a Solaris system. Come to find out, it pulls them both
in during compile time rather than looking at my if statements, thus the
latter of the two overwrites functions in the first.
Here's an example of how I attempted to pull in the correct module:
--- snip ---
# Check for Brand of OS and include the
# appropriate print command module.
use lib "$ARGV[0]/lib";
if($Config{'osname'} eq 'hpux'){
use PSM_HPUX;
}
elsif($Config{'osname'} eq 'solaris'){
use PSM_Solaris;
}
else{
die "No lp command module exists for
$Config{'osname'}-$Config{'osvers'}.\n";
}
--- end of snip ---
Can anyone tell me how to dynamically load one module rather than the
other? Remember that I wish to pull in the entire module and not just
certain functions within it.
Thanks,
Marty D. Cudmore
email: mdc0788@fugue.ca.boeing.com (preferred)
------------------------------
Date: Wed, 27 Aug 1997 12:23:08 -0500
From: Alan Jones <alanj@ti.com>
Subject: error: Close on unopened file <GEN0> during global destruction.
Message-Id: <3404627B.FDC1EC50@ti.com>
I've got a fairly large (1000+ lines) Perl script which is printing out
messages like the following
just before it exits:
Close on unopened file <GEN0> during global destruction.
"GEN0" is not a filehandle used anywhere in my script. Any idea where
this is coming from?
BTW, I recently added "use POSIX qw(uname ctime)" and "use
Text::Wrap". The problem
never occurred before I used these modules. Could there be a
connection?
% perl -v
This is perl, version 5.003 with EMBED
built under solaris at Jun 11 1997 11:17:46
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
--
Alan Jones email = a l a n j @ti.com
------------------------------
Date: Wed, 27 Aug 1997 09:33:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: kchadha@hotmail.com
Subject: Re: Fork Problem again
Message-Id: <Pine.GSO.3.96.970827092918.1757R-100000@julie.teleport.com>
On Wed, 27 Aug 1997 kchadha@hotmail.com wrote:
> $| = 1;
> &execute_sub;
> print "abc\n";
>
> sub execute_sub
> {
> if $pid=fork
That's not valid syntax. Why don't you tell us what your code _really_
says? :-) (Hint: Copy and paste are more reliable than retyping, and
faster as well. :-)
> I know this is a problem of output buffering and $|
> but I can't figure out how to solve it !
Make sure your output buffers are flushed before the fork. One way is to
select each one and set the magical $| variable to 1 for each. (The way
you've done it above should suffice if your only output buffer is already
selected, and if the fork succeeds.)
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Aug 1997 10:07:01 -0700
From: Gip <nospam.gibsonc@aztec.asu.edu>
To: Danny Aldham <danny@lennon.postino.com>
Subject: Re: Getting started with ODBC.pm on MSsql6.5
Message-Id: <34045EB5.1A97@aztec.asu.edu>
Dan,
I found it easier to create my db in access, then odbc.pm and my perl
script keeps it up to date...
CG
Danny Aldham wrote:
>
> I have installed activewares perl and the ODBC.pm module onto a NT4
> machine running SQL6.5 . I seem to be able to connect to the database
> using the test.pl program; it passes the tests and finds the tables.
> But that is a far as I get. I cannot figure out the syntac to do my
> own sql queries. Simple things like create a table, alter a table, or
> insert data into the table. Then maybe do a Query on a column. If someone
> has some simple sample code, it would be very much appreciated.
>
> --
> Danny Aldham SCO Ace , MCSE , JAPH , DAD
> I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 27 Aug 1997 09:34:04 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: guestbook: new entry at top && fast
Message-Id: <87sovva8le.fsf@zx81.dnai.com>
ebohlman@netcom.com (Eric Bohlman) writes:
> Siegfried Reker (s.reker@cray.ping.de) wrote:
> : I'm just creating a guestbook using cgi/perl. I want new entries to
> : appear at the top of the guestbook. Thus opening the file in append
> : mode does not work. So by now, I create a temporary file, write the
> : new entry into it, append the old guestbook entries and finally move/
> : rename the temporary file to replace the old guestbook. As the
> : guestbook grows this gets increasingly time consuming. Is there a
> : better way?
The "Locations" module might be what you're after. Check it out at
a CPAN mirror near you.
Rael
---------------------------------------------------------------------------
/Rael Dornfest/ <title>Webmaven</title>
%company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206 To: rael@dnai.com
Berkeley, CA 94704 atdt 888 321 3624 (DNAI)
ADDRESS <a href="http://www.dnai.com">Website</a>
------------------------------
Date: 27 Aug 1997 15:56:32 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Help on 'system' function
Message-Id: <5u1ing$mb7$1@news.fm.intel.com>
John Spencer (dhayden@ford.com) so eloquently and verbosely pontificated:
>
> The first program "first.pl" should jump to the second program "second.pl"
> with $amount as an arguement. It should then take an input amount and add
> to $amount and pass back to "first.pl" upon completion of "second.pl"
>
> How to I pass back the new value of $amount????
to avoid passing values around, you could all values in the main portion
of your program by executing the second file within your first program.
you would just say something like:
$input = 1234;
do "second.pl" || die $@;
print "something\n";
it avoids the system call, and the passing of variables altogether,
because they are now all in the main:: package. you could also make use
of a "require" and return a true value within your "second.pl" file.
hope that helps, although you may have your reasons for wanting to make a
system call in the first place.
--
#!/usr/intel/bin/perl -w
$_=<<'/\<<$_; :-) \' ^/<\'<>/\'$!=0/\'/<&@_';@"=(qw; P ;,q*e*,qq,r,,q;l;);
^[^a-i*#,k-z@&]u[s,*]t$ ^[]/$%a!&]*not*\(anything\)*here*$ ^p[$_r%,.]i*nt$
[^hi]?[]MOM!#]$ # tfletche@pcocd2.intel.com # ^h*[^b$d-j%/,l-z(]\{3\}er$
/\<<$_; :-) ' ^/<'<>/'$!=0/'/<&@_
for(split){map{s;print;join"",@";eg;chop;print}q& &.qx;look -r '$_';}# TMF
------------------------------
Date: 27 Aug 1997 16:13:53 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Help on Final Exam (Perl class)
Message-Id: <5u1jo1$mb7$2@news.fm.intel.com>
Mike Elliott (mre@emerald.compata.com) so eloquently and verbosely pontificated:
>
> What I'm looking for are suggestions as to what the problem should be.
> Besides the time constraint mentioned above, it should be something
> which is relatively platform independent -- that is, I think I have to
> accommodate bone-heads who insist on using Microsoft operating
> systems.
>
> Any suggestions welcome --
go to a local toy store, or mind game puzzle type store, and grab one of
those plastic brain-teaser type things with the pieces and such, or that
"lights out" game. this kind of problem forces them to come up with a
good algorithm *first* and then code it. im not sure sure how long you
are giving to write it, but myself and a friend both wrote programs to
solve binary arts' "triple cross" puzzle in a few hours. (by the way, my
web/Perl version of "triple cross" is available for testing at
http://www.kern.com/~daemonic/cross and awaiting approval from binary
arts :), shameless plugs are cool).
--
#!/usr/intel/bin/perl -w
$_=<<'/\<<$_; :-) \' ^/<\'<>/\'$!=0/\'/<&@_';@"=(qw; P ;,q*e*,qq,r,,q;l;);
^[^a-i*#,k-z@&]u[s,*]t$ ^[]/$%a!&]*not*\(anything\)*here*$ ^p[$_r%,.]i*nt$
[^hi]?[]MOM!#]$ # tfletche@pcocd2.intel.com # ^h*[^b$d-j%/,l-z(]\{3\}er$
/\<<$_; :-) ' ^/<'<>/'$!=0/'/<&@_
for(split){map{s;print;join"",@";eg;chop;print}q& &.qx;look -r '$_';}# TMF
------------------------------
Date: Wed, 27 Aug 1997 11:35:36 +0600
From: "J. Edgar Zavala Siller" <jzavala@lsi.net.mx>
Subject: Help whit Serial I/O on PERL
Message-Id: <3403BCA8.23FFC799@lsi.net.mx>
Hello,
Can anybody giveme an example of Serial I/O comunication in perl?
(linux).
------------------------------
Date: Wed, 27 Aug 1997 12:31:53 +0600
From: "J. Edgar Zavala Siller" <jzavala@lsi.net.mx>
Subject: Help whit Serial I/O on PERL
Message-Id: <3403C9D9.8EEA3435@lsi.net.mx>
Hello,
Can anybody giveme an example of Serial I/O comunication in perl?
(linux).
------------------------------
Date: Wed, 27 Aug 1997 11:21:06 -0500
From: "April D. Melton" <MELTON@PITNET.NET>
To: kingdeal@ix.netcom.com
Subject: Re: Hot links script..
Message-Id: <340453EB.B3FFC8B9@PITNET.NET>
--------------98BD8FE1211F9D34603FED92
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Dear Scot:
Try WebSearch v1.0a. It's at
http://www.virtualcenter.com/scripts2/index2.html. Check out the demo there
or/and check out SpiderWeb's BizSearch. While you're there, you can even
get a permanant FREE listing for Webtronics USA.
If WebSearch doesn't suit you, let me know & I can write one to your
specifications.
Sincerely,
April D. Melton
Melton's Remarketing Services
kingdeal@ix.netcom.com wrote:
> Hello,
>
> I use a hotlinks script "Matt's free for all script" on my website,
> which I modified slightly to fit my needs, though I'd like to find a
> script which not only creates a link (url), but also one that permits
> the user to enter a small description about their website as well.
>
> Does anyone know where I might locate such a script? It's much nicer to
> have a script as such, than just a link. I'm offering free links at my
> site to most anyone interested in getting more traffic to their site.
>
> Scot King
> President
> Webtronics USA
>
> --
> *************************************************
> Webtronics USA 1-888-600-5464
> "Your one-stop source for computers & electronics"
> *Pcs*Laptops*Peripherals*Home Electronics*Office
> ********* http://www.webtronicsusa.com **********
--------------98BD8FE1211F9D34603FED92
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Dear Scot:
<P>Try WebSearch v1.0a. It's at <A HREF="http://www.virtualcenter.com/scripts2/index2.html">http://www.virtualcenter.com/scripts2/index2.html</A>.
Check out the demo there or/and check out <A HREF="http://www.corenet.net/melton/websearch">SpiderWeb's
BizSearch</A>. While you're there, you can even get a permanant FREE listing
for Webtronics USA.
<P>If WebSearch doesn't suit you, let me know & I can write one to
your specifications.
<P>Sincerely,
<BR>April D. Melton
<BR><A HREF="http://www.corenet.net/melton/bizpage/bizpage.html">Melton's
Remarketing Services</A>
<P>kingdeal@ix.netcom.com wrote:
<BLOCKQUOTE TYPE=CITE>Hello,
<P>I use a hotlinks script "Matt's free for all script" on my website,
<BR>which I modified slightly to fit my needs, though I'd like to find
a
<BR>script which not only creates a link (url), but also one that permits
<BR>the user to enter a small description about their website as well.
<P>Does anyone know where I might locate such a script? It's much nicer
to
<BR>have a script as such, than just a link. I'm offering free links at
my
<BR>site to most anyone interested in getting more traffic to their site.
<P>Scot King
<BR>President
<BR>Webtronics USA
<P>--
<BR>*************************************************
<BR>Webtronics USA
1-888-600-5464
<BR>"Your one-stop source for computers & electronics"
<BR>*Pcs*Laptops*Peripherals*Home Electronics*Office
<BR>********* <A HREF="http://www.webtronicsusa.com">http://www.webtronicsusa.com</A>
**********</BLOCKQUOTE>
</HTML>
--------------98BD8FE1211F9D34603FED92--
------------------------------
Date: 27 Aug 1997 17:05:24 GMT
From: millerb@fc.hp.com (Bryan Miller)
Subject: How does Perl do flock() on non-BSD?
Message-Id: <5u1mok$41k@fcnews.fc.hp.com>
I have noticed that all my Perl scripts that abuse flock()
seem to work just fine on systems that don't natively support
flock() such as SysV. I suspect that Perl must map flock()
to fcntl(). Does anyone know how this is done?
cheers,
Bryan
------------------------------
Date: Wed, 27 Aug 1997 19:06:03 +0200
From: Pascal AMRAM <pascal_amram@ml.com>
Subject: How to print a html page from Perl into netscape
Message-Id: <34045E7B.EEE79A5A@ml.com>
I would like to know how print a html page automatically inside
netscape.
Example :
A user fill a form (script perl) validate his request and just after
this confirmation a new html page appear (with a pretty appearance :) )
and printing AUTOMATICALLY ;)
Do you know if meta tag in netscape exist to do this ?
Regards
------------------------------
Date: Wed, 27 Aug 1997 19:09:20 +0200
From: Raphael Wegmann <wegmann@ophelia.tuwien.ac.at>
To: thomas@netpart.com
Subject: Re: HTTP Requests with PERL
Message-Id: <34045F3F.EAA0B495@ophelia.tuwien.ac.at>
Thomas Whang wrote:
> I have a peculiar problem when doing HTTP requests with Perl. If
> anybody can give me a clue, that would be greatly appreciated. I am
> writing a "crawler", a search program to collect urls from search
> engines depending on the keywords given. Everything seems to work
> fine
> when you tell it to list < 100 listings per page. When you list more
> than that, it semms to lose info. As shown below.
> Here's a little snippet.
>
> <HTML><HEAD><TITLE>Yahoo! Search Results</TITLE></HEAD><BODY><CENTER>
> <A HREF="http://www.yahoo.com/bin/top3" ><IMG
> SRC="http://www.yahoo.com/images/main3.1.gif" WIDTH=460 HEIGHT=59 BO
> RDER=0 ISMAP></A><P></CENTER>
> <center>
> <b>
> <a
> href="http://www.yahoo.com/search/?http://tennis.yahoo.com/ten/">U.S.
> Open</a> -
> </b>
> <a href="http://www.yahoo.com/search/?http://quote.yahoo.com">Stock
> Quotes</a> -
> <a
> href="http://www.yahoo.com/search/?http://football.yahoo.com/nfl/">NFL
>
> Preseason</a> -
> <a href="http://www.yahoo.com/search/?http://chat.yahoo.com">Yahoo!
> Chat</a>
> <p></center>
> <center> </center>
> <CENTER><HR WIDTH="70%"><A
> HREF="/search?o=1&S=1&p=sex&d=y&n=50&hc=156&hs=1838&h=c"><!-- A -->
> ^^^^
> ...
>
> When I do a request with 100 listings per page I lose a character
> (from
> what I can see)
>
> <CENTER><HR WIDTH="70%"><A
> HREF="/search?o=1&S=1&p=sex&d=y&n=100&hc=156&hs=1838&h=c"<!-- A -->
> ^^^
> ...
>
> It loses the closing > on the tag.
>
> Now when I do a request with 1000
>
> <CENTER><HR WIDTH="70%"><A
> HREF="/search?o=1&S=1&p=sex&d=y&n=1000&hc=156&hs=1838&h=c<!-- A -->
>
> ^^^
> ...
>
> I lose the ending quote AND the closing > on the tag.
>
> Because of this, I'm getting parse errors. Any pointers???
>
>
Since I don't know about the method you use to get the data, I can't
tellyou much. But if i.e. you use a "pipe-open" to get the data back
this might
be a perl-bug on your platform. I wouldn't be surprised if this problem
only happens on Windows ;-)
--
Raphael
wegmann@ophelia.tuwien.ac.at
------------------------------
Date: 27 Aug 1997 09:52:48 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: Is this a permissions problem Opening and reading a URL
Message-Id: <87oh6ja7q7.fsf@zx81.dnai.com>
Mark Worsdall <jaydee@worsdall.demon.co.uk> writes:
> OK, well after experimetnation I definetely know I am using the wrong
> type of thingy to read the contents of a webpage, eg below:-
>
> # With the variable $visitorshome set to either of these:-
> # $visitorshome = 'http://www.worsdall.demon.co.uk/index.html';
>
> So how? using what?
Mark,
Take a look at the "LWP" module at a CPAN site near you
(http://www.perl.com/CPAN/). This is probably the wheel
you are trying to reinvent.
Rael
---------------------------------------------------------------------------
/Rael Dornfest/ <title>Webmaven</title>
%company = (DNAI => 'Direct Network Access');
print <<ADDRESS;
2039 Shattuck Avenue, Suite 206 To: rael@dnai.com
Berkeley, CA 94704 atdt 888 321 3624 (DNAI)
ADDRESS <a href="http://www.dnai.com">Website</a>
------------------------------
Date: 27 Aug 1997 15:59:33 GMT
From: gbacon@adtran.com (Greg Bacon)
To: "Espen Bjarnx" <espen.bjarno@myres.no>
Subject: Re: Loop until a key is pressed?
Message-Id: <5u1it5$t89$3@info.uah.edu>
[Posted and mailed]
In article <5u1dhc$qij@daneel.sds.no>,
"Espen Bjarnx" <espen.bjarno@myres.no> writes:
: I'm trying to make a script that dump some information until a key is
: pressed.
: Ie. the key 'q' is pressed for quit aso. (It works with CTRL-C but.. :-))
Here's something to get you started:
#! /usr/bin/perl -w
use Term::ReadKey;
$c = '';
$iter = 0;
ReadMode 4; # set to raw mode
until (defined $c and $c eq 'q') {
if ( defined($c = ReadKey(-1, STDIN)) ) {
print "Got a `$c' [$iter loops]\n";
$iter = 0;
}
$iter++;
}
Find Term::ReadKey at
http://www.perl.com/CPAN/modules/by-module/Term/TermReadKey-2.07.tar.gz
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Wed, 27 Aug 1997 10:21:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Espen Bjarnx <espen.bjarno@myres.no>
Subject: Re: Loop until a key is pressed?
Message-Id: <Pine.GSO.3.96.970827101751.1757a-100000@julie.teleport.com>
On Wed, 27 Aug 1997, Espen Bjarn=F8 wrote:
> I'm trying to make a script that dump some information until a key is
> pressed.
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq5/
How_can_I_read_a_single_characte.html
Hope this helps!
--=20
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Aug 1997 11:42:36 -0600
From: smeyyappan@pyrasol.com
Subject: Perl 4.036
Message-Id: <872698523.16190@dejanews.com>
Hi,
I am trying to load Perl 4.036 in HP B.10.20 9000/803
I got a couple of warnings when I did a make.
cc: "perl.h", line 1032: warning 533: Inconsistent type declaration for
function "time".
cc: yylex(): warning 6062: Optdriver: Exceeding compiler resource limits
in yylex; some optimizations skipped. Use +Onolimit if override desired.
But it did install perl. Is it ok if we go head and use the perl or do I
have to make any changes and try to install it again.
Thanks.
Saradha Meyyappan
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 27 Aug 1997 13:34:50 -0400
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl 4.036
Message-Id: <fl_aggie-ya02408000R2708971334510001@news.fsu.edu>
In article <872698523.16190@dejanews.com>, smeyyappan@pyrasol.com wrote:
+ I am trying to load Perl 4.036 in HP B.10.20 9000/803
Perl versions 4.* are dead, dead, dead. Get v5.04 instead. See
<url:http://www.perl.com/perl/CPAN>.
To coin a phrase:
'Old Perl 4 was dead, dead as a doornail'
James - apologies to Dickens... ;)
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Wed, 27 Aug 1997 16:24:13 GMT
From: xyzmats@laplaza.org (Mats Wichmann)
Subject: Re: Perl and document conversion to HTML
Message-Id: <340450f3.14482474@news.laplaza.org>
>The file format for Word documents is proprietary. Microsoft does not
>publish it. It also tends to change with each new version of Word.
Somehow, every other wordprocessor on the face of the earth manages to
produce Word import and export filters. How proprietary can it be?
Mats Wichmann
To reply remove the "xyz" from the address
xyzmats@laplaza.org
------------------------------
Date: 27 Aug 1997 09:38:35 -0700
From: Rael Dornfest <rael@zx81.dnai.com>
Subject: Re: Perl Regular Expression has a bug?
Message-Id: <87pvqza8dw.fsf@zx81.dnai.com>
Tom Grydeland <tom@mitra.phys.uit.no> writes:
> > #!/usr/local/bin/perl
> > use Time::localtime;
> > $now = localtime;
> > print "Time: ", join(/:/, $date->hour, $date->min, $date->sec), "\n";
> Oh, yes. the $date should've been $now. Let's fix that.
Oops, sorry -- yankitis strikes again. Ran the right version; posted
the wrong one :-|
> Is it too much trouble to test three-line scripts before posting them?
Yes, that should be:
#!/usr/local/bin/perl
use Time::localtime;
$now = localtime;
print "Time: ", join(':', $now->hour, $now->min, $now->sec), "\n";
Rael
------------------------------
Date: Wed, 27 Aug 1997 12:45:34 -0400
From: "Brian P. Moffatt" <bmoffatt@virtualhometour.com>
Subject: perl/win95/Long File Names
Message-Id: <340459AD.B3B5AD0@virtualhometour.com>
I am using perl5 on my win95 machine and I need to "opendir" a LFN
directory.
Any suggestions.
/program files/netscape/navigator/program/...................etc. you
get the point.
how do I get in there??
Thanks in advance.
Brian
------------------------------
Date: 27 Aug 1997 15:21:02 GMT
From: gerben@cs.vu.nl (Gerben Vos)
Subject: Re: Premature End Of Script Headers?
Message-Id: <5u1gku$job$1@star.cs.vu.nl>
Webmaster writes:
> I've just recently begun working with perl as a CGI
I wonder what you mean by "perl as a CGI". Perl is a language,
not an interface.
> and though I've
>got the majority of the language down pat, I've come across an
>interesting delimma while trying to write a simple shopcart script that
>I've been boggled by for weeks. Initially I started the script to be a
>nice, small neat little package and was getting a "premature end of
>script headers" error...
Hmm... that is not a perl error message. Let's suppose that it comes
from your HTTP server, because your Perl script exited prematurely and
didn't emit any HTTP headers (you aren't very clear on this).
Did you try to run it from the command line? Tried perl -c ? perl -w ?
Are you using the CGI module? That will make testing from the command
line easier.
Maybe you can a backup of your script, and then start deleting code
until it doesn't give the error anymore? That may pinpoint the error.
g e r b e n @ c s . v u . n l . . . . . . . . . . . . G e r b e n V o s <><
Join the Coalition Against Unsolicited Commercial Email! http://www.cauce.org/
Ceci n'est pas une .signature .
------------------------------
Date: 27 Aug 1997 16:06:31 GMT
From: "IGOREK" <IGOREK@prodigy.net>
Subject: Problem with opendir or readdir???
Message-Id: <01bcb313$533a2000$2aefedcc@432>
Hi Perl professionals!!!
I'm having problem with the following script in AIX environment with Perl
5,000something.
This script works very good if I analyze files in the same directory as
this script located.
If I point to any other directories it lists just names of files but
doesn't show me any "-r","-w"...!?
What is that ?
Igor
Prodigy Internet.
#!/usr/local/bin/perl
#
#
#Lists files in directory; then
#tests files for data.
#
#$name = $ARGV[0];
opendir(DIR,"/home/igor/manhat/new/") || die "Can't open$name";
@entries = readdir(DIR);
close (DIR);
#Sort results
@sorted = sort(@entries);
foreach $entry (@sorted) {
if($entry =~ /\w/){ # Don't check directories
#Test each file
print "$entry ";
if (-r $entry) {
print "r";
} else {
print "-";
}
if (-w $entry){
print"w";
} else {
print"-";
}
if (-x $entry){
print"x";
} else {
print"-";
}
$size = -s $entry;
print "$size bytes ";
print "\n";
}
}
------------------------------
Date: 27 Aug 1997 17:14:00 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problem with opendir or readdir???
Message-Id: <5u1n8o$jhv@news-central.tiac.net>
In article <01bcb313$533a2000$2aefedcc@432>, IGOREK <IGOREK@prodigy.net> wrote:
>Hi Perl professionals!!!
>
>I'm having problem with the following script in AIX environment with Perl
>5,000something.
>This script works very good if I analyze files in the same directory as
>this script located.
>If I point to any other directories it lists just names of files but
>doesn't show me any "-r","-w"...!?
>
>What is that ?
>#$name = $ARGV[0];
>opendir(DIR,"/home/igor/manhat/new/") || die "Can't open$name";
>
>@entries = readdir(DIR);
>
>close (DIR);
>#Sort results
>
>@sorted = sort(@entries);
>
>foreach $entry (@sorted) {
To test the file you need the directory as well as the file name, so you
might say
$dir = 'whatever';
opendir (DIS, $dir) || dir "can't open $dir ($!)\n";
@sorted = sort readdir (DIR);
closedir DIR; # maybe check this...
foreach $entry (@sorted) {
if (-r "$dir/$entry") {
...
}
}
or make up a full file name in a variable inside the loop.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 27 Aug 1997 12:51:30 -0400
From: dt king <dtking@weblabs.com>
Subject: Re: Random Numbers
Message-Id: <34046922.152@weblabs.com>
Oh, thanks, I needed one of those. I'm doing a slot machine that needs
me to draw three random numbers in a row. The first random number is
fine, the second seems sluggish and the third gives me long runs of the
same number.
dtk
Bart Lateur wrote:
>
> sub random ($) {
> my ($a,$c,$m) = (16807,0,(1<<31)-1);
> $seed = ($seed * $a + $c) mod $m;
> return int($_[0] * $seed / $m);
> }
>
--
Yamaha recorders are musical instruments and should be used for their
intended purpose only. Comply with these instructions to avoid
personal injury or damages. [Yamaha Recorder Owner's Manual]
------------------------------
Date: Wed, 27 Aug 1997 09:46:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Fred Hurtubise <fhurtubi@videotron.net>
Subject: Re: SSI in SSI..
Message-Id: <Pine.GSO.3.96.970827094050.1757U-100000@julie.teleport.com>
On Wed, 27 Aug 1997, Fred Hurtubise wrote:
> Problem : I have a perl script wich reads a html file containing a
> SSI...does a bunch of things and print everything back...What's wrong is
> while using Content-type: text-html\n\n, the call to the SSI (<--#exec
> cgi="/foo/foo.cgi" -->) is not executed, but simply printed in the
> output...
That's because Perl has no idea what an SSI is! To Perl, it's all just
data in and data out. If you want your script to process an SSI, you'll
essentially have to teach it what an SSI is and how to process it. Good
luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 27 Aug 1997 17:09:38 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Syntax Question
Message-Id: <340a4666.39713343@news.enterprise.net>
"Buehler, Bob" <bob.buehler@cpa.state.tx.us> wrote:
>subroutine definition, sub is named message_handler, a list of 3 variables
>is assigned to the special variable @_. But, I don't understand the "my".
>What am I missing?
My makes the $db, $message, $state variables local to the
message_handler subroutine.
--
Matthew Burnham | danew@enterprise.net
Manager, MindWeb | http://www.mindweb.co.uk/
Page me: http://wwp.mirabilis.com/2807531 | 2807531-icq@mindweb.co.uk
Web design and hosting | UKP24/Mb/Year for DIY space
WWW, FTP, CGI scripting, mailing lists, autoresponders and more!
------------------------------
Date: Wed, 27 Aug 1997 09:39:32 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: SD <delaneys@worldnet.att.net>
Subject: Re: which way is more efficient?
Message-Id: <Pine.GSO.3.96.970827093647.1757T-100000@julie.teleport.com>
On Wed, 27 Aug 1997, SD wrote:
> Does anyone know which approach is more efficient and uses less memory
> (and why?)?
> foreach $listitem (@listitem) {
> while (<DB>) {
The second one, in general, since it doesn't have to (uselessly) allocate
the memory for the list of lines. The difference is especially large when
the file is large, of course, and is negligible when the file is small -
but it doesn't hurt to process line-by-line, whenever you can.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 932
*************************************