[18416] in Perl-Users-Digest
Perl-Users Digest, Issue: 584 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 29 14:11:12 2001
Date: Thu, 29 Mar 2001 11:10:41 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985893041-v10-i584@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 29 Mar 2001 Volume: 10 Number: 584
Today's topics:
Re: How to detect whether STDERR is duped to another fi nobull@mail.com
Re: How to search and replace certain word lines in a f (Bernard El-Hagin)
Re: How to search and replace certain word lines in a f (Tad McClellan)
Re: How to search and replace certain word lines in a f (Logan Shaw)
Re: How to use Net::Telnet? <jackkon@pchome.com.tw>
Re: HUP signal handling <david.kernen@bms.com>
Installing a private version of modules <bernie@fantasyfarm.com>
Re: Is there an easier way of doing this? (Multiple fil nobull@mail.com
Re: Is there an easier way of doing this? (Multiple fil <crt@highvision.net>
Locking a file while a process on it <etienno@sympatico.ca>
Re: LWP help <pillgrim@mail.ru>
Re: LWP Timeout using get to get a webpage (Randal L. Schwartz)
LWP <mail@ericmarques.net>
Re: LWP <mail@ericmarques.net>
Re: LWP <tony_curtis32@yahoo.com>
Re: LWP <gisle@ActiveState.com>
LWP::Simple::get don't get what I want. <jonni@ifm.liu.se>
Re: LWP::Simple::get don't get what I want. (Logan Shaw)
Mailing List Managers <salsacrazy@salsacrazy.com>
Re: Mailing List Managers <tony_curtis32@yahoo.com>
NEWBIE: Help running Perl from Apache <clive@bromley.ac.uk>
Re: Newbie: keep on matching until end of string <dwake@Turing.Stanford.EDU>
Re: Newbie: keep on matching until end of string <dwake@Turing.Stanford.EDU>
Re: Newbie: keep on matching until end of string <dwake@Turing.Stanford.EDU>
Re: Newbie: keep on matching until end of string <hafner-usenet@ze.tu-muenchen.de>
Re: Newbie: keep on matching until end of string <bmb@ginger.libs.uga.edu>
Re: Password: logfile (David Efflandt)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Mar 2001 17:38:03 +0100
From: nobull@mail.com
Subject: Re: How to detect whether STDERR is duped to another file handle
Message-Id: <u9zoe43504.fsf@wcl-l.bham.ac.uk>
This is really more an OS thing than a Perl thing.
"John Lin" <johnlin@chttl.com.tw> writes:
> I know I can't use
>
> if(fileno(STDERR) == fileno(LOG))
>
> to detect whether STDERR is duped to LOG or not.
> Then, what should I use?
You could compare stat(STDERR) and stat(LOG).
This would tell if STDERR and LOG are pointing to the same file.
There is no portable way AFAIK of knowing if they are actually the
same file control block (i.e. the result of a dup()) or separate FCBs
(i.e. the result of open()ing the same file twice).
In theory you should only need to compare the first two fields of
stat() since that should uniquely define the file. This may not work
on non-POSIX OSs. Notably it won't work on Win32 - however comparing
the whole of the stat() array is a fairly good heuristic.
ISTR it also will give false-positive (even on some Unix-like OSs) if
the "files" in question are anonymous pipes or sockets.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 29 Mar 2001 06:34:24 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: How to search and replace certain word lines in a file without a temp. file
Message-Id: <slrn9c5lpe.13u.bernard.el-hagin@gdndev32.lido-tech>
On Thu, 29 Mar 2001 06:24:41 GMT, tvn007@hotmail.com
<tvn007@hotmail.com> wrote:
>
>Hi,
>
>Could someone help me ?
>
>I need to search in a file for certain word. Once I find
>that word I need to replace it with something else.
>I would like to do this without a temporary file.
For the search and replace read about s/// in perldoc perlop and for the
in-place editing of the file read about the -i switch in perldoc perlrun.
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: Thu, 29 Mar 2001 00:50:53 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to search and replace certain word lines in a file without a temp. file
Message-Id: <slrn9c5j9t.kl1.tadmc@tadmc26.august.net>
tvn007@hotmail.com <tvn007@hotmail.com> wrote:
>
>
>I need to search in a file for certain word. Once I find
>that word I need to replace it with something else.
>I would like to do this without a temporary file.
^^^^^^^^^^^^^^^^^^^^^^^^
Why?
Without a temporary file, you have only two other choices:
1) if the replacement string is exactly the same length as
the string to be replaced then you can do it with seek().
2) if you can read the whole darn file into memory, then you
can modify it in memory and write it back out.
If you have big files, or different length strings, then use
a temporary file. _You_ don't have to manage a temporary file,
perl will do it automatically for you, as the applicable
Frequently Asked Question points out.
"How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?"
You are expected to check the Perl FAQ *before* you post to the
Perl newsgroup you know.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 29 Mar 2001 01:20:04 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How to search and replace certain word lines in a file without a temp. file
Message-Id: <99unn4$jdn$1@boomer.cs.utexas.edu>
In article <slrn9c5j9t.kl1.tadmc@tadmc26.august.net>,
Tad McClellan <tadmc@augustmail.com> wrote:
>tvn007@hotmail.com <tvn007@hotmail.com> wrote:
>>that word I need to replace it with something else.
>>I would like to do this without a temporary file.
> ^^^^^^^^^^^^^^^^^^^^^^^^
>
>Without a temporary file, you have only two other choices:
>
>1) if the replacement string is exactly the same length as
> the string to be replaced then you can do it with seek().
>
>2) if you can read the whole darn file into memory, then you
> can modify it in memory and write it back out.
No, you can do it without a temporary file. All you have to do is
shift the bytes around. It's a pain, though.
For instance, if your file is 1234 bytes long, and your old string
ranged from byte 125 through 128, but your new string must go from byte
125 through 131, you'll need to move byte 129 to 132, 130 to 133, and
so on up to moving byte 1233 to 1236. Note that you must move bytes in
decreasing order. Otherwise, you'll move byte 129 to 132, and then
when you try to move 132 to 135, you'll actually be moving 129 to 135.
If you want to make string shorter instead of longer, it's similar, but
you must now move them in increasing numerical order.
It's also possible to do this in blocks for greater efficiency, but
it's even *more* of a pain.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: Thu, 29 Mar 2001 09:51:43 +0800
From: "jackkon" <jackkon@pchome.com.tw>
Subject: Re: How to use Net::Telnet?
Message-Id: <99u4o1$31n@netnews.hinet.net>
hi.......all
This is a example adopt from Net::Telnet.
I just want to chage the code to fit my script.
But I don't understand the section of prompt in the example.
I have read the document about the "prompt - pattern to match a prompt",
but I don't understand it clearly.
I have a accout in a remote linux server.
When I login the linux, my prompt looks like "[jackkon]" and my shell is
/bin/bash.
How can I do?
Thanks :)
=======================================================
my ($block, $filename, $host, $hostname, $k_per_sec, $line,
$num_read, $passwd, $prevblock, $prompt, $size, $size_bsd,
$size_sysv, $start_time, $total_time, $username);
$hostname = "your_destination_host_here";
$username = "your_username_here";
$passwd = "your_password_here";
$filename = "your_download_file_here";
## Connect and login.
use Net::Telnet ();
$host = new Net::Telnet (Timeout => 30,
Prompt => '/[%#>] $/');
$host->open($hostname);
$host->login($username, $passwd);
##--------------------------------------------------------------------------
-----##
## Make sure prompt won't match anything in send data.
$prompt = '_funkyPrompt_';
$host->prompt("/$prompt\$/");
$host->cmd("set prompt = '$prompt'");
## I change the code above to code below, but it don't work.
## $prompt = 'jackkon';
## $host->prompt("/$prompt\$/");
## $host->cmd("PS1 = '$prompt'");
##--------------------------------------------------------------------------
-----##
## Get size of file.
($line) = $host->cmd("/bin/ls -l $filename");
($size_bsd, $size_sysv) = (split ' ', $line)[3,4];
if ($size_sysv =~ /^\d+$/) {
$size = $size_sysv;
}
elsif ($size_bsd =~ /^\d+$/) {
$size = $size_bsd;
}
else {
die "$filename: no such file on $hostname";
}
## Start sending the file.
binmode STDOUT;
$host->binmode(1);
$host->print("/bin/sh -c 'stty raw; cat $filename'");
$host->getline; # discard echoed back line
## Read file a block at a time.
$num_read = 0;
$prevblock = '';
$start_time = time;
while (($block = $host->get) and ($block !~ /$prompt$/o)) {
if (length $block >= length $prompt) {
print $prevblock;
$num_read += length $prevblock;
$prevblock = $block;
}
else {
$prevblock .= $block;
}
}
$host->close;
## Print last block without trailing prompt.
$prevblock .= $block;
$prevblock =~ s/$prompt$//;
print $prevblock;
$num_read += length $prevblock;
die "error: expected size $size, received size $num_read\n"
unless $num_read == $size;
## Print totals.
$total_time = (time - $start_time) || 1;
$k_per_sec = ($size / 1024) / $total_time;
$k_per_sec = sprintf "%3.1f", $k_per_sec;
warn("$num_read bytes received in $total_time seconds ",
"($k_per_sec Kbytes/s)\n");
exit;
=======================================================
------------------------------
Date: Wed, 28 Mar 2001 15:50:49 -0500
From: Dave <david.kernen@bms.com>
Subject: Re: HUP signal handling
Message-Id: <3AC24EA9.C3E2EDEE@bms.com>
Marc Bigler wrote:
> ...The problem that I am getting is the following: the first kill -HUP on
> the perl process will work perfectly...But if then I ... kill -HUP to
> restart it again then ...it just seems that it doesn't want to process
> anymore my HUP.
>
I thought this problem went away a while ago, but I do know that on older
System V systems once a signal handler was invoked the signal handler would
be cleared unless the signal handler re-installed itself. This was
eliminated later since it introduced a race condition. (The second
occurrence of a signal might arrive before the signal handler was
reinstalled.)
You can easily test whether or not this is the case on your system by
including a "$SIG{HUP} = \&reinitialize;" statement within your
"reinitialize" subroutine, preferably near the top of the sub so as to
minimize the chances of a race condition. (Or, better yet, set $SIG{HUP} to
'IGNORE' at the top and then reset it to \$reinitialize at the bottom.)
Then kill -HUP yourself two times.
Good luck,
Dave Kernen
------------------------------
Date: Thu, 29 Mar 2001 11:08:17 -0500
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Installing a private version of modules
Message-Id: <8cm6ctk1ssqj6nj7hjta1p5cqrah80rmf4@4ax.com>
I'm not sure what I'm doing wrong here and i confess I don't exactly
understand how all this almost-magic works...... I looked in FAQ8
where it tells me:
>>When you build modules, use the PREFIX option when
>> generating Makefiles:
>>
>> perl Makefile.PL PREFIX=/u/mydir/perl
OK ... I want to play around with Curses. I downloaded Curses 1.05
and did:
>>perl Makefile.PL PREFIX=/home/bernie/private/perl PANELS
and I also tried it the other way:
>>perl Makefile.PL PANELS PREFIX=/home/bernie/private/perl
but in both cases, I get a Makefile that just says:
} PREFIX = /usr
And, of course, the system resolutely attempts to install the package
in the system directory [and partly fails]. What am I doing wrong?
THANKS!!
------------------------------
Date: 28 Mar 2001 20:05:36 +0100
From: nobull@mail.com
Subject: Re: Is there an easier way of doing this? (Multiple file handling)
Message-Id: <u9u24d4su7.fsf@wcl-l.bham.ac.uk>
sendthis@yahoo.delthisandasdf.com (e) writes:
> Right now, I combine them into one file using "paste -d" " file1 file2 >
> work_with_me;" in unix.
> open (FILE,"test/work_with_me");
> @array = <FILE>;
> close (FILE);
> foreach $line (@array )
> @work = split (/\t/,$line); # Splits the variable into an array by <tab>
open (FILE1,"test/file1") or die $!;
open (FILE2,"test/file2") or die $!;
while (<FILE1>) {
chomp;
my $line2 = <FILE2>;
die "file2 is shorter than file1"
unless defined $line2;
$_ .= " $line2";
my @work = split (/\t/);
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 28 Mar 2001 15:16:12 -0500
From: Casey West <crt@highvision.net>
Subject: Re: Is there an easier way of doing this? (Multiple file handling)
Message-Id: <Pine.OSF.4.21.0103281504370.27050-100000@home.kiski.net>
Today around 5:02pm, e hammered out this masterpiece:
: I have a working solution but I'm curious if there is an easier way.
:
: I have two files with the same number of elements. Two different fields from
: the same database.
: I have two sets of data that I want to manipulate.
:
: Right now, I combine them into one file using "paste -d" " file1 file2 >
: work_with_me;" in unix.
:
: What I want to know, is can I open them separately in perl and do the same
: thing. I've attached what I'm doing below.
According to your question above, you want a simple Perl
implementation of your unix command. The code below does nothing of
th sort, this does though:
if ( open F1, 'file1' and open F2, 'file2' and open F3, '> file3' ) {
chomp and print F3 "$_\t" . <F2> while <F1>;
close F1 and close F2 and close F3;
} else {
die "Can't open files: $!";
}
I was feeling weird in terms of style so YMMV.
: This isn't actually what I'm doing, just the part essential in understanding my
: question.
:
As for the code below, here is my idea of eaier way (according to
what your code below does):
open FH, 'file3' or die $!;
print split /\s*\t|\// while <FH>;
close FH;
: #!/bin/perl
:
:
: open (FILE,"test/work_with_me");
: @array = <FILE>;
: close (FILE);
:
: foreach $line (@array )
: {
:
: @work = split (/\t/,$line); # Splits the variable into an array by <tab>
: @date = split (/\//,$work[0]); # Splits the variable into an array of three
: # delimited by '/'
: $release = $work[1];
: $release =~ s/ +$//g; # Remove all trailing spaces
:
: $date_mo = $date[0];
: $date_da = $date[1];
: $date_yr = $date[2];
:
: print $release;
: print $date_mo;
: print $date_da;
: print $date_yr;
:
: }
:
:
:
--
Casey West
------------------------------
Date: Thu, 29 Mar 2001 16:39:07 GMT
From: "Etienne Laverdiere" <etienno@sympatico.ca>
Subject: Locking a file while a process on it
Message-Id: <LyJw6.487589$Pm2.7603994@news20.bellglobal.com>
Hi all, I have a simple question about locking a file while reading it.
For a web server, I have a seq.txt on a unix system where I read a integer
number, I take this number and add+1 to it and a write this number to this
file. This sequence is used by a web server to get a sequential number. The
problem is when there's too many "hits" at the same time, my sequencing
number can get lost because i use it with a long encrypting process that
take time... so when a first process is reading this number another one can
write another number... then I lose my sequence...
I need to lock this file when reading the number, when adding a + 1 to it
when writing down the new number to the file.
1- Is there a "locking handle" I could use associated to this file (a
semaphore?) because I need to use few functions before de-locking the file.
2- Does Unix manage well those locker on a file... making a good queue of
process?
Thanks for answering!
Etienne
Montreal
------------------------------
Date: Wed, 28 Mar 2001 21:58:49 +0300
From: "Aleksandr Guidrevitch" <pillgrim@mail.ru>
Subject: Re: LWP help
Message-Id: <99tc9k$2pdov$1@ID-82007.news.dfncis.de>
Gisle Aas <gisle@ActiveState.com> пишет в
сообщении:m37l1a61re.fsf@ActiveState.com...
> "Eric" <mail@ericmarques.net> writes:
>
> > Thanks
> > the thing with the limiting bytes is because im using a kind of proxy
server
> > for html files only and i dont want ppl trying to get large files and
> > slowing down the server
>
> Try to use something like:
>
> $ua->max_size(1024);
Or try to HEAD all documents firstly and look for Content-length header.
Or... perldoc LWP::UserAgent :
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new('GET', 'file://localhost/etc/motd');
$response = $ua->request($request, \&callback, 4096);
sub callback { my($data, $response, $protocol) = @_; .... }
=
The subroutine variant requires a reference to callback routine as the
second argument to request()
and it can also take an optional chuck size as the third argument.
This variant can be used to construct ``pipe-lined'' processing,
where processing of received chuncks can begin before the complete
data has arrived.
The callback function is called with 3 arguments:
the data received this time, a reference to the response object
and a reference to the protocol object.
The response object returned from request() will have empty content.
If the request fails, then the the callback routine is
called, and the response->content might not be empty.
=cut
So you will be able to dynamically allocate bandwidth :)))
Aleks
Origin: I like kids, but I don't think I could eat a whole one...
------------------------------
Date: 29 Mar 2001 09:20:11 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: LWP Timeout using get to get a webpage
Message-Id: <m18zloqypg.fsf@halfdome.holdit.com>
>>>>> "Andras" == Andras Malatinszky <andras@mortgagestats.com> writes:
Andras> Why do we need the HTTP::Cookies module here?
Just trying to milk it for all its worth.
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 28 Mar 2001 21:53:18 GMT
From: "Eric" <mail@ericmarques.net>
Subject: LWP
Message-Id: <i3tw6.22068$PF4.31834@news.iol.ie>
In LWP is it possible that i can use both of these
$response = $ua->request($request, \&callback, 1024);
$response = $ua->request($request, "/path/to/file");
like i want to to &callback and save to a file
Thanks, please help, its urgent
--
Eric Marques
mail@ericmarques.net
------------------------------
Date: Wed, 28 Mar 2001 22:12:50 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: LWP
Message-Id: <Cltw6.22072$PF4.31603@news.iol.ie>
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87k859lfkv.fsf@limey.hpcc.uh.edu...
> >> On Wed, 28 Mar 2001 21:53:18 GMT,
> >> "Eric" <mail@ericmarques.net> said:
>
> > Subject: LWP
>
> something a bit more descriptive there would help, e.g.
>
> Subject: how to callback and save-file at same time with LWP?
>
> > In LWP is it possible that i can use both of these
> > $response = $ua->request($request, \&callback, 1024);
> > $response = $ua->request($request, "/path/to/file");
>
> > like i want to to &callback and save to a file
>
> "to to &callback"? I think you want to both register a
> callback during the request *and* save the result to a
> file at the same time, yes?
>
> Why not make the callback write each chunk it gets to the
> file?
good idea
but one more think i just noticed
when i print to screen in callback like
print "Downloaded $downloaded KB of $total KB\n";
but then it outputs like this
Downloaded 1 KB of 233.9 KB
Downloaded 2 KB of 233.9 KB
Downloaded 3 KB of 233.9 KB
etc...
how do i make it replace the line rather than add a new line?
>
> > urgent
>
> will just make people ignore you on USENET.
Ill remember that in future
>
> hth
> t
> --
> Just reach into these holes. I use a carrot.
------------------------------
Date: 28 Mar 2001 16:00:00 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: LWP
Message-Id: <87k859lfkv.fsf@limey.hpcc.uh.edu>
>> On Wed, 28 Mar 2001 21:53:18 GMT,
>> "Eric" <mail@ericmarques.net> said:
> Subject: LWP
something a bit more descriptive there would help, e.g.
Subject: how to callback and save-file at same time with LWP?
> In LWP is it possible that i can use both of these
> $response = $ua->request($request, \&callback, 1024);
> $response = $ua->request($request, "/path/to/file");
> like i want to to &callback and save to a file
"to to &callback"? I think you want to both register a
callback during the request *and* save the result to a
file at the same time, yes?
Why not make the callback write each chunk it gets to the
file?
> urgent
will just make people ignore you on USENET.
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Thu, 29 Mar 2001 03:50:38 GMT
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: LWP
Message-Id: <m37l199qpi.fsf@ActiveState.com>
"Eric" <mail@ericmarques.net> writes:
> but one more think i just noticed
> when i print to screen in callback like
> print "Downloaded $downloaded KB of $total KB\n";
> but then it outputs like this
>
> Downloaded 1 KB of 233.9 KB
> Downloaded 2 KB of 233.9 KB
> Downloaded 3 KB of 233.9 KB
> etc...
>
> how do i make it replace the line rather than add a new line?
Take a look at how the lwp-download program does it.
--
Gisle Aas
------------------------------
Date: Thu, 29 Mar 2001 07:30:54 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: LWP::Simple::get don't get what I want.
Message-Id: <99uh69$ibc$1@newsy.ifm.liu.se>
I'm trying to write a program that parses som pages on the internet. The
pages is generated by some script I guess, because they all have the syntax:
http://www.site.com/prog?var=data.....
Now I want to parse the HTML so get the links and then follow the links and
so on, according to a sertain pattern. This isn't any problem really. I use
LWP::Simple get method.
I ran into some strangeness just this morning, trying to parse som data
thats been fetched by LWP::Simple::get. The source (HTML) does not look the
same as the source that Netscape or Internet Explorer gets.
So the question is:
What is the difference between calls to a http server using
LWP::Simple::get, compared to using Netscape or Explorer? How can I make my
program behave like Netscape or Explorer instead?
I don't think the problems is related to the fact that frames are not
supported on LWP::Simple::get, because there is no frames in the page. There
just seems like one line is missing in the HTML-source from
LWP::Simple::get. (One quite large (24 kb) line in the middle of the
source).
Why?
/jN
--
_______________________________
Jonas Nilsson
------------------------------
Date: 29 Mar 2001 01:05:23 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: LWP::Simple::get don't get what I want.
Message-Id: <99umrj$j6i$1@boomer.cs.utexas.edu>
In article <99uh69$ibc$1@newsy.ifm.liu.se>,
Jonas Nilsson <jonni@ifm.liu.se> wrote:
>I'm trying to write a program that parses som pages on the internet. The
>pages is generated by some script I guess, because they all have the syntax:
>http://www.site.com/prog?var=data.....
>
>Now I want to parse the HTML so get the links and then follow the links and
>so on, according to a sertain pattern. This isn't any problem really. I use
>LWP::Simple get method.
>
>I ran into some strangeness just this morning, trying to parse som data
>thats been fetched by LWP::Simple::get. The source (HTML) does not look the
>same as the source that Netscape or Internet Explorer gets.
When you send a request for a page via HTTP, you can send a
"User-Agent:" line to declare what browser you're using. The web
server is free to check this and send back a different page as its
whim.
If you want, you can send a different "User-Agent:" string in your HTTP
requests, and the web server will probably behave differently.
I'm not sure how you do that with LWP, but I'm pretty sure there's a
way.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: Wed, 28 Mar 2001 16:28:22 -0800
From: "SalsaCrazy" <salsacrazy@salsacrazy.com>
Subject: Mailing List Managers
Message-Id: <Bovw6.364$HL3.99742@news.pacbell.net>
I'm looking for the absolutely most feature filled mailing list manager on
the web. It appears that this would be: Subscribe Me Pro, but I was
wondering if anyone had other ideas? Am I correct in assuming that Subscribe
Me Pro (from Elite) is the best Mailing List Manager on the web (i.e. has
the MOST features).
Really, I'd just like something will the features of Egroups and Topica,
plus a few, that I can work with in house.
Ease of use is a MUST!
Any ideas? Thanks.
SC
------------------------------
Date: 28 Mar 2001 18:46:58 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Mailing List Managers
Message-Id: <877l19l7ul.fsf@limey.hpcc.uh.edu>
>> On Wed, 28 Mar 2001 16:28:22 -0800,
>> "SalsaCrazy" <salsacrazy@salsacrazy.com> said:
> I'm looking for the absolutely most feature filled
> mailing list manager on the web.
> ...
> Any ideas?
You could try posting to a relevant newsgroup.
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Fri, 30 Mar 2001 00:11:47 +0100
From: "Clive Gould" <clive@bromley.ac.uk>
Subject: NEWBIE: Help running Perl from Apache
Message-Id: <99v4pb$gdg$1@canard.ulcc.ac.uk>
Can anyone please help?
We have set up an experimental Apache web server and are trying to run Perl
scripts from it.
When we try to run a script IE5 just displays the text of the .pl file and
does not execute it
We suspect it is a problem with the pathing of the perl interpreter.
The trivial.pl script is as follows:
#!/usr/bin/perl
print "Hello Perly World\n";
Help greatly appreciated ... :-))
------------------------------
Date: 28 Mar 2001 13:33:03 -0800
From: David Wake <dwake@Turing.Stanford.EDU>
Subject: Re: Newbie: keep on matching until end of string
Message-Id: <9ny9tpefzk.fsf@Turing.Stanford.EDU>
"Graham Wood" <graham.wood@iona.com> writes:
> David Wake <dwake@Turing.Stanford.EDU> wrote in message
> news:9nk85ayrz3.fsf@Turing.Stanford.EDU...
> > Hi there,
> >
> > Suppose I have a string of the following form
> >
> > INTERESTING_SUBSTRING1 ... trash ... INTERESTING_SUBSTRING2 ... trash ...
> >
> > repeated an unknown number (n) of times.
> >
> > How do I do a match so that all the INTERESTING_SUBSTRINGs end up in $1,
> > $2, $3, ..., $2n?
>
> use g for "global"
> (@results)=($string_you_search_in =~ m/INTERESTING_SUBSTRING/g);
> will copy the first occurrence of INTERESTING_SUBSTRING into $results[0],
> the second into $results[1], the third into $results[2] and so on.
Many thanks for replies. What do I do if the string has a
non-repeated introduction? Say, for example, that I want to search
for the string "START" and then copy every subsequent word into an array.
Thanks for helping ignorant newbie,
David
------------------------------
Date: 28 Mar 2001 17:25:02 -0800
From: David Wake <dwake@Turing.Stanford.EDU>
Subject: Re: Newbie: keep on matching until end of string
Message-Id: <9npuf1e58x.fsf@Turing.Stanford.EDU>
Brad Baxter <bmb@ginger.libs.uga.edu> writes:
> On 28 Mar 2001, David Wake wrote:
> > Many thanks for replies. What do I do if the string has a
> > non-repeated introduction? Say, for example, that I want to search
> > for the string "START" and then copy every subsequent word into an array.
> >
> > Thanks for helping ignorant newbie,
>
> Do you have an actual string that you want to parse this way? It sounds
> to me like you've changed the subject. What have you tried?
>
I guess my initial query was a bit too general -- apologies. I am
actually trying to parse an HTML page. I want to look for a string
(call is "START") and after that search for and store a pattern of
regexps which keeps repeating.
So you could imagine the string having the following structure:
[trash]START[trash](INTERESTING_SUBSTRING[trash])
where the part in parentheses is repeated indefinitely.
I want to store all the INTERESTING_SUBSTRINGs
Thanks again,
David
------------------------------
Date: 28 Mar 2001 17:28:47 -0800
From: David Wake <dwake@Turing.Stanford.EDU>
Subject: Re: Newbie: keep on matching until end of string
Message-Id: <9nk859e52o.fsf@Turing.Stanford.EDU>
"Stephen Gray" <stephen.gray@internode.on.net> writes:
> > > David Wake <dwake@Turing.Stanford.EDU> wrote in message
>
> > > use g for "global"
> > > (@results)=($string_you_search_in =~ m/INTERESTING_SUBSTRING/g);
> > > will copy the first occurrence of INTERESTING_SUBSTRING into
> $results[0],
> > > the second into $results[1], the third into $results[2] and so on.
> >
> > Many thanks for replies. What do I do if the string has a
> > non-repeated introduction? Say, for example, that I want to search
> > for the string "START" and then copy every subsequent word into an array.
>
> You could just split at the introduction, eg:
>
> $string = "kslzfjd kfhdfh START lksj sj sdjf sfdfj";
> ($loseit, $string) = split(/START/, $string);
>
> Then if the string contains "word delimiters" (eg spaces) you can use
> split() again (@result = split(" ", $string;) or use the above method if you
> need to do something more complicated.
>
> Steve
Thanks, Steve, you have answered my question. Thanks to everyone who
replied.
David
------------------------------
Date: 29 Mar 2001 09:09:44 +0200
From: Walter Hafner <hafner-usenet@ze.tu-muenchen.de>
Subject: Re: Newbie: keep on matching until end of string
Message-Id: <srjlmppuk3r.fsf@w3proj1.ze.tu-muenchen.de>
"John Lin" <johnlin@chttl.com.tw> writes:
> I wonder can we use just regular expressions to do it? For example,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oh, no. Not again.
SCNR. :-)
-Walter
------------------------------
Date: Wed, 28 Mar 2001 20:04:48 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Newbie: keep on matching until end of string
Message-Id: <Pine.A41.4.21.0103282002220.13834-100000@ginger.libs.uga.edu>
On 28 Mar 2001, David Wake wrote:
> Many thanks for replies. What do I do if the string has a
> non-repeated introduction? Say, for example, that I want to search
> for the string "START" and then copy every subsequent word into an array.
>
> Thanks for helping ignorant newbie,
Do you have an actual string that you want to parse this way? It sounds
to me like you've changed the subject. What have you tried?
Just trying to pin down your exact problem. :-)
Brad
------------------------------
Date: Thu, 29 Mar 2001 02:21:22 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Password: logfile
Message-Id: <slrn9c5712.1k7.efflandt@efflandt.xnet.com>
On Tue, 27 Mar 2001 19:30:12 -0000, JWO <Jan-Willem@Oudendal.com> wrote:
>Hi:
>
>Is it possible when using ".htaccess/.htpasswd" to keep track of the ones
>who locked in? (in logfile the time and date will be stored)
Not sure what you mean by "locked in" but you can certainly log the
$ENV{REMOTE_USER} from CGI called as SSI or CGI run directly in a zone
protected with the same credentials (AuthName, etc.).
But you posted to the wrong newsgroup. There is no Perl question here.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 584
**************************************