[7951] in Perl-Users-Digest
Perl-Users Digest, Issue: 1576 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 3 23:08:01 1998
Date: Sat, 3 Jan 98 20:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 3 Jan 1998 Volume: 8 Number: 1576
Today's topics:
@ARGV variabele looses its contents <a.den.ridder@tip.nl>
Re: @ARGV variabele looses its contents <ebohlman@netcom.com>
alarm() testing with debugger <dev@sgi.net>
Re: Finding the TITLE to a HTML page <scribble@pobox.com>
FULL TIME EMPLOYMENT <marcus@alex.net>
Re: How to get keyword <bosch@goweb.lu>
Re: newbie lost with MacPerl!! (Avram Grumer)
Re: newbie lost with MacPerl!! (John Moreno)
Re: Perl not Y2K compliant (Michal Jaegermann)
Re: Perl not Y2K compliant (John Moreno)
Re: Perl not Y2K compliant (John Moreno)
Re: Perl not Y2K compliant (John Moreno)
Re: Perl not Y2K compliant (Michael J Gebis)
Re: Perl not Y2K compliant <scribble@pobox.com>
Re: PERLIPC - FIFO: parent, child, stalled! <jbattikha@highsynth.com>
Re: PERLIPC - FIFO: parent, child, stalled! <jbattikha@highsynth.com>
SDBM losing records <pheon@hevanet.com>
Re: Unexpected problem with the query string <ljz@asfast.com>
UserAgent and POST questions (SasEz! Publications and Design)
Re: word wrap routine (brian d foy)
www.roth.net (Barry Hoggard)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 03 Jan 1998 22:44:48 +0100
From: Arno den Ridder <a.den.ridder@tip.nl>
Subject: @ARGV variabele looses its contents
Message-Id: <34AEB14F.CEB81E5A@tip.nl>
After entering a sub my @ARGV variabele looses its contents.
I start perl with "perl name.pl filename.txt"
The result is
test1 : filename.txt
test2 : filename.txt
test3 :
lines : 99278
Why is test3 empty?
=====
#script name.pl
sub analyse {
print "test2 : $filename\n";
while (<>) {
$nr_lines++;
}
}
for $filename (@ARGV) {
print "test1 : $filename\n";
analyse ();
print "test3 : $filename\n";
}
print "lines : $nr_lines\n";
------------------------------
Date: Sat, 3 Jan 1998 23:16:46 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: @ARGV variabele looses its contents
Message-Id: <ebohlmanEM8Dzy.JIo@netcom.com>
Arno den Ridder <a.den.ridder@tip.nl> wrote:
: After entering a sub my @ARGV variabele looses its contents.
: =====
: #script name.pl
: sub analyse {
: print "test2 : $filename\n";
: while (<>) {
Take a look at perlop to see what <> actually does. This is what's
causing your problem.
: $nr_lines++;
: }
: }
------------------------------
Date: Sat, 03 Jan 1998 21:47:41 GMT
From: "Devin P. Anderson" <dev@sgi.net>
Subject: alarm() testing with debugger
Message-Id: <34AEB2A9.60AD@sgi.net>
I have a program that uses the eval/die pair as described in the Camel
book for the purpose of watching for a timeout with an alarm() call. The
alarm call itself is in a subroutine so I setup the signal handler to
return a specfic error rather than die. This leads to my questions:
When I try to simulate a timeout caused by the alarm() signal (by just
stepping to the alarm() call, the just letting the debugger sit there),
the debugger says my program has terminated right away when the program
is acutally sending the alarm, returning the bad error message, and
executing the correct code! How can you correctly simulate this
situation with the debugger? It is like the debugger gets the eval then
forgets about what executed the eval.
Thanks!
--- @
Devin P. Anderson Happy Holidays * *
Webmaster, Systems Administrator from * ' *
Stargate Industries, Inc. Network Operations * ',` *
http://www.sgi.net/ *', `,
*
Phone: 412.930.STAR (7827) ext. 241
***********
F a x: 412.930.7110 ***
&& ***
&&
#=#=#=#=#=#=#=#=#=#=#
"Prehaps today *is* a good day to die. Ramming speed."
-Lt. Worf
-----PGP PUBLIC KEY AVAILABLE-----
------------------------------
Date: 3 Jan 1998 14:54:50 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <68m8iq$n9h@tekka.wwa.com>
joseph@5sigma.com writes:
>If I say, "You can be more productive, or more correct," a
>large group of people will see exactly what I mean, and another
>large group of people will see exactly what I mean, and they
>will be in complete disagreement. There is nowhere further
>to go with this.
There is. I resent the fact that you are evading the question
and talking your practical, commonsensical, tough-guy talk,
especially when I should be the one talking it. When it was
pointed out that fast HTML-parsing software exists and when
it's obvious that most browsers do in fact do the easy job of
stripping comments, you bad-mouthed that as "theoretical" and
"correct". Actually, it clearly implies that comments are to
be expected in real-world HTML and any one-off script you write
(no matter how quick and dirty) must take that into account.
I find it mystifying that you can be so unrealistic and then
call *yourself* the pragmatic, "productive" man.
------------------------------
Date: Fri, 02 Jan 1998 18:06:13 -0500
From: "Marcus A. Davis" <marcus@alex.net>
Subject: FULL TIME EMPLOYMENT
Message-Id: <34AD72E5.349E@alex.net>
The Alexander Group, Inc. is seeking qualified PERL programmers for full
and part-time employment along with contract work. We are a custom
Internet Applications company that has been around for nearly five
years. We are located in Indianapolis, Indiana USA.
Send resume to :
marcus@alex.net
or call
1.888.253.9637
Thanks,
Marcus A. Davis
President
The Alexander Group, Inc.
------------------------------
Date: Sat, 03 Jan 1998 23:38:17 +0100
From: Bosch Patrick <bosch@goweb.lu>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: How to get keyword
Message-Id: <34AEBDD5.A543BDA9@goweb.lu>
This is a multi-part message in MIME format.
--------------2F9A7C1CE36492DA9B04C324
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello again and first of all a happy new year!
I come back with my old perl-styled problem. I suppose that Perl is not the
problem but rather my poor Perl knowledge :-)
Sorry if I am a little bit late after my last mail, but I had some hospital
and car crash problems ... but the new year seems to be better - let's hope so.
Tom Phoenix wrote:
>
> On Mon, 8 Dec 1997, Bosch Patrick wrote:
>
> > I have a web server and I want that the users of this server can get a
> > keyword.
>
> I don't know what you mean by a keyword (maybe password?) but that seems
> to be a reasonable desire.
>
> > I have already a lot of perl cgi programs running on this server.
>
> That's interesting, but irrelevant. :-)
>
> > The server should call one of these programms and this programm should
> > get the keyword from a daemon.
>
> That sounds like a plan.
>
> > On startup the daemon should ask for the
> > keyword and identify the caller of daemon by uid and pid.
>
> Wait - does the daemon give or get the keyword? Or when you say it should
> "ask for the keyword", whom does it ask? By the "caller" of the daemon, do
> you mean the process which launches the daemon process?
>
> > The problem is that I don't if this is possible and how to realize it.
>
Ok, let's get a little bit more real:
On a web server - using allready https 128 bit - clients of a banking
institutin can leave rather confidential information. Several perl-cgi's
handle the input and should save the information in encrypted manner using
3DES on AIX4.2. But ... the keyword used to encrypt should not be provided by
the web user and should not be saved on the file system even not in a root
only readable file. Because we want that the information remains secure even
if the system has been cracked and the root account in particular. So here is
my plan - hope it's a good one:
1. There should be a daemon, which on startup should ask the user starting the
daemon the different keyword, then raiming in the programs memory.
2. When needed the cgi scripts of the web server should call the daemon in
order to get the keyword.
3. The daemon should authentify the http user by ppid, pid and uid.
The main problem for me is to know how the daemon can get ppid, pid and uid
from the web-script.
Thanks for your attention ..
Patrick
--
Patrick Bosch
+++++++++++++++++++++++++++++++
GoWeb sarl
Internet Project Management
+++++++++++++++++++++++++++++++
Tel.: +352/33 28 01
E-mail: bosch@goweb.lu
14, rue General Patton
L - 7270 Walferdange
Luxembourg
--------------2F9A7C1CE36492DA9B04C324
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patrick Bosch
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Patrick Bosch
n: Bosch;Patrick
org: GoWeb Sarl
adr;dom: ;;14, rue Giniral Patton;Walferdange;Luxembourg;7270;
email;internet: bosch@goweb.lu
title: Manager
tel;work: +352/33 28 01
tel;fax: +352/33 28 01
tel;home: +352/021/183 814 (cellular)
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------2F9A7C1CE36492DA9B04C324--
------------------------------
Date: Sat, 03 Jan 1998 17:08:00 -0500
From: avram@interport.net (Avram Grumer)
Subject: Re: newbie lost with MacPerl!!
Message-Id: <avram-0301981708010001@avram.port.net>
In article <34AD778D.261EE981@cataloniabsnreed.demon.co.uk>,
robertg@cataloniabsnreed.demon.co.uk wrote:
> Of course, it would be much better to use a book to learn
> Perl based on MacPerl5. Is there anything like that?
There's one in the works, but it's not finished yet. Draft chapters are
available at the MacPerl Pages website <http://www.ptf.com/macperl/>.
I learned using _Learning Perl_, from O'Reilly & Assoc., which isn't
Mac-specific (it assumes the reader uses Unix), but may be less
Mac-hostile than the book you're using.
--
Avram Grumer * avram@interport.net * Finger for public key
http://www.users.interport.net/~avram/
If you want a picture of the future of Usenet,
imagine a foot stuck in a human mouth -- forever.
------------------------------
Date: Sat, 3 Jan 1998 21:58:44 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: newbie lost with MacPerl!!
Message-Id: <1d2aurd.1nqqhnl1eod703N@roxboro-177.interpath.net>
Robert Garrigos <robertg@cataloniabsnreed.demon.co.uk> wrote:
> Hi everybody,
>
> I'm just starting to learn Perl on a Mac, with MacPerl5, and have a few
> problems.
-snip-
> perl -e "print 'Hello, World!' \n;"
You have to realize that the books is assuming that you are using a
command line, hence all one liners that start off with "perl" are one
line shell commands that get PASSED to perl.
print "Hello, World!\n";
Works just fine using MacPerl.
-snip-
> My questions are:
>
> Can I still use this book to learn Perl if I use MacPerl5?
Sure.
> What is it that I should take account of, regarding the two different
> versions of Perl and of the platforms?
The main things to keep in mind is the command line arguments to perl
and the file/folder separator is ":" not "/", and that one or two of the
commands are unix specific and not available on the mac.
--
John Moreno
------------------------------
Date: 3 Jan 1998 20:49:47 GMT
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: Perl not Y2K compliant
Message-Id: <68m89b$7vq$1@pulp.ucs.ualberta.ca>
Abigail (abigail@fnx.com) wrote:
: Michael Budash (mbudash@sonic.net) wrote on 1585 September 1993 in
: ++ can someone explain why 2038 is such a magic number?
:
: $ perl -lwe 'print scalar localtime -1 + (1 << 31)'
: Mon Jan 18 22:14:07 2038
: $
:
:
: Abigail
$ perl -lwe 'print scalar localtime (1 << 31)'
Mon Jan 18 20:14:08 2038
$ perl -lwe 'print scalar localtime (1 << 32)'
Sat Feb 6 23:28:16 2106
$ perl -lwe 'print scalar localtime (1 << 40)'
Sun Feb 19 17:36:16 36812
$ perl -lwe 'print scalar localtime (1 << 55)'
Sat Jun 12 23:26:08 1141709097
Should last for a while. :-) (perl under Linux on Alpha in this
particular case).
--mj
------------------------------
Date: Sat, 3 Jan 1998 16:12:45 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Perl not Y2K compliant
Message-Id: <1d2a67z.vfirel1k7guheN@roxboro-165.interpath.net>
Michael Budash <mbudash@sonic.net> wrote:
> abigail@fnx.com wrote:
>
-snip
> >> Time is kept as seconds past 1 Jan 1970, 0:00, as a 32 bit int.
> >>
> >>
>
> OK, I think I got it now...thanks!
Remember that this is NOT a problem inherent with perl but instead the
with the time as kept by the computer and OS (and the perl that uses
that implementation). If the OS is changed to keep a 64 bit value, and
a newer version of perl which knows about this is created then your perl
programs themselves should work just fine.
For example the Mac keeps the time as a UNSIGNED 32 bit int from
1/1/1904 (which means it will need a new implementation by the late '30
also).
--
John Moreno
------------------------------
Date: Sat, 3 Jan 1998 16:12:48 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Perl not Y2K compliant
Message-Id: <1d2a7wd.kj8ur5132r1e2N@roxboro-165.interpath.net>
Abigail <abigail@fnx.com> wrote:
> brian d foy (comdog@computerdog.com)
> ++ abigail@fnx.com wrote:
> ++
> ++ >Huh, what do you mean "by then"?
> ++
> ++ "by then" i was thinking only of the effects on the Unix clock. one
> ++ could always make another structure for their own times :)
>
>
> What makes you think that solves the 2038 problem? A large fraction
> of the Y2K problem consists of using datastructures/storages that
> use 2 chars for the year, and those are not trivially solved using
> a different structure.
>
> That problem will be the same with 2038.
I've pointed this out before - the problem isn't keeping the date in 2
bytes, it's keeping the date in 2 ASCII chars. If they had used 1900 as
a base (like perl does) and kept the year in a single byte, we wouldn't
be having the problem for another century and a half (surely enough time
to deal with it).
The Y2K problem was NOT created by lack of space - it was created by
laziness and a desire to keep it in a human readable format.
--
John Moreno
------------------------------
Date: Sat, 3 Jan 1998 16:12:55 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Perl not Y2K compliant
Message-Id: <1d2a8v8.1fkn2nqlkenspN@roxboro-165.interpath.net>
Brandon S. Allbery KF8NH:
> abigail@fnx.com (Abigail) said:
> +-----
> | ++ True, but that's with what amounts to formatted data. The most
> | probable ++ solution I see is that (long) will be a 64-bit type on most
> | platforms by then. What makes you think 32bit and 64bits aren't formats?
> +--->8
>
> Would you prefer kindergarten language? "Formatted" = "formatted for
> display, as by COBOL, xBase, and other monstrosities". Unless you're
> claiming that the complaint that started this thread (which itself assumed
> such a formatted value) was in fact valid....
>
> A 32-bit binary value can be adjusted in several ways; and, aside from
> file formats (which I recently commented on elsewhere; the gist, however,
> was "don't write internal format data to files if you can help it"),
> switching to 64-bit values involves recompiling with a compiler that
> treats (long) as 64-bit. Again, assuming intelligence on the part of the
> programmer.
This can create a lot of other problems. But using a compiler that can
create and use long long (64 bit) data types and then using a long long
to keep your dates in, doesn't create other problems and is just as
simple.
--
John Moreno
------------------------------
Date: 3 Jan 1998 23:22:06 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Perl not Y2K compliant
Message-Id: <68mh6u$7hd@mozo.cc.purdue.edu>
michal@gortel.phys.ualberta.ca (Michal Jaegermann) writes:
}$ perl -lwe 'print scalar localtime (1 << 55)'
}Sat Jun 12 23:26:08 1141709097
}Should last for a while.
That's the sort of attitude that got us into this mess in the first
place.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 3 Jan 1998 19:42:12 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Perl not Y2K compliant
Message-Id: <68mpdk$f2v@tekka.wwa.com>
gebis@albrecht.ecn.purdue.edu writes:
>michal@gortel.phys.ualberta.ca (Michal Jaegermann) writes:
>}$ perl -lwe 'print scalar localtime (1 << 55)'
>}Sat Jun 12 23:26:08 1141709097
>
>}Should last for a while.
>
>That's the sort of attitude that got us into this mess in the first
>place.
I can already imagine a 17-armed bionic human from the Planet
Zork settlement of 1141709097 A.D. cursing (in 12-part harmony)
the dumb 64-bit programmers from the 20th century, because her
Java-enabled telepathic wristwatch with built-in miniature
fractal lava-lamp just crapped out after only 5000 years of
use...
------------------------------
Date: Sat, 03 Jan 1998 16:10:42 -0500
From: Jihad Battikha <jbattikha@highsynth.com>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: PERLIPC - FIFO: parent, child, stalled!
Message-Id: <34AEA952.CCAA854A@highsynth.com>
Randal Schwartz wrote:
> That's very odd. Either I'm completely out of whack, or SSL is both
> an encryption system *and* an authentication system (server to
> browser).
>
> What makes you think the enroute data is not encrypted?
I dunno. Maybe because, to me, it's just looked like a certificate
system that:
a) authenticates the domain for the "customer"/user
b) keeps session information between the client & server
c) I assumed the session info was encrypted, not the data passed from a
web form
4) even if all data was encrypted, there's no guarantee that the user is
using >40bits
Am I wrong about this? Perhaps I should seriously read up on SSL...
BTW, Randal, I'm a fan your Web Techniques columns -- they're very
helpful examples of some very interesting uses of Perl. :-)
--
Jihad Battikha
jbattikha@highsynth.com
http://www.highsynth.com
------------------------------
Date: Sat, 03 Jan 1998 16:30:34 -0500
From: Jihad Battikha <jbattikha@highsynth.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: PERLIPC - FIFO: parent, child, stalled!
Message-Id: <34AEADFA.4C20C57C@highsynth.com>
Tom Phoenix wrote:
> > The only symbolics refs left when I'm done will probably only be path
> > variables.
>
> I don't know what that means. Do you mean your $ENV{PATH}? That shouldn't
> be accessed via a symbolic reference, for security reasons if nothing
> else.
Other than hard-coding my account's home path (which I don't want to
do), how could my script determine my home directory without using
$ENV{DOCUMENT_ROOT}? If I change hosting prodivers, I'll have to
tediously go through all my scripts to update the home path wouldn't I?
Anyway, I guess I'm pretty lost when it comes to properly "de-tainting"
my scripts. I kind of understand how something could get tainted, but
am having a difficult time cleaning things up. With time...
[ concerning the security aspects of a FIFO ]
> > starting the FIFO with a read instead of a write. That way, no other
> > process will be able to read from the FIFO until it's written to
> > (afterwhich the FIFO is deleted).
>
> I don't know: Unless you're sure about the order of process scheduling,
> this could be hard to accomplish securely. (And I wouldn't assume anything
> about the order of process scheduling.) But if you open it for read before
> the fork, that might be all right.
If I open the FIFO for read before the fork, the entire script will
block at that point -- unless there's something I'm missinge here. Will
a FIFO be non-blocking if the first in/out process is a READ? Anyway,
isn't this platorm-specific?
> > I looked at the CPAN PGP module & it's just too darn thick. It's also
> > terribly documented for such an eloborate package.
>
> Maybe you need to write a better one and submit it to CPAN. :-) From
> somewhere outside the US, of course. :-) (Seriously, we could use a
> really great PGP module, but (being an American) I can't do much about
> this. Maybe one of the foreigners reading this should step in.)
Alsa, I wish I knew my way around this stuff better & I would seriously
consider doing this (but I have the same "American" limitations). I've
only been playing with Perl for a few months so far.
[ concerning a bug in your PGP binary ]
> > I sent them the bug report initially & they didn't acknowledge the bug
> > so I sent them a second report detailing the problem precisely but
> > somehow I don't think I can count on a new release anytime soon... :-)
>
> Maybe you should get the PGP source and see about fixing things. The
> people in a newsgroup about PGP have always been helpful in these matters;
> they may even have a patch or workaround already.
I will check. Thanks.
--
Jihad Battikha
jbattikha@highsynth.com
http://www.highsynth.com
------------------------------
Date: 4 Jan 1998 03:29:09 GMT
From: "Andy Davidson" <pheon@hevanet.com>
Subject: SDBM losing records
Message-Id: <01bd18c1$7051b680$0200a8c0@tribble>
I am sorely puzzled by a problem with SDBM in the Win32 version of Perl.
I spent a lot of time looking for missing entries in a small DBM database.
It appears if I tie a hash to the SDBM file, records are not created or at
least not findable. When the bit of code below is run, it says that 77
lines
were read and processed but that there are only 47 keys.
If I comment out the 'use SDBM_File' and the 'tie' statements, the results
are 77 lines read, 77 keys.
I am running perl version 5.004_02 on a PC running Win95.
Am I doing something wrong? Or is there a problem in SDBM? What
alternatives do I have?
many thanks,
andy
----------------------------------------------------------------------
use SDBM_File;
open(IN,"\\webshare\\wwwroot\\prodweb\\Documents\\people.txt") or
die("Can't open people text file:$!\n");
tie(%PEOPLE, 'SDBM_File',
'\\webshare\\wwwroot\\prodweb\\Documents\people', O_RDWR | O_CREAT |
O_BINARY, 0777) or die( "Can't tie People database: $!\n" );
$lineno = 0;
while (<IN>) {
chomp;
$lineno = $lineno+1;
($id, $lastname, $firstname, $nickname, $loc, $phone, $dept, $title,
$email) = split('\|');
$PEOPLE{$id} = join('|', $id, $lastname, $firstname, $nickname, $loc,
$phone, $dept, $title, $email);
}
close IN;
$keysno = keys %PEOPLE;
print "=======================\n";
print "Read and processed $lineno lines\n";
print "There are $keysno keys\n";
print "=======================\n";
------------------------------
Date: 03 Jan 1998 19:26:34 -0500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Unexpected problem with the query string
Message-Id: <lrius113ut.fsf@asfast.com>
sbc@iol.it (Bud Bundy) writes:
> It should be easy, but it doesn't work :-(
> I have a script being called by a hyperlink like this:
> http://host.com/cgi-bin/c.pl?26
>
> Considering that the argument after the question mark is only a number
> (no forbidden chars).
>
> So I'd expect to be able to detect the value with a line like this:
> QUERY_STRING == 26
>
> But the QUERY_STRING is empty! What am I doing wrong?
QUERY_STRING is passed as an environment variable to CGI's. Therefore,
your comparison must look something like this in Perl:
$ENV{'QUERY_STRING'} == 26
In `QUERY_STRING == 26' what you're doing is numerically comparing the
character string "QUERY_STRING" with the number 26.
--
Lloyd Zusman
ljz@asfast.com
God bless you.
------------------------------
Date: Sat, 03 Jan 1998 01:00:22 GMT
From: sase@sasezdesyn.com (SasEz! Publications and Design)
Subject: UserAgent and POST questions
Message-Id: <34ad891f.11916240@news.theriver.com>
Hi all,
I have been studying perl for three to four weeks now. I've only
been using the man pages, faq's, tutorials online and this newsgroup
so far, I hope to get the camel book soon though.
I tested my first program today and after working out a couple of
syntax errors, I got it to work. I'm using UserAgent from the LWP
library, and for testing purposes I'm posting to my own free for all
links page. My new code is working but my free for all code is
telling me I didn't enter a URL. I've checked and triple checked
that I have the name= part right, it's name=url on the free for all
submit page so that is how I have it on my new test code.
If anyone wants to check out the code below and tell me what I may
be doing wrong I'd sure appreciate it. I'm trying to figure out why
my free for all code is sending back a No URL Error. I'm also
including other questions below the code for expansion on this
beginning one.
Reading this newsgroup makes me think the perl motto should be
SMWTDI (so many ways to do it) :)
Thanks in advance to all! :)
Now for the code:
#!/usr/bin/perl
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
my $req = new HTTP::Request POST =>
'http://www.sasezdesyn.com/freestuff/links.cgi';
$req->content_type ("application/x-www-form-urlencoded");
$req->content
("name=title&value=test2;name=url&value=http://www.test.com");
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
Now for my other questions.....
...Req POST=> #can I put a variable in here? @form('url')
$req->content #can I put a variable or associative array here?
%form('name', 'value') (I don't think that's quite the right
syntax)
Can I put the new request section inside of a for/foreach statement?
For instance,
$file = '/etc/passwd';
open(INFO, $file);
for ($i = 0; $i < 100; ++$i)
$" = $i;
@line = <INFO>;
close(INFO);
for $line
{
New User Agent....
}
And if I have 5 lines in the file then a new agent will be created 5
times, correct?
I try to read through the newsgroup at least every other day but
you're welcome to reply by mail also if you'd prefer. Thanks again!
Kathy Burns
-
SasEz! Publications and Design ~ Kathy Burns
Professional Web Design, Hosting, and Maintenance
Is your business set up to make money 24 hours a day, 7 days a week?
http://www.sasezdesyn.com mailto:sase@sasezdesyn.com
ICQ #828499 ~Check out our Free web design planning guide!~
-
------------------------------
Date: Sat, 03 Jan 1998 19:28:24 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: word wrap routine
Message-Id: <68mkmc$p1a@bgtnsc02.worldnet.att.net>
Keywords: just another new york perl hacker
In article <slrn6asu3l.ahs.gabor@vinyl.quickweb.com>, gabor@vinyl.quickweb.com (Gabor) posted:
> Tell me what you think.
> require Exporter;
> @ISA = (Exporter);
> @EXPORT = qw(wrap block_wrap);
use @EXPORT_OK so you don't muck up other packages by default :)
--
brian d foy <http://computerdog.com>
------------------------------
Date: Sun, 04 Jan 1998 00:37:55 GMT
From: hoggardb@panix.com (Barry Hoggard)
Subject: www.roth.net
Message-Id: <34aed9a8.6525304@news.panix.com>
I wanted to look at the Win32::ODBC pages, but the server is down
every time I try. Does anyone know any other place to get more info.
I've already been to CPAN.
Barry Hoggard | my home page - http://www.panix.com/~hoggardb
hoggardb@panix.com | National Association of Investors WebOp
New York, New York | http://www.better-investing.org
------------------------------
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 1576
**************************************