[22921] in Perl-Users-Digest
Perl-Users Digest, Issue: 5141 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 26 14:10:44 2003
Date: Thu, 26 Jun 2003 11:10:14 -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, 26 Jun 2003 Volume: 10 Number: 5141
Today's topics:
Re: regexp help (Tad McClellan)
Re: Rotating Snips of HTML <usenet@dwall.fastmail.fm>
Re: search for messages in large files <james.mctiernan@rcn.com>
Re: search for messages in large files <james.mctiernan@rcn.com>
Re: search for messages in large files (Sam Holden)
Re: search for messages in large files (Tad McClellan)
Re: search for messages in large files <james.mctiernan@rcn.com>
Re: search for messages in large files <james.mctiernan@rcn.com>
Re: soap::lite hellp needed with sms <mike_solomon@lineone.net>
why this doesn't work (tm)? :) <mpapec@yahoo.com>
Re: why this doesn't work (tm)? :) <jboes@nexcerpt.com>
Re: Write to a filehandle and to STDOUT without double (Tad McClellan)
Re: Write to a filehandle and to STDOUT without double <nobull@mail.com>
Re: Write to a filehandle and to STDOUT without double <mpapec@yahoo.com>
Re: Write to a filehandle and to STDOUT without double <mpapec@yahoo.com>
Re: Write to a filehandle and to STDOUT without double <tzz@lifelogs.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Jun 2003 09:20:51 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regexp help
Message-Id: <slrnbfm0a3.6sf.tadmc@magna.augustmail.com>
sjaak <sjaak538@domein.nl> wrote:
> Can anybody set me a little on the wright direction how to replace
^^^^^^
> route.htm"></a> to generate
> route.htm">route</a>
Are you sure you don't mean "flight plan" rather than "route"?
(Sorry :-)
> Subject: regexp help
The correct solution is not to use regular expressions at all!
You should use a module that understands HTML for processing HTML.
> so
> .htm"></a>
> .html"></a>
>
> must replaced to
>
> .htm">route</a>
> .html">route</a>
s#\.htm(l?)"></a>#.htm$1">route</a>#;
But your sample data does not match up with your earlier word
description, so maybe you really wanted:
s#([^"]+)\.htm(l?)"></a>#$1.htm$2">$1</a>#;
> I don't know where to begin this with regexp.
That's OK, because you should not be using regexes for this task. :-)
The above will all break with legal HTML such as:
"foo.htm"></A>
'foo.htm'></a>
"foo.htm"> </a>
"foo.htm">
</a>
"foo.htm" ></a>
"foo.htm"></a >
"foo.htm"></a
>
<!-- "foo.htm"></a> -->
> To avoid futher questions in this does anyone knows a good howto with many
> examples.
"Mastering Regular Expressions" 2nd edition from O'Reilly
> Like this problem is a combination of regexp's
No, this problem involves _parsing_.
A type of parsing impossible (or just really really hard) with
simple pattern matching.
> all so it's heard to do.
Use an HTML module, and you won't have to bother with regexes.
> I just need them ones a year
That's OK, because that once has not happened yet, since you
don't need them now either. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 26 Jun 2003 15:20:58 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Rotating Snips of HTML
Message-Id: <Xns93A673739A5A8dkwwashere@216.168.3.30>
Buffalo Static <jsc1971@hotmail.com> wrote:
> Does anyone know of a CGI that can rotate snippets of HTML coded
> text from the same source page (or I guess generated in the code
> itself)....ie. display text 1 from page.html, change to text 2
> from page.html and so on?
It's not clear to me exactly what you mean. At a guess, you might take
a look at
perldoc -q "random line"
and see if it gives you any ideas. Is this really CGI, or a server-
side include?
Otherwise, more details would allow someone to make better suggestions.
------------------------------
Date: Thu, 26 Jun 2003 08:08:02 -0700
From: "Jim McTiernan" <james.mctiernan@rcn.com>
Subject: Re: search for messages in large files
Message-Id: <bdf2ct$c61$1@bob.news.rcn.net>
"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnbfktdc.ng4.sholden@flexal.cs.usyd.edu.au...
> On Wed, 25 Jun 2003 20:59:07 -0700, Jman <james.mctiernan@rcn.com> wrote:
> > Actually, as I completely understand the contents of the file, and you
do
> > not,
> > I am trying to explain what the contents of the file looks like, and
have
> > not
> > changed my mind on anything. I was attempting to show how I have
> > tried to handle my task, like you requested. I thought that it would be
> > better to remove the control characters first, maybe this isn't
necessary.
> > The "MSG" data that I mentioned in my original posting are the second to
> > last words on the first line of each message, e.g. TIME, SLC MDIIMON,
etc...
>
> Of course, all the readers are psychic and knew that when you said
"actually
> MSG[1-50]", you didn't mean MSG1, MSG2, ..., MSG50 but of course meant
> TIME, SLC, MDIIMON, etc...
>
> How foolish of those of us who can't read minds.
I didn't think that it was that hard to understand.
I attempted to recreate the format manually in my first posting.
Sorry this bothered you.
I am thru with this thread.
>
> --
> Sam Holden
>
------------------------------
Date: Thu, 26 Jun 2003 08:14:23 -0700
From: "Jim McTiernan" <james.mctiernan@rcn.com>
Subject: Re: search for messages in large files
Message-Id: <bdf2op$d47$1@bob.news.rcn.net>
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrnbfkvs0.1hq.mgjv@verbruggen.comdyn.com.au...
> [Don't top post]
>
>
> On Wed, 25 Jun 2003 20:59:07 -0700,
> Jman <james.mctiernan@rcn.com> wrote:
> > Actually, as I completely understand the contents of the file, and you
do
> > not,
> > I am trying to explain what the contents of the file looks like, and
have
> > not
> > changed my mind on anything. I was attempting to show how I have
> > tried to handle my task, like you requested. I thought that it would be
> > better to remove the control characters first, maybe this isn't
necessary.
> > The "MSG" data that I mentioned in my original posting are the second to
> > last words on the first line of each message, e.g. TIME, SLC MDIIMON,
etc...
> > Let's say I want to retrieve all of the MAINT messages from 03-06-13,
> > what is the best way to do it. Using my style I end up creating large
> > files,
>
> How are we supposed to know that? You initially said something totally
> different from what is in the actual data that you finally posted.
> Your data does NOT contain any MSG followed by a number between 1 and
> 50 at all, but that is what you originally stated. I provided some
> code to find that.
>
> Then you post actual data that looks completely different, and I again
> do my best to interpret what it is you mean from your half-arsed
> specification (including modifying the data according to your
> instructions), and again provide some code for you to start with.
You seem to be a little thick, you can't even see that I was using
substitution in the original post for the actual data. In retrospect
I would not do that again, it leads to a whole lot of complaining.
>
> All you do is whinge that you're not getting a complete solution to
> your underspacified problem, instead of trying to clarify the
> confusion that you, yourself, created in the first place.
Where did I whinge that I am not getting a complete solution?
I attempted to adjust my explanation to your crankiness.
>
> > against which I run another script against, creating another large file,
> > and running another script against it, until I finally get the data I
want.
> > I would like to be able to run one script, looking for any day of the
month
> > with a particular MSG.
> > If you can offer anything, thanks, if not thanks anyway
> > I am doing my best to explain
>
> What was wrong with the suggestions I posted already? if you answer,
> please realise that i will not be reading it anymore.
The only thing wrong is your annoying attitude, goodbye.
>
> *plonk*
>
> [SNIP of TOFU]
>
> Martien
> --
> |
> Martien Verbruggen | Never hire a poor lawyer. Never buy from a
> Trading Post Australia | rich salesperson.
> |
------------------------------
Date: 26 Jun 2003 15:44:53 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: search for messages in large files
Message-Id: <slrnbfm57l.mnu.sholden@flexal.cs.usyd.edu.au>
On Thu, 26 Jun 2003 08:14:23 -0700,
Jim McTiernan <james.mctiernan@rcn.com> wrote:
>
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
>>
>> What was wrong with the suggestions I posted already? if you answer,
>> please realise that i will not be reading it anymore.
> The only thing wrong is your annoying attitude, goodbye.
Let's hope you don't have any future perl problems/questions/issues since
the 'experts' of the group (of which I am not one, obviously) aren't going
to be reading them here...
--
Sam Holden
------------------------------
Date: Thu, 26 Jun 2003 10:43:48 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: search for messages in large files
Message-Id: <slrnbfm55k.76a.tadmc@magna.augustmail.com>
Jim McTiernan <james.mctiernan@rcn.com> wrote:
> "Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
> news:slrnbfktdc.ng4.sholden@flexal.cs.usyd.edu.au...
>> On Wed, 25 Jun 2003 20:59:07 -0700, Jman <james.mctiernan@rcn.com> wrote:
>> > Actually, as I completely understand the contents of the file, and you
> do
>> > not,
Right. So it is *your* responsibility to convey what you know to us
if we are to be able to help you.
>> Of course, all the readers are psychic and knew that when you said
> "actually
>> MSG[1-50]", you didn't mean MSG1, MSG2, ..., MSG50 but of course meant
>> TIME, SLC, MDIIMON, etc...
>>
>> How foolish of those of us who can't read minds.
> I didn't think that it was that hard to understand.
That is irrelevant, since you were not explaining it to yourself.
When writing, what matters is the _reader's_ perception, not
the author's perception.
> Sorry this bothered you.
> I am thru with this thread.
I am through with this poster.
*plonk*
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 26 Jun 2003 09:00:08 -0700
From: "Jim McTiernan" <james.mctiernan@rcn.com>
Subject: Re: search for messages in large files
Message-Id: <bdf5ei$ijq$1@bob.news.rcn.net>
"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnbfm57l.mnu.sholden@flexal.cs.usyd.edu.au...
> On Thu, 26 Jun 2003 08:14:23 -0700,
> Jim McTiernan <james.mctiernan@rcn.com> wrote:
> >
> > "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> >>
> >> What was wrong with the suggestions I posted already? if you answer,
> >> please realise that i will not be reading it anymore.
> > The only thing wrong is your annoying attitude, goodbye.
>
> Let's hope you don't have any future perl problems/questions/issues since
> the 'experts' of the group (of which I am not one, obviously) aren't going
> to be reading them here...
That's fine. I'll just won't be able to learn anything else about perl,
or get to be part of these lively conversations.
>
> --
> Sam Holden
>
------------------------------
Date: Thu, 26 Jun 2003 09:01:41 -0700
From: "Jim McTiernan" <james.mctiernan@rcn.com>
Subject: Re: search for messages in large files
Message-Id: <bdf5hf$ipt$1@bob.news.rcn.net>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbfm55k.76a.tadmc@magna.augustmail.com...
> Jim McTiernan <james.mctiernan@rcn.com> wrote:
> > "Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
> > news:slrnbfktdc.ng4.sholden@flexal.cs.usyd.edu.au...
> >> On Wed, 25 Jun 2003 20:59:07 -0700, Jman <james.mctiernan@rcn.com>
wrote:
>
> >> > Actually, as I completely understand the contents of the file, and
you
> > do
> >> > not,
>
>
> Right. So it is *your* responsibility to convey what you know to us
> if we are to be able to help you.
>
>
> >> Of course, all the readers are psychic and knew that when you said
> > "actually
> >> MSG[1-50]", you didn't mean MSG1, MSG2, ..., MSG50 but of course meant
> >> TIME, SLC, MDIIMON, etc...
> >>
> >> How foolish of those of us who can't read minds.
>
> > I didn't think that it was that hard to understand.
>
>
> That is irrelevant, since you were not explaining it to yourself.
>
> When writing, what matters is the _reader's_ perception, not
> the author's perception.
>
>
> > Sorry this bothered you.
> > I am thru with this thread.
>
>
> I am through with this poster.
You're thru with me, thank you master.
>
> *plonk*
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 26 Jun 2003 18:38:10 +0100
From: mike solomon <mike_solomon@lineone.net>
Subject: Re: soap::lite hellp needed with sms
Message-Id: <3EFB2F82.5020408@lineone.net>
<SNIP>
Thanks for all the help
I have now got it working
Working code :
use SOAP::Lite +trace => debug, on_action => sub {sprintf '%s/%s', @_};
use strict;
my $username = "USER";
my $password = "PASSWORD";
my $account = "ACCOUNT";
my $originator = "07937376";
my $recipient = "0793976";
my $body = "TEST SOAP - SMS NOW WORKING !";
my $type = "text";
my $host = 'www.esendex.com';
my $proxy = "http://$host/secure/messenger/soap/SendService.asmx";
my $uri = "com.esendex.ems.soapinterface";
#The name of the module
my $soap = SOAP::Lite->uri($uri);
#The url for the request
$soap = $soap->proxy($proxy);
# send the request w/ header
my $response = $soap->SendMessageFull(
# # HEADER
SOAP::Header->name(MessengerHeader => \SOAP::Header->value(
SOAP::Header->name(Username => $username),
SOAP::Header->name(Password => $password),
SOAP::Header->new( name => 'Account', value => "$account" , type =>
'xsi:string' ),
))->attr({xmlns=>'com.esendex.ems.soapinterface'})
,
# # PARAMETERS FOR BODY
SOAP::Data->new( name => 'namesp1:originator', value => "$originator" ,
type => 'xsi:string' ),
SOAP::Data->new( name => 'namesp1:recipient', value => "$recipient",
type => 'xsi:string' ),
SOAP::Data->name('namesp1:body' => $body),
SOAP::Data->name('type' =>$type),
SOAP::Data->name('validityperiod' => 99)
);
print "response = $response\n";
# get the result and print the error message if it failed
if (defined (my $result = $response->result)) {
print "result = $result\n";
}
else {
print "Fault: ", $response->faultstring, "\n",
"Detail:\n", $response->faultdetail, "\n";
}
__END__
------------------------------
Date: Thu, 26 Jun 2003 18:29:22 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: why this doesn't work (tm)? :)
Message-Id: <2o7mfvobgjhdcad02jg5a6i08slq6ur3me@4ax.com>
print $i for $i(1..3);
is there a reason, or simply just doesn't work?
--
Matija
------------------------------
Date: Thu, 26 Jun 2003 16:54:12 GMT
From: "Jeff Boes" <jboes@nexcerpt.com>
Subject: Re: why this doesn't work (tm)? :)
Message-Id: <c212316fee9ae7624ce629ec4ac1c479@free.teranews.com>
On Thu, 26 Jun 2003 18:29:22 +0200, Matija Papec wrote:
>
> print $i for $i(1..3);
>
> is there a reason, or simply just doesn't work?
See perldoc perlsyn for answers. 'foreach' in this syntax is a modifier
that just happens to have the same keyword as the 'foreach' loop:
foreach $i (1..3) { print $i }
The 'foreach' modifier _only_ works for the $_ variable.
--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise
------------------------------
Date: Thu, 26 Jun 2003 10:35:42 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Write to a filehandle and to STDOUT without double print statements?
Message-Id: <slrnbfm4me.76a.tadmc@magna.augustmail.com>
dnrg <dananrg@yahoo.com> wrote:
> I'd like to output the same text to the screen as well as to a file.
Your Question is Asked Frequently.
You are expected to check the Perl FAQ *before* posting to the Perl newgroup.
perldoc -q file
How do I print to more than one file at once?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Jun 2003 17:27:53 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Write to a filehandle and to STDOUT without double print statements?
Message-Id: <u9smpwercm.fsf@wcl-l.bham.ac.uk>
tadmc@augustmail.com (Tad McClellan) writes:
> dnrg <dananrg@yahoo.com> wrote:
>
> > I'd like to output the same text to the screen as well as to a file.
>
>
> Your Question is Asked Frequently.
>
> You are expected to check the Perl FAQ *before* posting to the Perl newgroup.
>
>
> perldoc -q file
>
> How do I print to more than one file at once?
Tad, whilst I approve of RTFFAQ answers in principle, I should point
out that the FAQ fails to mention IO::Tee which is probably the
"right" answer.
Could someone please submit a patch to the FAQ.
I would submit it my self but FAQ maintainers seem to ignore me now
since I once submitted a patch containing a typo.
--- perlfaq5.pod Thu Jun 26 17:14:01 2003
+++ perlfaq5.pod+IO::Tee Thu Jun 26 17:25:05 2003
@@ -658,8 +658,8 @@
for $fh (FH1, FH2, FH3) { print $fh "whatever\n" }
To connect up to one filehandle to several output filehandles, it's
-easiest to use the tee(1) program if you have it, and let it take care
-of the multiplexing:
+easiest to use the IO::Tee module or the tee(1) program if you have
+it, and let it take care of the multiplexing:
open (FH, "| tee file1 file2 file3");
@@ -670,6 +670,11 @@
print "whatever\n" or die "Writing: $!\n";
close(STDOUT) or die "Closing: $!\n";
+ require IO::Tee;
+ my $tee = new IO::Tee \*STDOUT, ">file1", ">file2", ">file3"
+ or die "Teeing off: $!\n";
+ print $tee "whatever\n" or die "Writing: $!\n";
+
Otherwise you'll have to write your own multiplexing print
function--or your own tee program--or use Tom Christiansen's,
at http://www.cpan.org/authors/id/TOMC/scripts/tct.gz , which is
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 26 Jun 2003 18:33:15 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Write to a filehandle and to STDOUT without double print statements?
Message-Id: <l08mfvo3q59uhma9t2ppeioe2q3omhjq8e@4ax.com>
X-Ftn-To: dnrg
dananrg@yahoo.com (dnrg) wrote:
>I'd like to output the same text to the screen as well as to a file.
>I've always used double print statements to achieve this in the past
>but it always seemed like a dopey way to do it. Is there a more
>elegant, space-saving way to do this? Can you use two or more
>filehandles in the same print statement?
this is from perl cookbook(slightly modified)
#untested
@fh = (*FH1, *FH2, *FH3);
...
print $_ "writing to all file handles" for @fh;
--
Matija
------------------------------
Date: Thu, 26 Jun 2003 18:39:27 +0200
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: Write to a filehandle and to STDOUT without double print statements?
Message-Id: <158mfvgi37bo43veli0d8j2l6s1gc7t86m@4ax.com>
X-Ftn-To: Tad McClellan
tadmc@augustmail.com (Tad McClellan) wrote:
>Your Question is Asked Frequently.
>
>You are expected to check the Perl FAQ *before* posting to the Perl newgroup.
>
>
> perldoc -q file
How do I print to more than one file at once?
To connect one filehandle to several output filehandles, you can
use the IO::Tee or Tie::FileHandle::Multiplex modules.
If you only have to do this once, you can print individually to
each filehandle.
for $fh (FH1, FH2, FH3) { print $fh "whatever\n" }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
According to cookbook this is wrong example, there it claims that strict
can't live with it.
--
Matija
------------------------------
Date: Thu, 26 Jun 2003 11:09:50 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Write to a filehandle and to STDOUT without double print statements?
Message-Id: <4nsmpweuyp.fsf@lockgroove.bwh.harvard.edu>
On 26 Jun 2003, dananrg@yahoo.com wrote:
> I'd like to output the same text to the screen as well as to a file.
> I've always used double print statements to achieve this in the past
> but it always seemed like a dopey way to do it. Is there a more
> elegant, space-saving way to do this? Can you use two or more
> filehandles in the same print statement?
The simple solution is to use a subroutine that does what you want, or
an external program such as tee.
Ted
------------------------------
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.
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 5141
***************************************