[23499] in Perl-Users-Digest
Perl-Users Digest, Issue: 5709 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 25 06:05:40 2003
Date: Sat, 25 Oct 2003 03:05:05 -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 Sat, 25 Oct 2003 Volume: 10 Number: 5709
Today's topics:
Re: About Expect. <jwillmore@remove.adelphia.net>
Re: Accessing C struct members via T_PTROBJ <kalinaubears@iinet.net.au>
Re: Balanced Text?? (Tad McClellan)
Re: help to understand a broken script (Chad)
Re: matching ?? <tore@aursand.no>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 25 Oct 2003 02:48:43 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: About Expect.
Message-Id: <20031024224845.256217d8.jwillmore@remove.adelphia.net>
On Fri, 24 Oct 2003 21:03:25 GMT
"Dr. Pastor" <elp@pnsihq.com> wrote:
> Is there any published report about successful usage of Expect?
> Thanks for any help!
Can you be more specific? Are you looking for examples?
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
I really hate this damned machine I wish that they would sell it.
It never does quite what I want But only what I tell it.
------------------------------
Date: Sat, 25 Oct 2003 19:45:39 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
To: Mark Shelor <mshelor@comcast.removeme.net>
Subject: Re: Accessing C struct members via T_PTROBJ
Message-Id: <3F9A4643.9060108@iinet.net.au>
Mark Shelor wrote:
> I recently wrote a Perl extension in which h2xs pretty much handled all
> the XS details for me. I now need to go back and access C struct
> members from within Perl if possible.
>
> The typemap file indicates that my struct pointer (SHA *) got mapped as
> a T_PTROBJ. Is there any way I can use this info to do reads and writes
> on the various struct members? Or, do I need to go back and write
> accessor routines in C?
>
> TIA, Mark
>
I was involved in some discussion of Inline::Struct about a week ago -
though I don't profess to know much about it. It's not yet recommended
for production, but it might be useful to you. (It uses the Inline and
Inline::C modules to enable direct reads and writes on C struct members
form perl.) If you think it might be useful then first check out the
*entire* thread "Help w/ Inline::Struct" on the Inline mailing list
archives - see http://lists.perl.org, click on the link to Inline, then
on the link to the Archive.
Reading that thread should give you a fair idea of what you need to do
if you want to make use of Inline::Struct.
I think it turned out to be insufficiently versatile for the purposes of
the OP, and he concluded that he would have to write accessor routines
in C - which is an option you've mentioned, and is the only additional
option I'm aware of .... but faik, there could be others :-)
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Fri, 24 Oct 2003 17:31:42 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Balanced Text??
Message-Id: <slrnbpja2e.9jm.tadmc@magna.augustmail.com>
MPBroida <michael.p.broida@boeing_oops.com> wrote:
> Tad McClellan wrote:
>>
>> MPBroida <michael.p.broida@boeing_oops.com> wrote:
>>
>> > I've seen this mentioned here before, but I can't find
>> > the specific messages. It's not directly in the FAQ,
>> > either,
>>
>> Yes it is.
>
> Don't see it anywhere.
>
>
>> > But I don't recall whether the package/module is:
>> > Text::Balanced
>> > or:
>> > Balanced::Text
>>
>> perldoc -q Balanced
>>
>> Can I use Perl regular expressions to match balanced text?
>
> But that perldoc section does NOT refer to either
> "Balanced::Text" or "Text::Balanced", and that's
> what I was hunting for: the real name of that module/
> package/whatever it is.
Huh?
Can I use Perl regular expressions to match balanced text?
Historically, Perl regular expressions were not
capable of matching balanced text. As of more
recent versions of perl including 5.6.1 experimen
tal features have been added that make it possible
to do this. Look at the documentation for the
(??{ }) construct in recent perlre manual pages to
see an example of matching balanced parentheses.
Be sure to take special notice of the warnings
present in the manual before making use of this
feature.
CPAN contains many modules that can be useful for
matching text depending on the context. Damian
Conway provides some useful patterns in Reg
exp::Common. The module Text::Balanced provides a
^^^^^^^^^^^^^^
general solution to this problem.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 24 Oct 2003 17:17:17 -0700
From: chussung@operamail.com (Chad)
Subject: Re: help to understand a broken script
Message-Id: <97a530bb.0310241617.68137a1a@posting.google.com>
Thanks to everyone who contributed. it works now.
all the advice made the difference. The code is still ugly, but it
works and I can work on more elegant code as I progress.
Once again
Thank you
Chad
------------------------------
Date: Sat, 25 Oct 2003 11:49:13 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: matching ??
Message-Id: <pan.2003.10.24.14.00.39.848384@aursand.no>
On Fri, 24 Oct 2003 01:43:10 -0700, Tim wrote:
> data: s1 s2 s3 0.900 0.890 0.588
> data2: s1 s2 s3 2.900F 1.890F 0.888
> data3: s1 s2 s3 1.900F 6.890F 0.388F
>
> My ReqX:
> I would like to store the data in @name using the expression below:
> @name = m/(\d+\.\d+)/g;
> however, It does not ALWAYS work because for this case
>
> data2: s1 s2 s3 2.900F 1.890F 0.888
> $name[0] = 2.900 but I want $name[0] = 2.900F
> $name[1] = 1.890 but I want $name[1] = 1.890F
> $name[2] = 0.888
Why bother using regular expression to do something this simple? split()
would do, wouldn't it?
my @data = ();
while ( <DATA> ) {
chomp;
my @tmp = split( /\s+/ );
push( @data, $tmp[4] );
push( @data, $tmp[5] );
push( @data, $tmp[6] );
}
No problem substituting the three push() calls with only one.
--
Tore Aursand <tore@aursand.no>
------------------------------
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 5709
***************************************