[9510] in Perl-Users-Digest
Perl-Users Digest, Issue: 3104 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 9 10:17:19 1998
Date: Thu, 9 Jul 98 07:01:21 -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 Thu, 9 Jul 1998 Volume: 8 Number: 3104
Today's topics:
Re: -- Abigail, A FIX to the space problem. (Abigail)
Re: -w on production code (was Re: better way of gettin (Abigail)
Re: -w on production code (was Re: better way of gettin (Tina Marie Holmboe)
Re: -w on production code (was Re: better way of gettin (Tad McClellan)
Re: -w on production code (was Re: better way of gettin <ljz@asfast.com>
Re: -w on production code (was Re: better way of gettin <merlyn@stonehenge.com>
Re: Abigail - Another Question for you. (Abigail)
ANNOUNCE: PDFprint 3.0 anface@geocities.com
Re: Choosing DBMS: friendly to Linux, Apache, Perl, Jav l_faillie@my-dejanews.com
DBD Oracle insert help needed (Michael Murphy)
Re: Do I understand this? <jc@ral1.zko.dec.com>
Re: Do I understand this? (Mike Stok)
Finding text between two tags on the same line? <era.eraspma@mesmtp.ericsson.se>
Re: Finding text between two tags on the same line? <dlaser@ermine.ox.ac.uk>
Re: Getting Yesterday's Date (-)
Re: Hash keys question <jdf@pobox.com>
How can I print on both sides of a paper? <ophir@saifun.com>
Re: HTTP connections WITHOUT the libwww module? (Derk Voss)
Re: Indexing servers (David A. Black)
mkdir with NT - question <shortys@shortysplace.com>
Re: modules (M.J.T. Guy)
Re: Need slick code: How to CWD to executable's directo <dfan@harmonixmusic.com>
Re: Newbie Needs Help: Very Easy Seach <mortensi@idt.ntnu.no>
Re: Oh man, DO I love Perl ! (References to things that <jdporter@min.net>
Re: outputting expanded variables in strings <jdf@pobox.com>
Printin on both sides of the page for Applix <ophir@saifun.com>
Q: Module installion on Windows 95 <dmgl@dmgl.kirov.ru>
Re: question about objects (Bart Lateur)
Recognizing BACK and FORWARD button-visits staaldui@my-dejanews.com
Re: regexp s/// for removing tail end of string <perlguy@inlink.com>
Re: Searching a file (Mike Stok)
sending EOF <Robert.Rehammar@emw.ericsson.se>
Re: Setting locale failed (Gilly)
Simple (?) Perl maths question simsi@my-dejanews.com
Simple (?) Perl maths question simsi@my-dejanews.com
Re: Simple (?) Perl maths question <qdtcall@esb.ericsson.se>
Unix Perl CGI <-> Windows NT Informix <matias@itqb.unl.pt>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Jul 1998 07:15:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -- Abigail, A FIX to the space problem.
Message-Id: <6o1qn7$8c8$2@client3.news.psi.net>
Webcruiser (dfsdf@ziplink.net) wrote on MDCCLXXII September MCMXCIII in
<URL: news:35A2E446.2797@ziplink.net>:
++ OK. I figured out that the html form doesn't like the @STATUS array. I
++ changed the form to use $STATUS instead. As far as reading the file from
++ the disk, I use the standard @STATUS = <FILE>, then I flatten the array
++ to a scaler variable as follows:
++
++ $numlines=@STATUS; # determine the number of lines in the array
++ $STATUS=""; # clear out $STATUS
++ for ($x=0; $x<=$numlines; $x++){
++ $STATUS = "$STATUS$STATUS[$x]"; # Build the $STATUS string
++ }
++
++ Now, when I pass the $STATUS variable as the default value to the form,
++ it picks up the string correctly, with line breaks and no leading space.
Instead of that silly loop, use:
{local $/;
$STATUS = <FILE>}
That will read the entire file in a scalar.
Or, if you first need to array to do manipulation, use:
$STATUS = join "", @STATUS;
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: 9 Jul 1998 07:19:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6o1qtn$8c8$4@client3.news.psi.net>
Lloyd Zusman (ljz@asfast.com) wrote on MDCCLXXIII September MCMXCIII in
<URL: news:ltww9n63cf.fsf@asfast.com>:
++ abigail@fnx.com (Abigail) writes:
++
++ > you want 'use strict;' too!
++
++ I do?
Yes.
Abigail
--
Trust me.
------------------------------
Date: 9 Jul 1998 10:15:11 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6o257f$7dg$1@news1.sol.no>
In article <35A43A8F.567E8279@aquila.com>,
"Michael D. Schleif" <mike.schleif@aquila.com> writes:
> I came upon this thread only today. When I began with Tina's reply, I
> asked myself, "Self, if her developers are NOT using -w during
> development, which it appears that they are not, then what other
> surprises are waiting for her? Screensful of -w errors would frighten
> me to death!"
Just a short (promise!) reply here...
They scare me too. But I'm in the unpleasant situation that I have little
or no control over what people do or do not.
The company I work for have a set of programming guidelines. These
guidelines are for the most part ignored (another discussion), but what
is often *not* ignored is adding -w to production code.
*Lots* of our new programmers do that. But they don't add -w to their
*development* code.
The process is something like this:
a) Develop something nifty. Don't bother with -w, 'cause they prolly
don't know about it anyway.
b) Put it in production - ohyes, the guidelines said to add -w, sure,
I can do that.
c) Walk away.
And yes, it scares me. More interesting a scenario is the following:
a) System programmer or system admin installs a new module.
b) The module sprouts warnings.
c) I used -w
d) I can't bloody debug my own script due to screefuls of warnings
from the *module*
e) I ask them to do something about the module
f) I am told to go fuck myself
Personally I don't bother with -w - the things I turn out these days emits
no warnings when I am done with them.
But I *deeply* hate -w in production code. It makes my life harder. It
makes my *job* harder. Had the people who produce the code actually made
sure that -w didn't *create* any warnings, I'd be all for it to catch
any problems that might crop up later. But, to quote the comercial that
none of you have probably ever seen, "They never do". And I have no
control over who they are, or what they do.
I agree with Randal. -w are training wheels; I *test* my code with -w.
But I don't put it in production with it.
(But ... just to anticipate: this is what *I* do, for *me*, and with
a rather clear view of why and why not, and which load of egg I'll
have delivered in my face. Others *must* make up their own minds.)
--
Tina Marie Holmboe
Systems Programmer (Geeks'R'Us) [tina@tech.scandinaviaonline.se]
WebMaster [webmaster@scandinaviaonline.se]
Scandinavia Online AB Development Dept. (+46) 08 587 81000 (switchboard)
(+46) 08 587 81189 (direct)
------------------------------
Date: Thu, 9 Jul 1998 00:06:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <l4j1o6.u49.ln@localhost>
Michael D. Schleif (mike.schleif@aquila.com) wrote:
: Let me toss this bone to the wolves:
: If "-w" and "use strict" were compiled-in-standard in Perl, how would
: that affect the postings to clpm? What would change here?
There would less traffic (questions).
;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 09 Jul 1998 08:27:19 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <ltu34r5hw8.fsf@asfast.com>
abigail@fnx.com (Abigail) writes:
> Lloyd Zusman (ljz@asfast.com) wrote on MDCCLXXIII September MCMXCIII in
> <URL: news:ltww9n63cf.fsf@asfast.com>:
> ++ abigail@fnx.com (Abigail) writes:
> ++
> ++ > you want 'use strict;' too!
> ++
> ++ I do?
>
>
> Yes.
>
>
>
> Abigail
> --
> Trust me.
I will go on the assumption that you aren't using "trust me" to mean
what many of my fellow New Yorkers mean when they say it. :)
So, let's see. Three out of the four items quoted at the end of this
message do have `-w'. However, there is not one `use strict;'. Two
of these still work the same when I add `use strict;'. The one
without a `-w' outputs 26 lines of warnings besides its regular output
when `-w' is added (without `use strict;').
Perhaps you consider japh's and the Roman Numeral date displayer to be
exceptions to your rule; if so, I take this to be quite reasonable and
I would totally agree with you ... just like I also consider it to be
quite reasonable to leave out the very useful and eminently helpful
`-w' and `use strict;' in certain other occasional cases, as well.
> perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
> perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
> perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
> ${qq$\x5F$} = q 97265646f9 and s g..g;
> qq e\x63\x68\x72\x20\x30\x78$&eggee;
> {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
> perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
> 0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
> =>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
> !$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Thu, 09 Jul 1998 13:58:12 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <8cg1gbdt3v.fsf@gadget.cscaper.com>
>>>>> "Michael" == Michael D Schleif <mike.schleif@aquila.com> writes:
Michael> Let me toss this bone to the wolves:
Michael> If "-w" and "use strict" were compiled-in-standard in Perl, how would
Michael> that affect the postings to clpm? What would change here?
We'd have a DAILY stream of people trying to run "perl" on Matt Wright's
Scripts and saying "I get this error... how do I fix it?".
No. No. A thousand times No.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 9 Jul 1998 07:17:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Abigail - Another Question for you.
Message-Id: <6o1qpd$8c8$3@client3.news.psi.net>
Ronald J Kimball (rjk@coos.dartmouth.edu) wrote on MDCCLXXIII September
MCMXCIII in <URL: news:1dbvjbi.4huxx81u2th0yN@bay2-44.quincy.ziplink.net>:
++ Abigail (abigail@fnx.com) wrote:
++
++ > ++ > And
++ > ++ > $STATUS=@status[0];
++ > ++ > does something else than you think it does.
++ > ++ OK, what does this actually do?
++ >
++ > @status [0] is a slice, and it's evaluated in scalar context.
++ > Since it is a slice with one element, it evaluates to 1.
++ >
++ > $STATUS = 1; is a different way to write the above.
++
++
++ Nope.
++
Indeed. Please tell your newsadmin to honour cancels, as the article was
cancelled.
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Thu, 09 Jul 1998 11:02:59 GMT
From: anface@geocities.com
Subject: ANNOUNCE: PDFprint 3.0
Message-Id: <6o2813$f1v$1@nnrp1.dejanews.com>
Hi,
We're glad to announce the version 3.0 of PDFprint.
Big news!
With libwww module http://www.sn.no/libwww-perl/ and
libnet module http://www.connect.net/gbarr/libnet/
the input file of PDFprint can be URL: ftp and http.
PDFprint is a very flexible tool to print PDF files (or parts of them) from
different directories and recursively from every subdirectories, from FTP and
HTTP sites, to a printer or to the monitor, in PostScript format or in text
format. PDFprint can also help you to print PostScript files (or parts of
them) from different directories and recursively from every subdirectories,
from FTP and HTTP sites, to a printer or to the monitor, in PostScript format
or in text format. PDFprint can also help you to print HTML files (or parts
of them) from different directories and recursively from every
subdirectories, from FTP and HTTP sites, to a printer or to the monitor, in
PostScript format or in text format.
This is the new URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Hangar/4794/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 09 Jul 1998 08:56:37 GMT
From: l_faillie@my-dejanews.com
Subject: Re: Choosing DBMS: friendly to Linux, Apache, Perl, Java
Message-Id: <6o20k4$4c5$1@nnrp1.dejanews.com>
I think "mSQL" is a good choice because it's
- Free,
- SQL compliant,
- Well documented,
- Have compagnons for writing HTML page with datas queries,
- can be used for user authentification with apache,
- ...
Hopping this can be usefull
- Laurent
The mispelling master is on the web.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 09 Jul 1998 07:09:46 -0500
From: mike_murphy-ppk@nortel.com (Michael Murphy)
Subject: DBD Oracle insert help needed
Message-Id: <mike_murphy-ppk-0907980709460001@nppkm606.us.nortel.com>
hello perl mongers,
I'm using DBI-0.88 and DBD-Oracle-0.46 with an Oracle 7.33 database. I'm
having trouble inserting into a LONG column in my table. The insert is
working but it's truncating the data at 80 characters. A LONG column should
hold up to 65535 characters and my input field is about 30,000 characters. I
have the chars in a variable and I prepare my sql statement and then bind my
variable to the parameter marker. I execute it and it works but it truncates
the column. Below is an example of what is happening:
my $input_data = 30,000+ CHARACTERS OF DATA;
my $sql = "INSERT INTO table (field_name) VALUES (?)";
my $dbh = DBI->connect("dbi:Oracle:$db", $userid, $passwd);
my $sth = $dbh->prepare($sql);
$sth->bind_param(1, $input_data, {TYPE => SQL_VARCHAR});
$sth->execute;
Oh yeah, I'm working on a SUN box.
Also, I've read thru DBI.pm about a million times and can't find anything about
truncating on inserts. There is some info about truncating on selects but that
doesn't seem to apply here. I've also looked elsewhere for help but can't find
anything. I figure I'm just missing something simple. Any help would be
appreciated.
TIA,
Mike
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Mike Murphy ~ Nortel ~
~ my opinions are my own ~ Raleigh, North Carolina ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Thu, 09 Jul 1998 09:34:59 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: Do I understand this?
Message-Id: <35A4C703.9A46DBAF@ral1.zko.dec.com>
Phillip George Geiger wrote:
>
> I want to put some advertising banners on my web site. They generally
> pay a set amount per click from a unique IP address.
Boy, are you gonna get flamed for that. But then, what is a
hyperlink but an ad for another page? In any case, you have
another problem that might not have a solution. This machine
is hidden behind a proxy server, for example, and any request
from any of several thousand machines here will all look to
you as if they were coming from a single IP address, that of
the proxy server. (And there ain't a damned thing you can do
about it. ;-)
> What I want to do is replace the link to their site with a link
> to a cgi program which does some bookkeeping for me and then
> redirects the client to the sponsor's web site.
>
> But someone told me that
> print: "Location: http://www.mysponsor.com/?mycode\n\n";
> will cause *my* server to send an http request to the sponsor's
> site, get the data, and then forward it to the client's computer.
> This is no good, since from the sponsor's point of view every
> click would seem to be coming from my server -- not the client.
Someone told you wrong. (So don't bother asking them any more
questions about the web. ;-) But you may not want to do it that
way anyway, since most browsers will react to that line by dropping
the connection and reconnecting to that site, and they'll never
see the rest of your page.
> My apologies if this belongs in a cgi newsgroup, or if it has
> been addressed a zillion times before. Every FAQ I could find
> did not specifically address this issue, DejaNews was no help,
> and even browsing a half dozen CGI books at a local bookstore
> didn't help.
This is definitely the wrong newsgroup, and I'd be a bit surprised
if you got a useful answer here. Try:
<URL:news:comp.infosystems.www.authoring.html>
<URL:news:comp.infosystems.www.authoring.cgi>
Not only will they be able to help, but most of them are perl
programmers, so they'll give better answers to web-related perl
questions than you'll get here.
------------------------------
Date: 9 Jul 1998 13:58:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Do I understand this?
Message-Id: <6o2iab$ckp@news-central.tiac.net>
In article <6o1dk0$6br$3@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Phillip George Geiger (geiger@cs.ucdavis.edu) wrote on MDCCLXXIII
>September MCMXCIII in <URL: news:6o125p$54j$1@mark.ucdavis.edu>:
>++ My apologies if it's off topic here. Which newsgroup would be a
>++ better place to ask it?
>
>
>Some newsgroups with 3 w's in a row.
Let's hope that the inhabitants of alt.swedish.chef.w.w.w have a sense of
humour...
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 09 Jul 1998 12:34:57 +0200
From: Marcus Spangenberg <era.eraspma@mesmtp.ericsson.se>
Subject: Finding text between two tags on the same line?
Message-Id: <35A49CD0.26056C6C@mesmtp.ericsson.se>
This script finds all unknown strings between <LINK> and </LINK> and
puts them into $s. The problem is that it can not find two strings on
the same line. How do I modify this script in order to make it find two
strings on the same line?
_______________________________________________
#!usr/local/bin/perl
$s_tag = "<LINK>";
$e_tag = "</LINK>";
while (<DATA>)
{
$s .= $_ if /$s_tag/../$e_tag/;
$s =~ s/.*$s_tag(.*?)$e_tag.*/$1/;
};
_______________________________________________
------------------------------
Date: 09 Jul 1998 11:55:57 +0100
From: Rob Hutchings <dlaser@ermine.ox.ac.uk>
Subject: Re: Finding text between two tags on the same line?
Message-Id: <yk3sokbe1j6.fsf@ermine.ox.ac.uk>
Marcus Spangenberg <era.eraspma@mesmtp.ericsson.se> writes:
>
> This script finds all unknown strings between <LINK> and </LINK> and
> puts them into $s. The problem is that it can not find two strings on
> the same line. How do I modify this script in order to make it find two
> strings on the same line?
>
>
> _______________________________________________
> #!usr/local/bin/perl
>
> $s_tag = "<LINK>";
> $e_tag = "</LINK>";
>
> while (<DATA>)
> {
> $s .= $_ if /$s_tag/../$e_tag/;
> $s =~ s/.*$s_tag(.*?)$e_tag.*/$1/;
> };
> _______________________________________________
>
while (<DATA>) {
push @links, m/$_tag(.*?)$e_tag/g;
}
$s = join '', @links; # if you REALLY want them all in a single string!
HTH -- Rob
------------------------------
Date: Thu, 09 Jul 1998 13:55:18 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Getting Yesterday's Date
Message-Id: <35a4cb3a.39048555@nntp.idsonline.com>
allbery@kf8nh.apk.net (Brandon S. Allbery KF8NH) Said this:
>Also sprach Randal Schwartz <merlyn@stonehenge.com> (<8cww9pi7vq.fsf@gadget.cscaper.com>):
>+-----
>| >>>>> "schumacc" == schumacc <schumacc@db.erau.edu> writes:
>| schumacc> there an easy way to do this within Perl or UNIX? I thought
>| schumacc> I could just subtract one from the day, but that quickly
>| schumacc> becomes more complicated than I want to deal with. Any
>|
>| $yesterday = localtime;
>| sleep 86400;
>| print "It was $yesterday yesterday\n";
>| :-)
Just use Selena Sol's date.pl - I think it even has a subroutine to
get "yesterday". Even if it doesn't have a "yesterday" routine, it
converts your dates into julian dates so it's easy to subtract from it
without running into the problems on the first of the month, for
example, where 1 - 1 = 0 but we all know it should be 30 or 31.
I think Selena's site is http://www.extropia.com
------------------------------
Date: 09 Jul 1998 08:56:09 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: gcarvell2@my-dejanews.com
Subject: Re: Hash keys question
Message-Id: <1zrv5ds6.fsf@mailhost.panix.com>
gcarvell2@my-dejanews.com writes:
> "Ambiguous use of {a} resolved to {"a"}".
This warning is a bug in perl, to be fixed in the next release. You
are to be commended for the amount of research you did in this matter.
If you'd had one more weapon in your arsenal, you'd have found this
answer, too. The weapon: DejaNews. HTH.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Thu, 09 Jul 1998 12:07:55 +0300
From: Ophir Marko <ophir@saifun.com>
Subject: How can I print on both sides of a paper?
Message-Id: <35A4886B.34E35D80@saifun.com>
HI All,
I need to write a perl script for Unix to print on both sides of a
paper. Our printer can do that but I have no idea how. So far I could
only get it to print on one side only.
Thanks,
Ophir Marko
please reply to ophir@saifun.com
------------------------------
Date: 9 Jul 1998 00:17:00 -0700
From: derk@sonic.net (Derk Voss)
Subject: Re: HTTP connections WITHOUT the libwww module?
Message-Id: <6o1qpc$oij@bolt.sonic.net>
http://www.extropia.com/Scripts/Source/Library/Http/http-lib.pl.txt
David Thompson (domainsource@usa.net) wrote:
: Is it possible to retrieve a URL (and store for later parsing) WITHOUT
: using the LibWWW module?
:
: Is it possible to just import the useragent functions into a script?
: (not my preferred solution, but workable).
:
: Thanks a lot!
:
: David Thompson
:
:
:
------------------------------
Date: Thu, 9 Jul 1998 08:39:19 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Indexing servers
Message-Id: <6o2dln$6po$1@earth.superlink.net>
Hello -
"Jim Babbington" <jwb79@mail.idt.net> writes:
>> I'm an NT user and know bugger all about UNIX - are u using grep as a
>unix
>> command? if so what does it do. Also, how does isindex work?
>Yeah, grep has it's roots in unix, but it is available for NT/win32s at
>www.cygnus.com. grep stands for GlobalRegularExpresionPrint
>You could of course employ the regex power of perl to accomplish
>the same thing, but I've found that using utilities like grep for globbing
>takes advantage of the OS's capabilites for accessing filename and
>physical file location, providing better performance, and error handling.
grep has the same standing, with respect to the operating system, as
Perl - namely, it's a program.
>To do this in perl(without grep), you would want open a dir and get a file
>list to work with:
Do you mean without Perl's grep() function, and/or without grep(1)?
>$search="flamers";
>opendir(DOCDIR,"html/") || die "error opening dir";
>while(readdir(DOCDIR)) {
> if(/\.html$/i) { push(@docfiles,$_) }
> }
>while($search_doc = pop(@docfiles) {
> $next_doc = 0; # we have to be carfull when doing opens within a while
>nest
> open(TEMP,"<$search_doc") || die "somtheing went terribly wrong!!";
> while(<TEMP>) {
> if($next_doc) { next } # need we look further?
> if(/$$search/i) {
> print "<a href=\"$search_doc\">$_</a><hr>";
> $next_doc = 1; # we're done here
> next;
> }
> close(TEMP); # don't leave this out!!
> }
>}
Just a few quick comments and/or questions:
1. It doesn't compile.
2. Why all this $next_doc and next stuff? Why not use 'last'?
3. Do you really mean /$$search/i ? Dereferencing $search isn't
going to accomplish much....
4. When you check for the success of open() calls, check $!, so
that you'll have some idea what the "something" was.
5. You could use the dreaded grep() to find the files you want to open:
opendir(DOCDIR,"html") or die "Can't opendir html: $!";
for my $search_doc (grep /\.html$/i, readdir DOCDIR) { ... }
David Black
dblack@saturn.superlink.net
------------------------------
Date: Thu, 09 Jul 1998 07:55:12 -0400
From: Stephen Ghelerter <shortys@shortysplace.com>
Subject: mkdir with NT - question
Message-Id: <35A4AF9F.F608823C@shortysplace.com>
I want to create a new subdirectory from a web page on an NT server. My
book on Perl only shows the permissions for Unix. I want execute
permission only (to run Perl and VBscript scripts). Can anyone tell me
how to do this. Thanks.
Steve
------------------------------
Date: 9 Jul 1998 07:01:17 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: modules
Message-Id: <6o1prt$j80$1@pegasus.csx.cam.ac.uk>
Craig Berry <cberry@cinenet.net> wrote:
>Ulf Wendel (ulf.wendel@kiel.netsruf.de) wrote:
>: use lib $cwb;
>
> use lib '.';
>
>has the same effect, with less typing.
Not if the script subsequently does a chdir(). In general,
relative paths in @INC are a Bad Thing and should be avoided.
(And yes, the default perl habit of putting "." in @INC is obnoxious.)
Mike Guy
------------------------------
Date: 09 Jul 1998 09:41:45 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: Need slick code: How to CWD to executable's directory
Message-Id: <wkbtqznnty.fsf@turangalila.harmonixmusic.com>
Chris Schoenfeld <chris@ixlabs.com> writes:
| I have programs that need to cwd to the directory they live in, rather
| than the user's cwd.
|
| I usually just parse $0, but would like to know if there is a slicker,
| less artistic way.
I had this exact same question last week, and the first thing I did
was to search for "directory" in the FAQ, and it was there. It's in
perlfaq8, to be precise.
--
Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: 9 Jul 1998 08:20:21 GMT
From: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: Newbie Needs Help: Very Easy Seach
Message-Id: <6o1ug5$7j0$1@due.unit.no>
Chad Hudson <chad@tice.com> wrote:
> Follow up
> Forgot: Would also like the results to dispaly the description as well
> So if search was "flag and US"
> Results
> F_USA.html Flag of the United States of America
I don't have a tested perl-script for you, but if you can do some on
your own, you may use this as a starting point:
-------------
# you have to make a routine to get user-input. Probably just read some
# environmental variable. $ENV{'QUERY_STRING'} for instance...
$query = &get_query;
# assuming that your database file is a plain-text file
open (DATABASE,"$dbfile") || die "could not open $dbfile";
while (<DATABASE>) {
chop;
($file,$not_used) = split(/\s+/,$_);
if ($file =~ /$query/) {
print "$_\n";
}
} close (DATABASE);
------------
If you are looking for something *really* fast, then maybe you should
use some other languge than Perl (C for instance).
Hope this helps
Morten Simonsen
------------------------------
Date: Thu, 09 Jul 1998 12:37:03 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Oh man, DO I love Perl ! (References to things that go out of scope)
Message-Id: <35A4BB39.4D2C@min.net>
Zenin wrote:
>
> Abstraction is a good thing, when it has a purpose. Abstraction for
> the sake of abstraction alone is often counterproductive. There is
> a time and place for set/get methods, and a time and place for
> direct public/protected field access. Chose the best tool and
> design for the job at hand. Forcing the use of a particular methodology
> without reguard for the task at hand isn't very Perlish.
Well said.
--
John Porter
------------------------------
Date: 09 Jul 1998 09:06:44 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Michael Lawhorne" <michael@mail.warpone.net>
Subject: Re: outputting expanded variables in strings
Message-Id: <yau33yq3.fsf@mailhost.panix.com>
"Michael Lawhorne" <michael@mail.warpone.net> writes:
> That works, but when it writes it to a file it causes the text after
> each variable to begin on a new line, even though I don't have any
> \n's in the string.
Well, it isn't Allah who's putting those newlines into your string.
Why don't you try
print "<$foo>\n"; #where $foo is one of your template variables
and see where that right angle bracket ends up?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Thu, 09 Jul 1998 12:24:47 +0300
From: Ophir Marko <ophir@saifun.com>
Subject: Printin on both sides of the page for Applix
Message-Id: <35A48C5F.40EF6D14@saifun.com>
Hi all,
Does anyone know how to write a script that prints on both sides of the
paper for applix? I already made one for printin one-sided in the
shell-tool.
Thanks,
Ophir Marko
please reply to ophir@saifun.com
------------------------------
Date: Thu, 9 Jul 1998 16:44:31 +0400
From: "D" <dmgl@dmgl.kirov.ru>
Subject: Q: Module installion on Windows 95
Message-Id: <35a4bb44.0@rapeme.kirov.ru>
On UNIX we usually install Perl module with this procedure:
perl Makefile.PL
make
make install
What shall I do on Windows 95?
------------------------------
Date: Thu, 09 Jul 1998 13:56:04 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: question about objects
Message-Id: <35a4c976.1912378@news.tornado.be>
Tye McQueen wrote:
>... and write
>
> { $XyZzY= $^W; $^W= 0; $arg= $ARGV[0]; $^W= $XyZzY; }
>
>to avoid the "uninitialized value" warning when no command-line
>arguments are given. It is a frustrating mindset.
Here's another candidate idiom for ya.
{ local($^W);
$arg= $ARGV[0];
}
Note that you don't need to assign undef or 0 to $^W, since local does
that for you (undef).
Bart.
------------------------------
Date: Thu, 09 Jul 1998 08:17:23 GMT
From: staaldui@my-dejanews.com
Subject: Recognizing BACK and FORWARD button-visits
Message-Id: <6o1uai$1fl$1@nnrp1.dejanews.com>
Hi,
I'm trying to find a way to see the 'site-walking' behaviour of a visitor. By
this I mean I am looking for a way so I can see a visitor is pressing the
BACK and FORWARD-buttons to go through previously cached pages. (e.g. a
visitor comes in on page A, clicks on a link to page B, clicks on a link to
page C and clicks BACK to go back to page B again. When the visitor comes
back on page B this is recognized as a repeated visit to page B.)
Theoratically this can be achieved by disabeling caching (through
HTTP-headers) and use cookies to tell the different visitors apart and to
tell which visitor is a first-time visitor and which is not, however, I don't
want to rely on cookies for that, since cookies can be blocked by the client.
How can I make the server recognize (or make the client tell the server) that
a visitor has been on the page before, without using cookies and without
comparing IP-addresses in a time frame (which is a problem for proxies)?
Any help would be really appreciated.
Thanks,
Arjan van Staalduijnen
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 9 Jul 1998 12:45:49 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: regexp s/// for removing tail end of string
Message-Id: <35A4BB7C.6ADF6A1@inlink.com>
> : I have a string that is a full path to a file, i.e.
> : dir/subdir/subsubdir/file.ext What I want to do is strip off the file name,
> : leaving just the path info (with the final / ) in a string. The paths will
> : have a varying number of directories, so I don't think I can use split to
> : just grab all the dirs, throw out the last one, and join the remainder
> : together. (If this is the way to go, please show me I can't see it).
>
> : I tried substitution, using this:
> : $path =~ s/\/.*?$//;
> : but it strips off everything after the first '/'. I thought the '.*?' would
> : give me the minimal match, and the '$' would make the match start at the
> : end of the string, but I'm wrong.
>
> : Checked the FAQ, newsgroup, manpages, several books. All to no avail. I
> : know I'm missing something elementarily simple....
>
> : TIA,
> : Fitz
What about something like:
@temp=split(/\//,$path);
pop @temp;
$newpath = join('/',@temp);
$newpath.="/";
print $newpath,"\n";
I TESTED it, and it seems to work fine.
You don't have to worry about the path's length because the pop will
take off the last element, which should be the filename.
Brent
------------------------------
Date: 9 Jul 1998 13:51:55 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Searching a file
Message-Id: <6o2htr$auc@news-central.tiac.net>
In article <7o61o6.058.ln@localhost>, Tad McClellan <tadmc@flash.net> wrote:
>Jonathan Feinberg (jdf@pobox.com) wrote:
>: David Hamilton <ozslot@alphalink.com.au> writes:
>
>: > $email=($INPUT{'email'});
>: ^ ^
>: These parentheses simply make your code obscure; they don't do
>: anything useful.
>
>
> ... and the single quotes don't do anything useful either.
They do, if you're using -w while developing perl then using quotes around
the bareword suppresses warnings in the current stable perl (5.004_04):
#!/usr/local/bin/perl -w
sub foo {
return 'bar';
}
$x{foo} = 'bar';
$x{bar} = 'baz';
says
Ambiguous use of {foo} resolved to {"foo"} at ./try.pl line 7.
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@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 09 Jul 1998 07:52:28 +0100
From: Robert Rehammar <Robert.Rehammar@emw.ericsson.se>
Subject: sending EOF
Message-Id: <35A468AC.93B024EA@emw.ericsson.se>
I'm writing a perlscript witch is to send an e-mail with sendmail. This
works becaus I prints a ".\n" to sendmail, bur I read in tha man-pages
that this can be done by sending an EOF to. is \0 eq to EOF ??
\\Robert Rehammar
------------------------------
Date: Thu, 09 Jul 1998 13:18:03 GMT
From: mingtian@hanmail.net (Gilly)
Subject: Re: Setting locale failed
Message-Id: <35a5c2ad.18012452@usenet.kornet21.net>
export LANG=C
not, export LANG=c
"Mark McLellan" <mark@mclellan.com> wrote:
>I just installed PERL 5.004_04 and I am getting the following warning after
>running either "perl -v" or "filename.pl".
>perl: warning: Setting locale failed.
>perl: warning: Please check that your locale settings:
> LC_ALL = "en_US.ISO8859-1",
> LANG = "us"
> are supported and installed on your system.
>perl: warning: Falling back to the standard locale ("C").
@}`,--`,--- ">
------------------------------
Date: Thu, 09 Jul 1998 11:03:39 GMT
From: simsi@my-dejanews.com
Subject: Simple (?) Perl maths question
Message-Id: <6o282b$f24$1@nnrp1.dejanews.com>
Hi all,
Can anyone kindly help with a small problem. I have a number
(1.67796100340829e-16) which i need to represent in everday normal terms in a
Perl app? I have been informed that some Math functions in perl are not 100%
reliable and this app is mission critical so i can't afford that.
Any help greatly appreciated...
Thanks
Ian Sims
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 09 Jul 1998 11:03:40 GMT
From: simsi@my-dejanews.com
Subject: Simple (?) Perl maths question
Message-Id: <6o282c$f25$1@nnrp1.dejanews.com>
Hi all,
Can anyone kindly help with a small problem. I have a number
(1.67796100340829e-16) which i need to represent in everday normal terms in a
Perl app? I have been informed that some Math functions in perl are not 100%
reliable and this app is mission critical so i can't afford that.
Any help greatly appreciated...
Thanks
Ian Sims
simsi@hotmail.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 09 Jul 1998 15:13:59 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Simple (?) Perl maths question
Message-Id: <is90m3np48.fsf@godzilla.kiere.ericsson.se>
simsi@my-dejanews.com writes:
> I have a number (1.67796100340829e-16) which i need to represent in
> everday normal terms in a Perl app?
I'm not sure what you mean by "everyday normal terms" (where I work,
the format you give would be consider the normal one), but you can
probably get it by using the printf() function. It's described in the
perlfunc manpage (look under sprintf() as well if you're not familiar
with printf-style format strings).
> I have been informed that some Math functions in perl are not 100%
> reliable
Well, *nothing* is 100% reliable. Hardware bugs (think Pentium FDIV
bug) and cosmic radiation will see to that, even if your program is
flawless. Perl's math functions work just fine. But, as always when
you do calculations on a digital computer, you have to be aware of the
limitations inherent in the ways numbers are represented in the
machine.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Thu, 09 Jul 1998 10:30:40 +0100
From: "Pedro M. Matias" <matias@itqb.unl.pt>
Subject: Unix Perl CGI <-> Windows NT Informix
Message-Id: <35A48DC0.854BCF25@itqb.unl.pt>
Hello.
I'm trying to create a Perl CGI script on a UNIX www server to access
and modify an
Informix Database on a Windows NT system and I'm looking for a kind soul
who can
give me some hints on how to do it. The main problem seems to be the
communication
between the UNIX system and the NT Informix server.
Thanks in advance,
Pedro Matias
------------------------------
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 3104
**************************************