[17708] in Perl-Users-Digest
Perl-Users Digest, Issue: 5128 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 16 03:05:39 2000
Date: Sat, 16 Dec 2000 00:05:10 -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: <976953909-v9-i5128@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 16 Dec 2000 Volume: 9 Number: 5128
Today's topics:
Re: #include files? sort of (Martien Verbruggen)
Re: About to slit my own throat <mcnuttj@nin.iats.missouri.edu>
Re: basic code -- why won't it work??!! <gopalan@cs.sc.edu>
can't find syscall ! <bmoore@door.net>
Re: Capturing text from a task run by a perl script o <johngros@Spam.bigpond.net.au>
Crazy RegExp please? <WebMaster3@qax.org>
Re: Crazy RegExp please? <johnm@acadiacom.net>
Re: dynamically looding perl.modules <jeffp@crusoe.net>
Re: FAQ 5.12: How come when I open a file read-write <tick.toff@spam.com>
How put banner each page ????? <c@c.com>
Re: How put banner each page ????? (Brian Pontz)
Re: Is Perl dying? <jdhunter@nitace.bsd.uchicago.edu>
Re: Is Perl dying? <joe+usenet@sunstarsys.com>
Re: Is Perl dying? <jdhunter@nitace.bsd.uchicago.edu>
Re: Is Perl dying? <uri@sysarch.com>
MIME::Lite error <harrisr@bignet.net>
Need Advice: embedding perl in C++ <tonghang@transmeta.com>
Re: Need help on data processing <mbudash@sonic.net>
Re: Perl programming <tick.toff@spam.com>
Re: Perl programming (Martien Verbruggen)
Re: Perl programming <tick.toff@spam.com>
Re: Pulling content from a HTML doc <johnm@acadiacom.net>
Re: Pulling content from a HTML doc <someguyREMOVE@REMOVEsunflower.com>
Re: Pulling content from a HTML doc <jdhunter@nitace.bsd.uchicago.edu>
Re: Pulling content from a HTML doc <johnm@acadiacom.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 16 Dec 2000 14:32:25 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: #include files? sort of
Message-Id: <slrn93loi9.o20.mgjv@martien.heliotrope.home>
On 14 Dec 2000 15:00:08 -0600,
Ren Maddox <ren.maddox@tivoli.com> wrote:
> stanb@panix.com (Stan Brown) writes:
[Reformatted article to fit within 80 columns]
>
>> my ( $my_pid_file, $my_tags_file, $my_ftp_lock_file, $my_max_ftp_wait );
[snip]
>> @export = ( $my_pid_file, $my_tags_file, $my_ftp_lock_file,
>> $my_max_ftp_wait, $m y_csv_db_dir, $my_sleep_time_per_cycle,
>> $my_lock_wait, $my_lock_tries, $my_log_f ile,
>> $my_partner_task_has_lock, $my_max_data_wait, $my_max_tags_in_que,
>> $my_max_ data_wait_per_tag, $my_loglevel, $my_badinit, $cfg_file);
>
> Ah... you're trying to export these symbols, but you didn't do it
> correctly. Two problems: it is @EXPORT not @export, and you cannot
> simply "use Exporter", you have to inherit it. The Exporter
> documentation shows how to do this.
And, you can't export lexically scoped variables:
# cat MyMod.pm
package MyMod;
require Exporter;
@ISA = qw(Exporter);
my $foo = 3;
our $bar = 4;
@EXPORT = qw($foo $bar);
# perl -wl
use strict;
use MyMod;
print $foo;
print $bar;
__END__
4
Use of uninitialized value in print at - line 4.
#
Martien
--
Martien Verbruggen |
Interactive Media Division | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd. | ain't.
NSW, Australia |
------------------------------
Date: 16 Dec 2000 06:03:19 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: About to slit my own throat
Message-Id: <91f0j7$2l4$1@dipsy.missouri.edu>
Craig Berry <cberry@cinenet.net> wrote:
> Jerome O'Neil (jerome@activeindexing.com) wrote:
> : cberry@cinenet.net (Craig Berry) elucidates:
> : > Anthony (apsaffer@hotmail.com) wrote:
> : >: No, it is NOT a spam generator. It is an anonymous email program made
> : >: for a legitimate organization that will not use it for spam.
> : >
> : > I can't think of any legitimate use for automated anonymous email.
> :
> : Whistle blowers.
> That is many-to-one, and could be handled trivially by a simple
> form-to-mail app. Let me clarify that I can see no legitimate need for
> automated anonymous email to a large number of recipients, as in the OP's
> scenario.
The funny part is that I saw the subject line and thought some programmer
was at his wits' end with some script. <grin> I know *I've* been pushed
close to the edge with SNMP.pm from time to time...
--J
------------------------------
Date: Fri, 15 Dec 2000 23:26:23 -0500
From: Gopi Sundaram <gopalan@cs.sc.edu>
Subject: Re: basic code -- why won't it work??!!
Message-Id: <Pine.OSF.4.31.0012152325020.7772-100000@pearl.cs.sc.edu>
On 15 Dec 2000, Sue Spence wrote:
> One further suggestion - put your current directory ('.') in your
> path ahead of everything else.
Gaack! Don't ever do that! '.' shouldn't even be in your path in the
first place. If it is, it should be at the very end.
--
Gopi Sundaram
gopi@cse.sc.edu
------------------------------
Date: Sat, 16 Dec 2000 04:54:30 GMT
From: "Brett L. Moore" <bmoore@door.net>
Subject: can't find syscall !
Message-Id: <aAC_5.69663$yR4.1914654@news1.rdc1.tx.home.com>
Hi,
I am trying to perform a system call using activeperl on win nt (I know, I
know, one of these days I will go completely to linux!). activeperl reports
syscall not implemented - try h2ph.
When I run h2ph, it just sits there - regardless of command arguments - and
it apparently ignores the fact that it is running in the same dir as the
perl .h files.
Any ideas?
Alfred P. Newbie
------------------------------
Date: Sat, 16 Dec 2000 02:16:43 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Capturing text from a task run by a perl script on WinNT
Message-Id: <fgA_5.19802$xW4.157083@news-server.bigpond.net.au>
I changed two lines for you I think it will do it. I am not sure if the
caret should be there or not as I don't know the output from the query. If
"running might not be at the start then remove it.
"Mike Matteson" <Mike_Matteson@dg.com> wrote in message
news:91dsib$otd$1@imas0002.us.dg.com...
> # find the status of the service on the NT box, and do something as a
result
> of the service
> # running or not running
$_= `c:\netsvc eventlog \\mysystem /query`;
if (/^"running/){
> ...do something exciting here...
> }
------------------------------
Date: Sat, 16 Dec 2000 02:29:27 +0000
From: Kul <WebMaster3@qax.org>
Subject: Crazy RegExp please?
Message-Id: <3A3AD387.2B461191@qax.org>
--------------2D5268F6E9AA5B0E6FD902DF
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
In Perl, Heres an easy one for you all, how can I split the following type of input?
input = a string of words/chars, some may be enclosed in quotes, and some may not, as well as other junk characters which I dont want.
I would like to grab all the text between two quotes, (a phrase), and then from the remainer grab all the words/chars that are seperated by non alphanumeric chars. Order is unimportant! - It could also contain an odd number of quotes, then I would like it to grab from the last quote until the end of the variable, as if it had a traling quote. I do not want the quotes in the end result, but removing these later with all the non alphanumberic chars is not a problem for me.
It just the spliting of the string that mashed my head up :-(
Some example (invented) data in a single input ($inputvar):
"john and 7374398 paul" $%£ nobody"jim" "jon" somebody else "*-())8are all friends" oh yes"excelent man9999
I would like the following output, in an @outputstuff if poss :
john and paul
nobody
jim
jon
somebody
else
are all friends
oh
yes
excelent man
Any help (beyond the "O'Reilly - Programming Perl and Perl Cookbook" would be useful, as Ive read them both and cant find a way of doing it.
Best Regards
Colin
+------- ------ ----- ---- --- -- - - - - - - - -
"Scientia est Potentia" - "Knowledge is Power" ...... if you ain't got it, then blag it!
+------- ------ ----- ---- --- -- - - - - - - - -
Any Syntax or Spelling Errors are nothing to do with me,
They must be Transmission Errors !
+------- ------ ----- ---- --- -- - - - - - - - -
--------------2D5268F6E9AA5B0E6FD902DF
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
In Perl, Heres an easy one for you all, how can I split the following type
of input?
<p>input = a string of words/chars, some may be enclosed in quotes,
and some may not, as well as other junk characters which I dont want.
<br>I would like to grab all the text between two quotes, (a phrase), and
then from the remainer grab all the words/chars that are seperated by non
alphanumeric chars. Order is unimportant! - It could also contain
an odd number of quotes, then I would like it to grab from the last quote
until the end of the variable, as if it had a traling quote. I do
not want the quotes in the end result, but removing these later with all
the non alphanumberic chars is not a problem for me.
<br>It just the spliting of the string that mashed my head up :-(
<p>Some example (invented) data in a single input ($inputvar):
<br><tt>"john and 7374398 paul" $%£ nobody"jim"
"jon" somebody else "*-())8are all friends" oh yes"excelent man9999</tt>
<p>I would like the following output, in an @outputstuff if
poss :
<br><tt>john and paul</tt>
<br><tt>nobody</tt>
<br><tt>jim</tt>
<br><tt>jon</tt>
<br><tt>somebody</tt>
<br><tt>else</tt>
<br><tt>are all friends</tt>
<br><tt>oh</tt>
<br><tt>yes</tt>
<br><tt>excelent man</tt>
<p>Any help (beyond the "O'Reilly - Programming Perl and Perl Cookbook"
would be useful, as Ive read them both and cant find a way of doing it.
<br>Best Regards
<br>Colin
<br>+------- ------ ----- ---- --- -- - - - - -
- - -
<br>"Scientia est Potentia" - "Knowledge is Power" ...... if you ain't
got it, then blag it!
<br>+------- ------ ----- ---- --- -- - - - - -
- - -
<br> Any Syntax or Spelling Errors are nothing to do with me,
<br> They must be Transmission Errors !
<br>+------- ------ ----- ---- --- -- - - - - -
- - -</html>
--------------2D5268F6E9AA5B0E6FD902DF--
------------------------------
Date: Fri, 15 Dec 2000 21:35:18 -0600
From: "John Michael" <johnm@acadiacom.net>
Subject: Re: Crazy RegExp please?
Message-Id: <3a3ae422@news.acadiacom.net>
This is a multi-part message in MIME format.
------=_NextPart_000_00B2_01C066DE.EB9BC100
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Perl has an excellent book on regular expressions that could teach you =
how to do it. It is an O'Reilly book as well if you don't get the help =
from someone else. I don't have the book with me and can't do it from =
my head. I think someone will probably need more information.
Here is what I think the process would be.
Since it looks like you are identifying words by A-Z, a-z
Start from beginning of line.
Get rid of everything that isn't (A-Z,a-z) with a substitution operator =
with nothing in it.
Split it on white space into an array and you have your words.
Hope this helps
In Perl, Heres an easy one for you all, how can I split the following =
type of input?=20
input =3D a string of words/chars, some may be enclosed in quotes, =
and some may not, as well as other junk characters which I dont want.=20
I would like to grab all the text between two quotes, (a phrase), and =
then from the remainer grab all the words/chars that are seperated by =
non alphanumeric chars. Order is unimportant! - It could also contain =
an odd number of quotes, then I would like it to grab from the last =
quote until the end of the variable, as if it had a traling quote. I do =
not want the quotes in the end result, but removing these later with all =
the non alphanumberic chars is not a problem for me.=20
It just the spliting of the string that mashed my head up :-(=20
Some example (invented) data in a single input ($inputvar):=20
"john and 7374398 paul" $%=A3 nobody"jim" "jon" somebody else =
"*-())8are all friends" oh yes"excelent man9999=20
I would like the following output, in an @outputstuff if poss :=20
john and paul=20
nobody=20
jim=20
jon=20
somebody=20
else=20
are all friends=20
oh=20
yes=20
excelent man=20
Any help (beyond the "O'Reilly - Programming Perl and Perl Cookbook" =
would be useful, as Ive read them both and cant find a way of doing it.=20
Best Regards=20
Colin=20
+------- ------ ----- ---- --- -- - - - - - - - -=20
"Scientia est Potentia" - "Knowledge is Power" ...... if you ain't got =
it, then blag it!=20
+------- ------ ----- ---- --- -- - - - - - - - -=20
Any Syntax or Spelling Errors are nothing to do with me,=20
They must be Transmission Errors !=20
+------- ------ ----- ---- --- -- - - - - - - - -=20
------=_NextPart_000_00B2_01C066DE.EB9BC100
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Perl has an excellent book on regular =
expressions=20
that could teach you how to do it. It is an O'Reilly book as well =
if you=20
don't get the help from someone else. I don't have the book with =
me and=20
can't do it from my head. I think someone will probably need more=20
information.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Here is what I think the process would=20
be.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Since it looks like you are identifying =
words by=20
A-Z, a-z</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Start from beginning of =
line.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Get rid of everything that isn't =
(A-Z,a-z) with a=20
substitution operator with nothing in it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Split it on white space into an array =
and you have=20
your words.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Hope this helps</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">In=20
Perl, Heres an easy one for you all, how can I split the following =
type of=20
input?=20
<P>input =3D a string of words/chars, some may be enclosed in =
quotes, and=20
some may not, as well as other junk characters which I dont want. =
<BR>I would=20
like to grab all the text between two quotes, (a phrase), and then =
from the=20
remainer grab all the words/chars that are seperated by non =
alphanumeric=20
chars. Order is unimportant! - It could also contain an =
odd number=20
of quotes, then I would like it to grab from the last quote until the =
end of=20
the variable, as if it had a traling quote. I do not want the =
quotes in=20
the end result, but removing these later with all the non =
alphanumberic chars=20
is not a problem for me. <BR>It just the spliting of the string that =
mashed my=20
head up :-(=20
<P>Some example (invented) data in a single input ($inputvar): =
<BR><TT>"john=20
and 7374398 paul" $%=A3 nobody"jim" "jon" somebody =
else=20
"*-())8are all friends" oh yes"excelent man9999</TT>=20
<P>I would like the following output, in an @outputstuff =
if poss :=20
<BR><TT>john and paul</TT> <BR><TT>nobody</TT> <BR><TT>jim</TT>=20
<BR><TT>jon</TT> <BR><TT>somebody</TT> <BR><TT>else</TT> <BR><TT>are =
all=20
friends</TT> <BR><TT>oh</TT> <BR><TT>yes</TT> <BR><TT>excelent =
man</TT>=20
<P>Any help (beyond the "O'Reilly - Programming Perl and Perl =
Cookbook" would=20
be useful, as Ive read them both and cant find a way of doing it. =
<BR>Best=20
Regards <BR>Colin <BR>+------- ------ ----- ---- --- -- - - - =20
- - - =20
- - <BR>"Scientia est Potentia" - =
"Knowledge is=20
Power" ...... if you ain't got it, then blag it! <BR>+------- ------ =
-----=20
---- --- -- - - - - - =20
- - - =
<BR> Any=20
Syntax or Spelling Errors are nothing to do with me,=20
<BR> They must be Transmission Errors !=20
<BR>+------- ------ ----- ---- --- -- - - - - =20
- - =
- =20
- </P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_00B2_01C066DE.EB9BC100--
------------------------------
Date: Fri, 15 Dec 2000 21:14:53 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: dynamically looding perl.modules
Message-Id: <Pine.GSO.4.21.0012152110290.17632-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 15, Thomas Schindl said:
>does anybody know how I can load perl-modules at run time? I know that
>the following example won't work it should only illustrate my problem.
'use' always happens at compile-time (unless you do something like wrap it
in an eval "..."). You probably want require().
>if($status == 1)
>{
> use $perlArray[0];
>}
>else
>{
> use $perlArray[1];
>}
Here are MWTDI (many ways to do it):
require $perlArray[!$status];
require $perlArray[$status ? 0 : 1];
require $status ? $perlArray[0] : $perlArray[1];
if ($status) { require $perlArray[0] }
else { require $perlArray[1] }
However, after you require it, you probably want to call import() on it:
require $perlArray[!$status];
$perlArray[!$status]->import;
You should be able to figure out the rest.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Sat, 16 Dec 2000 03:27:07 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: FAQ 5.12: How come when I open a file read-write it wipes it out?
Message-Id: <fiB_5.19885$xW4.156780@news-server.bigpond.net.au>
YAY!!! an FAQ post I understand :-)
PerlFAQ Server wrote in message ...
------------------------------
Date: Sat, 16 Dec 2000 10:04:12 +0800
From: "tman" <c@c.com>
Subject: How put banner each page ?????
Message-Id: <91ej82$17i$1@horn.hk.diyixian.com>
How put banner each page ?????
Dear all,
I have one questions, I seen some free hosting company like hypermart.net /
virtualave.net
they can Auto put the banner or code at all members html page.
Any one know how to do that ? any web site teach that ?
thanks
------------------------------
Date: Sat, 16 Dec 2000 05:47:58 GMT
From: pontz@NO_SPAM.channel1.com (Brian Pontz)
Subject: Re: How put banner each page ?????
Message-Id: <3a3b01b0.188121753@news.ne.mediaone.net>
>How put banner each page ?????
Off topic for this group. But if your using Apache then take a look at
mod_rewrite
Brian Pontz
------------------------------
Date: 15 Dec 2000 22:33:08 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Is Perl dying?
Message-Id: <1r3dfp56kb.fsf@video.bsd.uchicago.edu>
>>>>> "Joe" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
Joe> A person that values encapsulation and understands the
Joe> importance of a fixed API will eventually figure out how to
Joe> implement it well in virtually any language.
Can you do in QWBASIC? Or is that where the virtually part comes in?
JDH
------------------------------
Date: 16 Dec 2000 00:01:41 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Is Perl dying?
Message-Id: <m366klt0wa.fsf@mumonkan.sunstarsys.com>
John Hunter <jdhunter@nitace.bsd.uchicago.edu> writes:
> >>>>> "Joe" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
>
> Joe> A person that values encapsulation and understands the
> Joe> importance of a fixed API will eventually figure out how to
> Joe> implement it well in virtually any language.
>
> Can you do in QWBASIC? Or is that where the virtually part comes in?
>
I never claimed to be such a person- what's QWBASIC? :)
--
Joe Schaefer
anxiously awaiting MMI
------------------------------
Date: 15 Dec 2000 23:53:29 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Is Perl dying?
Message-Id: <1rsnno52ue.fsf@video.bsd.uchicago.edu>
>>>>> "Joe" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
Joe> A person that values encapsulation and understands the
Joe> importance of a fixed API will eventually figure out how to
Joe> implement it well in virtually any language.
>> Can you do in QWBASIC? Or is that where the virtually part
>> comes in?
>>
Joe> I never claimed to be such a person- what's QWBASIC? :)
Quick BASIC (don't ask me about the W). It was primarily a rhetorical
question. I was a young whipper snapper, my advisor wanted some
software to control an Analog/Digital Board in the laboratory I work
in so we could run our experiments. He suggested I do it in BASIC,
because 'Everyone knows BASIC' and hence those who come after me could
use and extend my code. Thus I embarked on writing a full
application, including a real time digital oscilloscope and every
other goddam feature in the world in a language with no libraries and
little language support. I had to write my own max functions: for
integers, floats, arrays, and so on. No templates, no libraries, no
pointers, no nothing.
So when you say that encapsulation can be implemented in any language,
I am forced to think back to my bad old days of long suffering in the
most primitive of languages.
JDH
------------------------------
Date: Sat, 16 Dec 2000 06:19:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Is Perl dying?
Message-Id: <x7bsuchoqq.fsf@home.sysarch.com>
>>>>> "JH" == John Hunter <jdhunter@nitace.bsd.uchicago.edu> writes:
JH> So when you say that encapsulation can be implemented in any language,
JH> I am forced to think back to my bad old days of long suffering in the
JH> most primitive of languages.
i wrote encapsulated code of a sort in MACRO-11. all major calls and
events were done with macros which kept the api clean. i renamed key
registers and always used them the same way. not bad for OO assembler.
this was 20 years ago to boot.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sat, 16 Dec 2000 02:46:34 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: MIME::Lite error
Message-Id: <t3m7dn5k29d67c@corp.supernews.com>
I've installed MIME::Lite on an HP system. It seems to work but I get
these errors whenever I use it. They also occurred when I ran 'make
test' during the install. What do they mean, where do they come from
and how do I stop them?
Unrecognized escape \s passed through at (eval 2) line 11.
Unrecognized escape \s passed through at (eval 2) line 11.
Unrecognized escape \s passed through at (eval 2) line 11.
Randy Harris
------------------------------
Date: Fri, 15 Dec 2000 21:29:34 -0800
From: Tonghang Zhou <tonghang@transmeta.com>
Subject: Need Advice: embedding perl in C++
Message-Id: <976946168.687987@palladium.transmeta.com>
--------------E4C8B8AC150F0E241835A184
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I need some advice on embedding perl in C++ while at the same time
extending it with functions that C++ side provides. Specially I like to
do this:
void cfunction();
void foo()
{
PerlInterpreter* myPerl = perl_alloc();
perl_construct(myPerl);
// execute an external perl program
char* argv[] = { "", "prog.pl" };
perl_parse(myPerl, 0, 2, argv, env);
perl_run(myPerl);
...
}
where prog.pl is a user program that can call cfunction().
I know I can extend Perl by making one that contains
cfunction() and the rest of the C++ side. But that's not
quite waht I want. For one thing the C++ side runs in
pthreads, and foo() is one of the threads. There may
be multiple interpreters each executing a separate
perl program. I must be blocked in my mind by
something trivial here. Would someone set me right?
--
Tonghang Zhou
--------------E4C8B8AC150F0E241835A184
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I need some advice on embedding perl in C++ while at the same time
<br>extending it with functions that C++ side provides. Specially
I like to
<br>do this:
<p> void cfunction();
<p> void foo()
<br> {
<br> PerlInterpreter* myPerl
= perl_alloc();
<br> perl_construct(myPerl);
<p> // execute an external perl
program
<br> char* argv[] = { "", "prog.pl"
};
<br> perl_parse(myPerl, 0, 2,
argv, env);
<br> perl_run(myPerl);
<p> ...
<br> }
<p>where prog.pl is a user program that can call cfunction().
<p>I know I can extend Perl by making one that contains
<br>cfunction() and the rest of the C++ side. But that's not
<br>quite waht I want. For one thing the C++ side runs in
<br>pthreads, and foo() is one of the threads. There may
<br>be multiple interpreters each executing a separate
<br>perl program. I must be blocked in my mind by
<br>something trivial here. Would someone set me right?
<pre>--
Tonghang Zhou</pre>
</html>
--------------E4C8B8AC150F0E241835A184--
------------------------------
Date: Fri, 15 Dec 2000 18:13:09 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Need help on data processing
Message-Id: <mbudash-73CCC3.18130915122000@news.pacbell.net>
In article <91eh3m$vt7$1@nnrp1.deja.com>, tvn007@my-deja.com wrote:
> Hi,
>
> If I have lines as shown below:
>
> (:op ( rep 25 )
> sp_R ab cd 1001 )
>
> How can I convert to a single line like this:
>
> R25 sp_R ab cd 1001 ;
>
>
> Sent via Deja.com
> http://www.deja.com/
one way, though you didn't give many details...:
$line = qq{(:op ( rep 25 )
sp_R ab cd 1001 )};
$line =~ s/^.+?rep (\d+).+?\n(.+?) \)/R$1 $2/;
that oughta get you started...
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sat, 16 Dec 2000 03:24:50 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: Perl programming
Message-Id: <6gB_5.19874$xW4.157738@news-server.bigpond.net.au>
slight mod though
I recently went through the perl install from scratch and the more I read
the more it seems to me that there should be a BIG RED WARNING during perl
install - "Install this product into /usr/bin/perl, it's a *nix convention
but you'll save yourself some pain in future if you do this". Or am I wrong
?
I'm just glad it was almost time for the regular "deltree windows" on this
box.
Jay Flaherty wrote in message ...
>"Anuj" <anujm2000@hotmail.com> wrote in message
>news:t3jlkdmaeoku6a@corp.supernews.com...
>> In the DOS prompt i have to write "PATH=/perl/bin" always
>> before running the script and then writing the initializing command
>> i.e "perl hello.pl" ( An example file hello.pl) . Is there a way that i
>> dont need to always write the PATH=/perl/bin command so that i can
>> directly run the scripts from the DOS prompt by typing "perl hello.pl".
>
>edit autoexec.bat and add the line:
>
>SET PATH=%PATH%;C:\perl\bin
>
>--
>###############################
>Take care of your shoes...jay
>Jay Flaherty fty@mediapulse.com
>Mediapulse, Inc. -The pulse of your eBusiness
>
------------------------------
Date: Sat, 16 Dec 2000 17:31:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl programming
Message-Id: <slrn93m321.83e.mgjv@martien.heliotrope.home>
[Please, in the future, put your reply _after_ the text you reply to.
It's the convention on this group, and Usenet in general, and makes your
post much easier to read]
On Sat, 16 Dec 2000 03:24:50 GMT,
SuperGumby <tick.toff@spam.com> wrote:
[article reformaotted and reordered]
> Jay Flaherty wrote in message ...
>>"Anuj" <anujm2000@hotmail.com> wrote in message
>>news:t3jlkdmaeoku6a@corp.supernews.com...
>>> In the DOS prompt i have to write "PATH=/perl/bin" always
>>> before running the script and then writing the initializing command
>>> i.e "perl hello.pl" ( An example file hello.pl) . Is there a way that i
>>> dont need to always write the PATH=/perl/bin command so that i can
>>> directly run the scripts from the DOS prompt by typing "perl hello.pl".
>>
>>edit autoexec.bat and add the line:
>>
>>SET PATH=%PATH%;C:\perl\bin
I find it hard to fathom why you chose to follow up to this post with
the stuff below. I am sure there is some reason somewhere.
> slight mod though
>
> I recently went through the perl install from scratch and the more I
> read the more it seems to me that there should be a BIG RED WARNING
> during perl install - "Install this product into /usr/bin/perl, it's a
> *nix convention but you'll save yourself some pain in future if you do
> this". Or am I wrong ?
You are wrong. The ocnvention in most cases would be /usr/local, and
some systems have it installed in /usr. I always install in
/opt/perl-$VERSION. I've seen many other places.
The convention under Unix is that you should be able to install software
anywhere you want.
Perl for Windows installs anywhere you want it too. All the versions of
Perl I've ever seen on DOS-derived OSes were installed in various
places, c:\perl being the most frequently used.
How would it help to install it in the equivalent of /usr? You'd still
have to set your environment up correctly.
> I'm just glad it was almost time for the regular "deltree windows" on
> this box.
If you don't like Windows, why use it?
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Sat, 16 Dec 2000 08:01:36 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: Perl programming
Message-Id: <AjF_5.20379$xW4.159898@news-server.bigpond.net.au>
Martien Verbruggen wrote in message ...
>[Please, in the future, put your reply _after_ the text you reply to.
>It's the convention on this group, and Usenet in general, and makes your
>post much easier to read]
I leave arguments about jeopardy posting to people who can't understand that
the great majority of newsgroup users are using a newsreader with a preview
pane and capable of 'threading'. I find it amusing that you 'jeopardied'
this comment.
For best context integrity interspersed replies should be used.
As someone who has used newsgroup type services since their (indirect)
developement from newswire services (25 years ago) where the accepted format
was:
Attention/Greetings
Summary
rgds
Quoted Text Follows
I find the contention that "reply after inclusion" is 'correct' to be
amusing also.
Ignore me, but I won't try to enforce my preference on you.
>
>On Sat, 16 Dec 2000 03:24:50 GMT,
> SuperGumby <tick.toff@spam.com> wrote:
>
>[article reformaotted and reordered]
>
>> Jay Flaherty wrote in message ...
>>>"Anuj" <anujm2000@hotmail.com> wrote in message
>>>news:t3jlkdmaeoku6a@corp.supernews.com...
>>>> In the DOS prompt i have to write "PATH=/perl/bin" always
>>>> before running the script and then writing the initializing command
>>>> i.e "perl hello.pl" ( An example file hello.pl) . Is there a way that i
>>>> dont need to always write the PATH=/perl/bin command so that i can
>>>> directly run the scripts from the DOS prompt by typing "perl hello.pl".
>>>
>>>edit autoexec.bat and add the line:
>>>
>>>SET PATH=%PATH%;C:\perl\bin
>
>I find it hard to fathom why you chose to follow up to this post with
>the stuff below. I am sure there is some reason somewhere.
>
>> slight mod though
>>
>> I recently went through the perl install from scratch and the more I
>> read the more it seems to me that there should be a BIG RED WARNING
>> during perl install - "Install this product into /usr/bin/perl, it's a
>> *nix convention but you'll save yourself some pain in future if you do
>> this". Or am I wrong ?
>
>You are wrong. The ocnvention in most cases would be /usr/local, and
>some systems have it installed in /usr. I always install in
>/opt/perl-$VERSION. I've seen many other places.
I did ask "Or am I wrong ?". Possibly due to some recent scripts I had
viewed referring to /usr/bin/perl I did not think to ask if it should be
/usr/local/bin/perl or maybe usr/local/perl.
Maybe I should have prefaced the whole thing with (a usually redundant)
IMHO.
The reason I have formed this opinion is that I expect to move scripts
between the system I develop on (Win 9x/NT) and *nix. As you suggest, Win32
will accept installation to any path, as it seems will *nix. My idea is that
the first line of scripts "#!/usr/bin/perl" (cut and pasted from a quick
yahoo search on "bin perl") has more significance to *nix systems than
Win32, so by installing using a *nix paradigm I may lessen the changes
required to move a script between OS's.
>
>The convention under Unix is that you should be able to install software
>anywhere you want.
>
>Perl for Windows installs anywhere you want it too. All the versions of
>Perl I've ever seen on DOS-derived OSes were installed in various
>places, c:\perl being the most frequently used.
>
>How would it help to install it in the equivalent of /usr? You'd still
>have to set your environment up correctly.
>
>> I'm just glad it was almost time for the regular "deltree windows" on
>> this box.
>
>If you don't like Windows, why use it?
Who said I don't like it ? I am required to look at a lot of software and
this leads to unnecessary clutter of the registry and the existence of files
which are no longer required (eg .dll's) on the system. Takes me about 40
minutes to return the system to a 'base' install (from image). But this is
not the forum to debate OS choices.
>
>Martien
>--
>Martien Verbruggen | Since light travels faster than
>Interactive Media Division | sound, isn't that why some people
>Commercial Dynamics Pty. Ltd. | appear bright until you hear them
>NSW, Australia | speak?
------------------------------
Date: Fri, 15 Dec 2000 21:58:34 -0600
From: "John Michael" <johnm@acadiacom.net>
Subject: Re: Pulling content from a HTML doc
Message-Id: <3a3ae995@news.acadiacom.net>
Say the page you want to do this on is named sample.html
use an server side include exec cgi line on a blank page that will run the
script
name the page sample.html
On your original sample.html page Put what you want to retrieve like so
<!--
%%NEXT_LINE%%
information you want to retrieve
-->
Put the page in a directory somewhere to act as a template.
THe script runs from the server side include when someone wants to view it.
Read in the page requested from your template directory,
get the line following
%%NEXT_LINE%%
do what you want with your info
and print out the template page.
OR
Easier
add this to the page
<img src="http://yourdomain.com/cgi-bin/script.pl?info=whatever you want to
get"
point it to your cgi script
grab the query string
send back the location of the clear image gif.
cya
John Michael
http://realtimescipts.com
"Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
news:t3lcfprf2inbf6@corp.supernews.com...
> Hello,
>
> This is probably simple but it has me stumped. What Id like to do is
> take a HTML document (one thats on my server, not another website) and
> insert comments in it. like :
>
> <!--CONTENT-->
> Content to be retrieved here
> <!--CONTENT-->
>
> And then have the script grab everything between the two <!--CONTENT-->
> lines. Can someone post a little sample of code that would be able to do
> this?
>
> Thanks in advance!
>
>
------------------------------
Date: Fri, 15 Dec 2000 22:21:08 -0600
From: "Hawk" <someguyREMOVE@REMOVEsunflower.com>
Subject: Re: Pulling content from a HTML doc
Message-Id: <t3lrg3bbqdai67@corp.supernews.com>
Thats the problem. I don't have the slightest idea how to get the data from
the page! What Im looking for is a little snippet of code that will fetch
anything between <!--CONTENT--> and <!--CONTENT END--> or whatever
"delimiters" I decide to use.
John Michael <johnm@acadiacom.net> wrote in message
news:3a3ae995@news.acadiacom.net...
> Say the page you want to do this on is named sample.html
> use an server side include exec cgi line on a blank page that will run the
> script
> name the page sample.html
>
> On your original sample.html page Put what you want to retrieve like so
> <!--
> %%NEXT_LINE%%
> information you want to retrieve
> -->
> Put the page in a directory somewhere to act as a template.
> THe script runs from the server side include when someone wants to view
it.
> Read in the page requested from your template directory,
> get the line following
> %%NEXT_LINE%%
>
> do what you want with your info
> and print out the template page.
>
> OR
> Easier
> add this to the page
> <img src="http://yourdomain.com/cgi-bin/script.pl?info=whatever you want
to
> get"
>
> point it to your cgi script
> grab the query string
> send back the location of the clear image gif.
> cya
> John Michael
> http://realtimescipts.com
>
>
> "Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
> news:t3lcfprf2inbf6@corp.supernews.com...
> > Hello,
> >
> > This is probably simple but it has me stumped. What Id like to do is
> > take a HTML document (one thats on my server, not another website) and
> > insert comments in it. like :
> >
> > <!--CONTENT-->
> > Content to be retrieved here
> > <!--CONTENT-->
> >
> > And then have the script grab everything between the two <!--CONTENT-->
> > lines. Can someone post a little sample of code that would be able to do
> > this?
> >
> > Thanks in advance!
> >
> >
>
>
------------------------------
Date: 15 Dec 2000 23:24:34 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Pulling content from a HTML doc
Message-Id: <1ry9xh3pm5.fsf@video.bsd.uchicago.edu>
>>>>> "Hawk" == Hawk <someguyREMOVE@REMOVEsunflower.com> writes:
Hawk> Thats the problem. I don't have the slightest idea how to
Hawk> get the data from the page! What Im looking for is a little
Hawk> snippet of code that will fetch anything between
Hawk> <!--CONTENT--> and <!--CONTENT END--> or whatever
Hawk> "delimiters" I decide to use.
If you are willing to settle for a standard HTML delimiter pair like
<silliness> This is a test </silliness>
then the following will work for you (after installing HTML::Parser
from CPAN):
#!/usr/bin/perl -w
# Extract special delimited text from an HTML file
# usage: testParse file.html
use strict;
use HTML::Parser 3.00 ();
my %inside;
sub tag
{
my($tag, $num) = @_;
$inside{$tag} += $num;
}
sub text
{
return unless $inside{silliness};
print $_[0], "\n";
}
my $p = HTML::Parser->new(api_version => 3,
handlers => [start => [\&tag, "tagname, '+1'"],
end => [\&tag, "tagname, '-1'"],
text => [\&text, "dtext"],
],
marked_sections => 1,
);
$p->parse_file(shift) || die "Can't open file: $!\n";
------------------------------
Date: Fri, 15 Dec 2000 23:09:08 -0600
From: "John Michael" <johnm@acadiacom.net>
Subject: Re: Pulling content from a HTML doc
Message-Id: <3a3afa1f$1@news.acadiacom.net>
I told you how to do it.
It takes more than a snipplet of code and you will probably not get the
script written for you here. You are asking a for someone to do a job for
you. More infromation would be needed as well.
Sorry
"Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
news:t3lrg3bbqdai67@corp.supernews.com...
> Thats the problem. I don't have the slightest idea how to get the data
from
> the page! What Im looking for is a little snippet of code that will fetch
> anything between <!--CONTENT--> and <!--CONTENT END--> or whatever
> "delimiters" I decide to use.
>
> John Michael <johnm@acadiacom.net> wrote in message
> news:3a3ae995@news.acadiacom.net...
> > Say the page you want to do this on is named sample.html
> > use an server side include exec cgi line on a blank page that will run
the
> > script
> > name the page sample.html
> >
> > On your original sample.html page Put what you want to retrieve like so
> > <!--
> > %%NEXT_LINE%%
> > information you want to retrieve
> > -->
> > Put the page in a directory somewhere to act as a template.
> > THe script runs from the server side include when someone wants to view
> it.
> > Read in the page requested from your template directory,
> > get the line following
> > %%NEXT_LINE%%
> >
> > do what you want with your info
> > and print out the template page.
> >
> > OR
> > Easier
> > add this to the page
> > <img src="http://yourdomain.com/cgi-bin/script.pl?info=whatever you want
> to
> > get"
> >
> > point it to your cgi script
> > grab the query string
> > send back the location of the clear image gif.
> > cya
> > John Michael
> > http://realtimescipts.com
> >
> >
> > "Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
> > news:t3lcfprf2inbf6@corp.supernews.com...
> > > Hello,
> > >
> > > This is probably simple but it has me stumped. What Id like to do
is
> > > take a HTML document (one thats on my server, not another website) and
> > > insert comments in it. like :
> > >
> > > <!--CONTENT-->
> > > Content to be retrieved here
> > > <!--CONTENT-->
> > >
> > > And then have the script grab everything between the two
<!--CONTENT-->
> > > lines. Can someone post a little sample of code that would be able to
do
> > > this?
> > >
> > > Thanks in advance!
> > >
> > >
> >
> >
>
>
------------------------------
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 V9 Issue 5128
**************************************