[28336] in Perl-Users-Digest
Perl-Users Digest, Issue: 9700 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 7 18:05:40 2006
Date: Thu, 7 Sep 2006 15:05:06 -0700 (PDT)
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, 7 Sep 2006 Volume: 10 Number: 9700
Today's topics:
Re: A Perl web server: reading a client's request <hjp-usenet2@hjp.at>
Re: CPAN 'shell' interface stopped working? <syscjm@gwu.edu>
Help using a proxy <Shani718@gmail.com>
Re: Help using a proxy <glex_no-spam@qwest-spam-no.invalid>
Re: IO::Socket server <scottalorda_NOSPAM@libello.com>
Non-uniform split thisismyidentity@gmail.com
Re: Non-uniform split <simon.chao@fmr.com>
Re: Non-uniform split <thepoet_nospam@arcor.de>
Re: Non-uniform split <nospam-abuse@ilyaz.org>
Re: Non-uniform split <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: Non-uniform split <tzz@lifelogs.com>
Re: Pattern Matching and skipping <mattjones@hotmail.co.uk>
Re: Pattern Matching and skipping <tadmc@augustmail.com>
Re: Pattern Matching and skipping <David.Squire@no.spam.from.here.au>
Re: Pattern Matching and skipping <mattjones@hotmail.co.uk>
Re: Pattern Matching and skipping <David.Squire@no.spam.from.here.au>
Re: Pattern Matching and skipping <tadmc@augustmail.com>
Re: TLS script <thepoet_nospam@arcor.de>
Re: Ultimate programmer's reference - Quickref.org laun beartiger@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 7 Sep 2006 20:32:44 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: A Perl web server: reading a client's request
Message-Id: <slrneg0peh.ock.hjp-usenet2@yoyo.hjp.at>
On 2006-09-07 09:33, saridski@gmail.com <saridski@gmail.com> wrote:
> I have been traversing the groups looking for an answer to a problem
> that i am having. I have written a web server in Perl. I want to be
> able to read clients' requests from the beginning of the request (GET
> / HTTP/1.0) all the way to the end of the request (after the header if
> a GET or after the payload if a POST). Currently, I can read the
> request till the end but the browser (and the server) hangs at the end
> of the request, as there is no end of request marker.
There is. You are just not checking for it. Have a look at the last line
before the connection "hangs" and then read RFC 2616 and/or RFC 1945
again.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: Thu, 07 Sep 2006 14:13:15 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: CPAN 'shell' interface stopped working?
Message-Id: <12g0o9rtjotpu78@corp.supernews.com>
David Squire wrote:
> Dave Hammond wrote:
>
>> Christian Winter wrote:
>
>
>>> perl -MCPAN -e "shell"
>>> should still work fine.
>>
>>
>> Oops! Thanks, guys!! Funny, I must have typed that line a thousand
>> times in the past 10 years, and I can't recall ever typing "-m" instead
>> of "-M". Maybe I should just
>>
>> alias cpan='perl -MCPAN -e "shell"'
>
>
> ... why not try typing 'cpan'? It's almost certainly already there :)
>
>
> DS
Damn, he's not joking. I never heard about this before.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 7 Sep 2006 14:26:39 -0700
From: "Shan" <Shani718@gmail.com>
Subject: Help using a proxy
Message-Id: <1157664399.784788.195600@p79g2000cwp.googlegroups.com>
I use Privoxy an tor. The settings for my firefox web browser to
correctly use the proxy are as follows:
HTTP Proxy: localhost Port: 8118
SLS Proxy: localhost Port: 8118
FTP Proxy: localhost Port: 8118
Gopher Proxy: localhost Port: 8118
I want to know how I can use a proxy with perl
my $ua = LWP::UserAgent->new;
$ua->timeout(20);
$ua->env_proxy; # I dont know what to modify so that proxy works.
my $response = $ua->get('http://www.helpme.com');
if ($response->is_success)
{
my $html=$response->content;
}
I would appreciate it if you could help me use a proxy successfully
with perl. Thank you in advance.
------------------------------
Date: Thu, 07 Sep 2006 16:52:22 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Help using a proxy
Message-Id: <450093a1$0$10297$815e3792@news.qwest.net>
Shan wrote:
> I use Privoxy an tor. The settings for my firefox web browser to
> correctly use the proxy are as follows:
>
> HTTP Proxy: localhost Port: 8118
> SLS Proxy: localhost Port: 8118
> FTP Proxy: localhost Port: 8118
> Gopher Proxy: localhost Port: 8118
>
>
> I want to know how I can use a proxy with perl
Actually, it'd be how to have LWP::UserAgent use a proxy.
>
> my $ua = LWP::UserAgent->new;
> $ua->timeout(20);
> $ua->env_proxy; # I dont know what to modify so that proxy works.
> my $response = $ua->get('http://www.helpme.com');
> if ($response->is_success)
> {
> my $html=$response->content;
> }
>
>
> I would appreciate it if you could help me use a proxy successfully
> with perl. Thank you in advance.
>
It seems to be well documented.
From perldoc LWP::UserAgent:
$ua->env_proxy
Load proxy settings from *_proxy environment variables. You might
specify proxies like this (sh-syntax):
[...]
or from perldoc lwpcook:
You should initialize your proxy setting before you start sending
requests:
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->env_proxy; # initialize from environment variables
# or
$ua->proxy[...]
It's up to you. You may use your environment variables, by calling
env_proxy(), or set what you need using proxy().
To include the port, add it to the end, separated with a ':". e.g.
'localhost:8118'.
------------------------------
Date: Thu, 07 Sep 2006 21:26:31 +0200
From: =?ISO-8859-1?Q?S=E9bastien_Cottalorda?= <scottalorda_NOSPAM@libello.com>
Subject: Re: IO::Socket server
Message-Id: <45007269$0$11943$636a55ce@news.free.fr>
Jim Gibson a écrit :
> In article <1157637206.230087.100280@m79g2000cwm.googlegroups.com>,
> deadpickle <deadpickle@gmail.com> wrote:
>
>
>>Sébastien Cottalorda wrote:
>>
>>>Hi,
>>>
>>>Here is a full, tested, couple of program that work on an html file.
>>>
>>>client_side.pl
>>>==============
>>>#!/usr/bin/perl -w
>>>#
>
>
> [snip]
>
> for(;;) {
>
>
>>>while (my $line=<$sock>){
>>> chomp($line);
>
> [snip]
>
>>>}
>
>
> sleep(5);
> }
>
>
>>>exit;
>>>
>>
>>Sorry to keep bothering you like this but I am very new to perl. The
>>program works great. I want the client script to sleep for 5 seconds
>>then run and get the file again. I tried entering the sleep value at
>>the end of the script and removing the exit but all that happens is
>>that the client sleeps for 5 then closes.
>>
>
>
> Put another loop around the existing while loop as indicated above. The
> above will run forever until killed. Modify it as needed.
>
Hi,
It won't work because server side close the socket when he finish.
Client need to re-open the entire socket every 5 sec, so the program
becomes:
while (1){
if ! open socket ?
print warning
else
if ! open fileout ?
print warning
else
send FIL|filename
CONNECT: while reception{
blah blah
}
close fileout
endif
close socket
endif
sleep 5
}
so .........
client_side.pl
==============
#!/usr/bin/perl -w
#
#
use strict;
use IO::Socket;
$|=1;
my $host = shift || 'localhost';
my $port = shift || 7890;
my $sock;
#--------------/ Socket opened \----------------
my $filename=.....; # the file to be sent by the server side
my $fileout=$filename."_RECEIVED";
my @elem=();
my $all_received;
while (1){
$sock = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp');
unless (defined $sock){
print "Unable to find server: $!";
}
else {
print $sock "FILE|$filename\n";
@elem=();
undef $all_received;
unless (open (FH_RECEPTION, ">", $fileout)){
print "Unable to create $fileout $!";
}
else {
CONNECT: while (my $line=<$sock>){
chomp($line);
#
# Remove the next line in production
#
print "RECEIVED>$line\n";
@elem = split /\|/, $line;
if ($line=~/^FIL\|/){
$elem[1]='' unless (defined $elem[1]);
print FH_RECEPTION $elem[1]."\n";
$all_received=0;
}
elsif ($line=~/^EOT\|/){
print "Normal End of Transmission received\n";
$all_received=1;
last CONNECT;
}
elsif ($line=~/^NACK\|/){
print "ERROR: $elem[1]\n";
last CONNECT;
}
else {
print "Do not understand|$line\n";
last CONNECT;
}
}
close(FH_RECEPTION);
}
close($sock);
if ((defined $all_received) and ($all_received==1)){
print "Everything has been received in $fileout\n";
}
elsif (defined $all_received) {
print "some part of the file has been received in $fileout\n";
}
}
sleep 5;
}
exit;
BECAREFUL, this code is not tested.
Sebastien
------------------------------
Date: 7 Sep 2006 11:56:26 -0700
From: thisismyidentity@gmail.com
Subject: Non-uniform split
Message-Id: <1157655386.136229.201660@h48g2000cwc.googlegroups.com>
Hi all,
I am writing a Perl script that should parse each line of a file (which
unfortunately I cant modify) and split the line. The main problem is
that every line (nearly 10000 lines) of the file is not uniform. So
there doesnt seem to be a pattern or a delimiter on which I can simply
split the line and could do it in a loop over all lines :(.
Here is an example:
========================
A B C D E
d32 ab ae99 WB 89
d33 cd e787 WC 78
d34 ef WD
d35 gh ancjd WT 100
d36 ij WP
.
.
========================
My main intention is to extract the values in Column A, B,C..into an
array but since in some lines some values under a column may not be
present..I am unable to have a single regex on which i can split all
lines in a loop. I tried the (obvious) \s+ regex for splitting but
since the columns that r empty have spaces, I get different results for
a particular column on different lines. I am especially interested in
two columns for which it is guaranteed that each line will be non-empty
(like A,B,D) but coz of other empty columns cant get them on a
particular index of the array which is returned by split().
Please give suggestions for following:
What regex could I use which wud solve my problem?
Is there any other way apart from split by which i cud achieve this
(assuming that there is no single regex to spit on) ?
Any possible way (as far as I can loop..since no of lines is huge)
Thanks.
Greg
------------------------------
Date: 7 Sep 2006 12:04:32 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Non-uniform split
Message-Id: <1157655872.527400.274740@i3g2000cwc.googlegroups.com>
thisismyident...@gmail.com wrote:
> Hi all,
> I am writing a Perl script that should parse each line of a file (which
> unfortunately I cant modify) and split the line. The main problem is
> that every line (nearly 10000 lines) of the file is not uniform. So
> there doesnt seem to be a pattern or a delimiter on which I can simply
> split the line and could do it in a loop over all lines :(.
> Here is an example:
> ========================
> A B C D E
> d32 ab ae99 WB 89
> d33 cd e787 WC 78
> d34 ef WD
> d35 gh ancjd WT 100
> d36 ij WP
> .
> .
> ========================
>
> My main intention is to extract the values in Column A, B,C..into an
> array but since in some lines some values under a column may not be
> present..I am unable to have a single regex on which i can split all
> lines in a loop. I tried the (obvious) \s+ regex for splitting but
> since the columns that r empty have spaces, I get different results for
> a particular column on different lines. I am especially interested in
> two columns for which it is guaranteed that each line will be non-empty
> (like A,B,D) but coz of other empty columns cant get them on a
> particular index of the array which is returned by split().
>
> Please give suggestions for following:
>
> What regex could I use which wud solve my problem?
>
> Is there any other way apart from split by which i cud achieve this
> (assuming that there is no single regex to spit on) ?
>
> Any possible way (as far as I can loop..since no of lines is huge)
If we look at the row where the value of Column A is 'd34', how do you
know that 'WD' is the value of column D versus column C (assuming that
it actually is the value of column D)? if this were tab delimited, is
there an empty string for the value of column C? perhaps this is fixed
width?
------------------------------
Date: Thu, 07 Sep 2006 21:32:01 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Non-uniform split
Message-Id: <450073a8$0$17405$9b4e6d93@newsspool2.arcor-online.net>
thisismyidentity@gmail.com wrote:
> Hi all,
> I am writing a Perl script that should parse each line of a file (which
> unfortunately I cant modify) and split the line. The main problem is
> that every line (nearly 10000 lines) of the file is not uniform. So
> there doesnt seem to be a pattern or a delimiter on which I can simply
> split the line and could do it in a loop over all lines :(.
> Here is an example:
> ========================
> A B C D E
> d32 ab ae99 WB 89
> d33 cd e787 WC 78
> d34 ef WD
> d35 gh ancjd WT 100
> d36 ij WP
> .
> .
> ========================
>
> My main intention is to extract the values in Column A, B,C..into an
> array but since in some lines some values under a column may not be
> present..I am unable to have a single regex on which i can split all
> lines in a loop. I tried the (obvious) \s+ regex for splitting but
> since the columns that r empty have spaces, I get different results for
> a particular column on different lines. I am especially interested in
> two columns for which it is guaranteed that each line will be non-empty
> (like A,B,D) but coz of other empty columns cant get them on a
> particular index of the array which is returned by split().
I'm just assuming now that column D is always "W" followed by
another capital letter, for my suggestion to work you need some
unique criteria for column D that lets you anchor your regex there:
my @fields = $line =~ /(\S+)\s+(\S+)\s+(\S*)\s*(W[A-Z])\s*(\S*)$/;
The first two non-whitespace groups should be self explanatory,
the third group (and the following whitespaces) might be absent
and therefore match an empty spot (asterisk). Column D is always
present, so we have an anchor here, and the following whitespaces
and fields may again match empty strings up to the end of the line.
HTH
-Chris
------------------------------
Date: Thu, 7 Sep 2006 19:49:13 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Non-uniform split
Message-Id: <edpt3p$28b5$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Christian Winter
<thepoet_nospam@arcor.de>], who wrote in article <450073a8$0$17405$9b4e6d93@newsspool2.arcor-online.net>:
> thisismyidentity@gmail.com wrote:
> > Here is an example:
> > ========================
> > A B C D E
> > d32 ab ae99 WB 89
> > d33 cd e787 WC 78
> > d34 ef WD
> > d35 gh ancjd WT 100
> > d36 ij WP
This looks like width-encoded: all fields occupy certain columns. Use
unpack "A[number] ..." to break it into parts, then strip extra whitespace.
If, e.g., the boundary between D and E is not column-based, but other
boundaries are, do the same, but extract "D + E" pair first; THEN use
regexp approach to split D and E.
Hope this helps,
Ilya
------------------------------
Date: Thu, 07 Sep 2006 20:19:03 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: Non-uniform split
Message-Id: <X8%Lg.16392$Qf.834@newsread2.news.pas.earthlink.net>
On 09/07/2006 01:56 PM, thisismyidentity@gmail.com wrote:
> Hi all,
> I am writing a Perl script that should parse each line of a file (which
> unfortunately I cant modify) and split the line. The main problem is
> that every line (nearly 10000 lines) of the file is not uniform. So
> there doesnt seem to be a pattern or a delimiter on which I can simply
> split the line and could do it in a loop over all lines :(.
> Here is an example:
> ========================
> A B C D E
> d32 ab ae99 WB 89
> d33 cd e787 WC 78
> d34 ef WD
> d35 gh ancjd WT 100
> d36 ij WP
> ..
> ..
> ========================
>
> My main intention is to extract the values in Column A, B,C..into an
> array but since in some lines some values under a column may not be
> present..I am unable to have a single regex on which i can split all
> lines in a loop. I tried the (obvious) \s+ regex for splitting but
> since the columns that r empty have spaces, I get different results for
> a particular column on different lines. I am especially interested in
> two columns for which it is guaranteed that each line will be non-empty
> (like A,B,D) but coz of other empty columns cant get them on a
> particular index of the array which is returned by split().
>
> Please give suggestions for following:
>
> What regex could I use which wud solve my problem?
>
> Is there any other way apart from split by which i cud achieve this
> (assuming that there is no single regex to spit on) ?
>
> Any possible way (as far as I can loop..since no of lines is huge)
>
> Thanks.
> Greg
>
You can either use unpack() to extract ranges of bytes from
the string, or you can use a regex that uses character
quantifiers {}, e.g.
my @fields = unpack('A6 A6 A8 A4 A*', $string);
OR
my @fields =~ m/^(.{6})(.{6})(.{8})(.{4})(.*)/;
WARNING: UNTESTED CODE
------------------------------
Date: Thu, 07 Sep 2006 16:44:27 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Non-uniform split
Message-Id: <g69r6ynmmok.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 7 Sep 2006, thisismyidentity@gmail.com wrote:
> Here is an example:
> ========================
> A B C D E
> d32 ab ae99 WB 89
> d33 cd e787 WC 78
> d34 ef WD
> d35 gh ancjd WT 100
> d36 ij WP
> .
> .
> ========================
> What regex could I use which wud solve my problem?
>
> Is there any other way apart from split by which i cud achieve this
> (assuming that there is no single regex to spit on) ?
>
> Any possible way (as far as I can loop..since no of lines is huge)
10K lines is not big at all. Anyhow.
Your essential problem is that you don't have consistent data. How
can Perl or anyone else know that lines 3 and 5 in your data are
missing the C column, for example? I'm guessing they don't have the C
column because "WD" and "WP" look like they belong in the D column,
and others have guessed that also, but it doesn't mean we're right.
If you can "anchor" WD and WP for us, promising that anything that
begins with W and has just two uppercase letters is in the D column,
the problem is easy to solve.
Finally, are there tab characters in the data? There aren't any in
your example, but it's possible they are your delimiters and didn't
come through the Usenet post.
Ted
------------------------------
Date: 7 Sep 2006 11:12:44 -0700
From: "MattJ83" <mattjones@hotmail.co.uk>
Subject: Re: Pattern Matching and skipping
Message-Id: <1157652764.619443.122610@m73g2000cwd.googlegroups.com>
Ok guys,
Im not brushing your info to one side...but my plan was to get the code
running and then try and smarten it up....At the moment im just trying
to write something very basic that does the job.....which i almost
have.
I have a time constraint, so wanted to write some code to get the
information into the database and then i can start playing with the
code...
If theres just no way of oing what I would like with this piece of code
inparticular then i obviously have to go back to the drawing board and
look at it again......i just thought there should be some kind of way
to 'skip' over a /pattern/ to allow the script to keep running...
------------------------------
Date: Thu, 7 Sep 2006 13:53:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Pattern Matching and skipping
Message-Id: <slrneg0qkv.eo9.tadmc@magna.augustmail.com>
MattJ83 <mattjones@hotmail.co.uk> wrote:
> i just thought there should be some kind of way
> to 'skip' over a /pattern/ to allow the script to keep running...
There is a way to do that, and it has already been shown to you.
If it is not working, post another short and complete program that
we can run that "doesn't work", and we will help you fix it.
Have you seent the Posting Guidelines that are posted here frequently?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 07 Sep 2006 20:08:05 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Pattern Matching and skipping
Message-Id: <edpqml$2vi$1@gemini.csx.cam.ac.uk>
MattJ83 wrote:
> Ok guys,
> Im not brushing your info to one side...but my plan was to get the code
> running and then try and smarten it up....At the moment im just trying
> to write something very basic that does the job.....which i almost
> have.
> I have a time constraint, so wanted to write some code to get the
> information into the database and then i can start playing with the
> code...
>
> If theres just no way of oing what I would like with this piece of code
> inparticular then i obviously have to go back to the drawing board and
> look at it again......i just thought there should be some kind of way
> to 'skip' over a /pattern/ to allow the script to keep running...
>
Sure there is:
if (/pattern/) {
# do whatever you want when there is a match
}
else {
# do what is appropriate when there isn't a match, which could be as
simple as "next;" to go on to the next loop iteration.
}
If you don't want to do anything when there is no match, you could just have
next if !/pattern/;
as the first line of your loop.
You need to be willing to actually understand what you are doing though.
This is a group for helping people with the Perl programming. Various
people here have been trying to nudge you towards a solution to your
problem, and towards better Perl programming practice in general.
I learn something every day from participating here.
On the other hand, perhaps you are looking for http://jobs.perl.org/
DS
------------------------------
Date: 7 Sep 2006 12:14:27 -0700
From: "MattJ83" <mattjones@hotmail.co.uk>
Subject: Re: Pattern Matching and skipping
Message-Id: <1157656467.657496.77300@d34g2000cwd.googlegroups.com>
> There is a way to do that, and it has already been shown to you.
Tad, is this the If, elsif statements ? I gave it a try but it didn't
seem to like it - I don't think i was putting in the right stuff...
while (<LOG>) {
if (/updates table/) {
# do stuff <--- i was putting similar code to what i had
already done
}
elsif (/elapsed/) {
# do other stuff
}
Eg -
while (<LOG>) {
if (/updates table/) { #if updates table
in file
chomp; #take it out
my @lines = ( $info); ; #place it in my
@lines and in variable $info
foreach my $info (@lines) { #loop my $info in each
file
}
elsif (/elapsed/) {
chomp;
my @lines = ($_);
foreach my $elapsed1 (@lines) {
}
I thought i still needed 'my $info' and my $elapsed1 as i have the
INSERT statement call these variables to insert them into the database.
and the foreach loops it so that it looks at all of the logs doesn't
it?
This is how i read it.....but i know im probably wrong - i have studied
programming and know what its supposed to do in theory but in practice
im a bit rubbish!
------------------------------
Date: Thu, 07 Sep 2006 20:23:02 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Pattern Matching and skipping
Message-Id: <edprim$4tu$1@gemini.csx.cam.ac.uk>
MattJ83 wrote:
>
> Eg -
> while (<LOG>) {
> if (/updates table/) { #if updates table
> in file
Not in the file, in the *line* from log currently being processed (which
is implicitly stored in $_)
> chomp; #take it out
This doesn't take anything out, it just "chomps" $_, the current line,
i.e. it removes any end of line character
> my @lines = ( $info); ; #place it in my
> @lines and in variable $info
One: where does $info get declared and get a value? Two: why are you
placing this single scalar value in an array @lines? @lines is now an
array with a single element, $lines[0], which has the same value as $info.
> foreach my $info (@lines) { #loop my $info in each
Why are you looping over an array that has one and only one element?
> file
> }
Why are you ending the loop here? This (unnecessary) loop has no content.
> elsif (/elapsed/) {
> chomp;
> my @lines = ($_);
> foreach my $elapsed1 (@lines) {
> }
>
>
> I thought i still needed 'my $info' and my $elapsed1 as i have the
> INSERT statement call these variables to insert them into the database.
> and the foreach loops it so that it looks at all of the logs doesn't
> it?
>
> This is how i read it.....but i know im probably wrong - i have studied
> programming and know what its supposed to do in theory but in practice
> im a bit rubbish!
>
------------------------------
Date: Thu, 7 Sep 2006 16:55:49 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Pattern Matching and skipping
Message-Id: <slrneg15b5.f1e.tadmc@magna.augustmail.com>
MattJ83 <mattjones@hotmail.co.uk> wrote:
>> There is a way to do that, and it has already been shown to you.
>
> Tad, is this the If, elsif statements ?
Yes.
> I gave it a try but it didn't
> seem to like it
Then you didn't do it right.
I thought I asked you for a short and complete program that we
can run that demonstrates that it "didn't like it"?
Have you seen the Posting Guidelines that are posted here frequently?
(that is NOT a rhetorical question.)
> while (<LOG>) {
> if (/updates table/) {
> # do stuff <--- i was putting similar code to what i had
> already done
> }
> elsif (/elapsed/) {
> # do other stuff
> }
Here is a short and complete program that *you* can run that
illustrates that it "likes it" just fine...
------------------------
#!/usr/bin/perl
use warnings;
use strict;
while (<DATA>) {
if (/updates table/) {
print "MATCHED: $_";
}
elsif (/elapsed/) {
print "MATCHED: $_";
}
else {
print "NO MATCH: $_";
}
}
__DATA__
nothing interesting here
this has updates table in it
nothing here either
now we have elapsed
now we don't
------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 07 Sep 2006 20:49:28 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: TLS script
Message-Id: <450069ae$0$18479$9b4e6d93@newsspool3.arcor-online.net>
christophergraber@gmail.com wrote:
> I don't think Net::Lite::FTP would allow me to determine modification
> time on a TLS FTP site. I have only used it to push/pull files to a TLS
> site.
It should as well, although you will have to invoke MDTM
directly via the "command" method, e.g.
my $line = $ftps->command("MDTM $filename");
if( $line )
if( $line =~ /2\d\d\s+(\d+)) )
{
my $timestamp = $1;
print "Timestamp for $filename: $timestamp\n";
} else {
print "Error retrieving timestamp for $filename: $line";
}
} else {
die( "Something went seriously wrong!" );
}
HTH
-Chris
------------------------------
Date: 7 Sep 2006 11:12:29 -0700
From: beartiger@gmail.com
Subject: Re: Ultimate programmer's reference - Quickref.org launches
Message-Id: <1157652749.720219.120950@m73g2000cwd.googlegroups.com>
Matt, what does your critique of this person's website design and use
of others' information have to do with the language called Perl, and,
if nothing, why do you feel you are personally exempted from posting
on-topic?
TIA,
J
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 9700
***************************************