[8714] in Perl-Users-Digest
Perl-Users Digest, Issue: 2331 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 15 19:07:36 1998
Date: Wed, 15 Apr 98 16:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 15 Apr 1998 Volume: 8 Number: 2331
Today's topics:
Re: ANSI escape codes interpretation <ebohlman@netcom.com>
Re: Can I do this: <A HREF=laughs.pl?@laughs> <bmb@ginger.libs.uga.edu>
Re: Can I do this: <A HREF=laughs.pl?@laughs> <rootbeer@teleport.com>
Re: Can I do this: <A HREF=laughs.pl?@laughs> <bmb@ginger.libs.uga.edu>
Re: Can someone give me an example of rounding! (Abigail)
Re: considerations for global variables? <jdporter@min.net>
Content-Length with mailx <dbcoder@juno.com>
emacs info files for Perl 5.004 indhiraa@hotmail.com
Re: Email Sender (Neil Briscoe)
Embedding Perl in Java <nawwar@kananews.com>
Formatting script for Perl5... (jeff)
Re: Hash of Arrays <rootbeer@teleport.com>
Re: Hash of Arrays (Craig Berry)
Re: Hash of Arrays <quentin@jihad.amd.com>
Re: HELP: exec($prog) or die "exec failed"; <rootbeer@teleport.com>
Help: to eliminate eval() on a HTML Filling script. <tkho@technologist.com>
Re: how to post to usenet with a perl cgi... <jdporter@min.net>
IIS 4.0, PW32i316, CGI Programs mkirsch@didax.com
Re: looking for a good win32 perl editor. <tony@cyberscape.net>
Re: Match \/ ? (Craig Berry)
Memory Leak? Embedding into C <sdh1@anchor.hotmail.com>
Re: Memory Leak? Embedding into C (Ken Fox)
Re: OOPS and several parents (Daniel)
Re: PERL and Win32 email (Neil Briscoe)
Perl USer Group in Atlanta <sboss@ksumail.kennesaw.edu>
Problem building perl on HPUX 10.20 <mfrost@horizsys.com>
Re: problems with crypt <quentin@jihad.amd.com>
Re: Transferring 'Date/Time' Datatype from Access to Or (John D Groenveld)
visible in debugger, but not output <joelb@docent.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Apr 1998 21:25:54 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: ANSI escape codes interpretation
Message-Id: <ebohlmanErH4v6.GM4@netcom.com>
Keizer <keizer@xs1.xs4all.nl> wrote:
: We are reading some input containing ANsi positions codes like
: ^]10;20H
: the numbers 10 and 20 are positions on the screen.
: We are using perl for win32 and are looking for a way to
: position the cursor according to the coordinates just mentioned
: without using ansi.sys .
You might want to look into the Win32::Console module.
------------------------------
Date: Wed, 15 Apr 1998 16:23:24 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Can I do this: <A HREF=laughs.pl?@laughs>
Message-Id: <Pine.A41.3.96.980415161002.77314B-100000@ginger.libs.uga.edu>
Regarding:
@laughs = qw (hoho, hehe, haha);
<A HREF = 'laughs.pl?@laughs'> Print Laughs </A>;
I doubt this is in your initial program--it creates all kinds of error
messages when I try to run it. Perhaps you should cut and paste the
actual code.
Having said that, try:
### program 1 snippet:
@laughs = qw (hoho hehe haha);
print "<A HREF=\"laughs.pl?@laughs\"> Print Laughs </A>\n";
### program 2 snippet:
@laughlist = split( " ", $ENV{ 'QUERY_STRING' } );
Brad Baxter
UGA
On Wed, 15 Apr 1998, Anu N. Melkote wrote:
> Greeting Everybody !
> I am trying to pass an array from one perl script and retreving it with
> QUERY_STRING in another perl script. I am doing something like this:
>
> In the initial perl pgm:
> @laughs = qw (hoho, hehe, haha);
> <A HREF = 'laughs.pl?@laughs'> Print Laughs </A>;
>
> In laughs.pl I am trying to read the array via QUERY_STRING:
> @laughlist = $ENV{'QUERY_STRING'};
>
> Now, if I print @laughlist, I see only the first element in the array
> "hoho"
> However, in the URL I can see all the elements like this:
> http://......./laughs.pl? hoho hehe haha
>
> How can I grab all elements of the array I passed? Thanks in advance !
>
> Regards,
> Anu Melkote
>
>
------------------------------
Date: Wed, 15 Apr 1998 20:30:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "Anu N. Melkote" <amelkote@ford.com>
Subject: Re: Can I do this: <A HREF=laughs.pl?@laughs>
Message-Id: <Pine.GSO.3.96.980415132805.8954N-100000@user2.teleport.com>
On Wed, 15 Apr 1998, Anu N. Melkote wrote:
> In the initial perl pgm:
> @laughs = qw (hoho, hehe, haha);
> <A HREF = 'laughs.pl?@laughs'> Print Laughs </A>;
That's not valid Perl code. Perl is not HTML!
The methods of perlipc may be of some help to you. If you wish to call a
CGI script, you may need to read the CGI standard, too. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 15 Apr 1998 17:04:34 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Can I do this: <A HREF=laughs.pl?@laughs>
Message-Id: <Pine.A41.3.96.980415165736.77442B-100000@ginger.libs.uga.edu>
I realize it's bad form to reply to my own mail :-)
However, I'd like to change my note to read:
### program 1 snippet:
@laughs = qw (hoho hehe haha);
$" = "+"; ### special variable--be careful
print "<A HREF=\"laughs.pl?@laughs\"> Print Laughs </A>\n";
$" = " "; ### put it back to "normal"
### program 2 snippet:
@laughlist = split( /\+/, $ENV{ 'QUERY_STRING' } );
Please keep in mind that this is *crude*. Using a module like
CGI.pm is the Right Thing to do.
Brad Baxter
UGA
------------------------------
Date: 15 Apr 1998 22:05:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Can someone give me an example of rounding!
Message-Id: <6h3avu$gfb$1@client2.news.psi.net>
susan cassidy (susanc@news.SanDiegoCA.ncr.COM) wrote on MDCLXXXVIII
September MCMXCIII in <URL: news:6h2b3h$qth@ssd3450.SanDiegoCA.NCR.COM>:
++
++ Just a caveat, I have seen many postings in this news group recommending
++ that people use sprintf/printf to round numbers. Sprintf/printf will not,
++ by themselves round anything. They will truncate, which is entirely
++ different. Normally you have to add half of the rightmost decimal
++ position to round to one less position. E.g. if you have a number like
++ 12.16, and you want to round to 12.2, you have to add .005 before
++ truncating to 1 position after the decimal.
Did you actually *try* this out?
You are wrong, twice.
Observe:
$ perl -we 'printf "%3.1f\n", 12.16'
12.2
$ echo "12.16 + 0.005" | bc -l
12.165
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Wed, 15 Apr 1998 21:00:50 GMT
From: John Porter <jdporter@min.net>
Subject: Re: considerations for global variables?
Message-Id: <35352170.2E3C@min.net>
Dan Baker wrote:
>
> well... that's why I put it in quotes. I couldn't think of a better way
> to put it. Perhaps a better way would be a "persistant variable".
Even then you'd need quotes, because variables don't persist; data
persists. (Using tie, you can make it look like variables are
persisting; but it's an illusion.)
> I expect that in my particular application I will need a stateless way
> to store variables
That makes your (multi-script) application stateful, not stateless.
You're storing state.
> to fake passing between perls scripts that are fired up
> as separate standalone sripts driven from an html "interface". The
> scripts can't be in a single process in this particular application. I
> think I'll need to write/read a text file...
Well now, if WWW is the context of your application... have you
considered using cookies? Might be a nice elegant solution to
the problem of passing state from one cgi program to the next.
hth,
John Porter
------------------------------
Date: Wed, 15 Apr 1998 14:15:19 -0700
From: "Database Coder" <dbcoder@juno.com>
Subject: Content-Length with mailx
Message-Id: <6h382h$49p$1@news.scruz.net>
I wrote a small perl script that uses mailx to send email. The body of the
message is read from a text file. When the message is received the first
line of the body contains "Content-Length: 805" even thought the string
that contains the body text at the time it is sent to mailx does not contain
that line. Is there a way to get rid of it?
Mike
------------------------------
Date: Wed, 15 Apr 1998 16:24:56 -0600
From: indhiraa@hotmail.com
Subject: emacs info files for Perl 5.004
Message-Id: <6h38j8$ta8$1@nnrp1.dejanews.com>
Hi,
Where can I find emacs-info files for Perl 5.004 documentation.
Or how can I generate one.
Thanks,
Indira.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 15 Apr 1998 20:09:46 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Email Sender
Message-Id: <memo.19980415210945.33285C@skep.compulink.co.uk.cix.co.uk>
In article <Pine.GSO.3.96.980415114715.8954F-100000@user2.teleport.com>,
rootbeer@teleport.com (Tom Phoenix) wrote:
> On Wed, 15 Apr 1998, Lixo wrote:
>
> > system ("mail $email -s \"subject\" < file.txt");
> >
> > It works but the sender of this message is always "Nobody" that is the
> > default user for someone who uses it by HTML pages.
> > The script file belongs to "WWW" user, and I would like it to be the
> > sender.
>
> If you're using the proper commands to run another program from perl,
> but
> the other program doesn't cooperate, then it's the other program's
> fault.
> If you're not using the proper commands, then it's your fault. If you
> aren't sure about the proper commands, you should read the program's
> documentation. If you've read it and you're still not sure, you should
> ask
> in a newsgroup about the program.
>
> Hope this helps!
Oh dear - Tom's had a hard day - so much so - that he's forgotten to hide
his address behind his new anti-spamming barrier - possibly because of
your subject matter. ;-))
Try doing something like this :-
open(MAIL, "| /usr/lib/sendmail -t")
|| die "Mail isn't where expected: $!\n";
select(MAIL); $|=1;
print "To: someone@somewhere.com\n";
print "From: me@here.com\n";
print "Subject: Look mum no hands ;-))\n\n"; # Note the double newline.
print "Interesting chatty stuff goes here\n";
print "Ad infinitum.\n";
print ".\n";
close(MAIL);
I hope this helps.
Regards
Neil
------------------------------
Date: Wed, 15 Apr 1998 14:34:30 -0700
From: "Nawwar Kasrawi" <nawwar@kananews.com>
Subject: Embedding Perl in Java
Message-Id: <6h38pd$gjc$1@news.nanospace.com>
I'm wondering if anybody has successfully embedded Perl in Java. I'm
struggling trying to figure out how to do it. Right now I'm think about how
to call perl300.dll from Java using RNI.
Any ideas?
Thanks,
Nawwar
------------------------------
Date: Wed, 15 Apr 1998 22:43:06 GMT
From: jeff@extrapoint.com (jeff)
Subject: Formatting script for Perl5...
Message-Id: <353537e5.3243279@news.secoast.net>
Hi,
I saw once somewhere a script that would format a perl program. It
would line up all of the braces, and "beutify" the whole program. Now
I can't find it, and I have to look through someones code who was
really sloppy. Where can I find a pre-done script to do this??
Thanks in advance!
Jeff
jeff@extrapoint.com
------------------------------
Date: Wed, 15 Apr 1998 20:04:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Ovanes Manucharyan <olm@email.csun.edu>
Subject: Re: Hash of Arrays
Message-Id: <Pine.GSO.3.96.980415130330.8954L-100000@user2.teleport.com>
On Wed, 15 Apr 1998, Ovanes Manucharyan wrote:
> How can I create a hash of Arrays.
Check out perlref, perllol, and perldsc.
> @HASH{$index}=@array;
Turn on warnings, and perl will tell you a better way to write that. If,
of course, that's what you want. :-) Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 15 Apr 1998 19:51:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Hash of Arrays
Message-Id: <6h333k$b0o$3@marina.cinenet.net>
Ovanes Manucharyan (olm@email.csun.edu) wrote:
: How can I create a hash of Arrays.
: For example, will this work?
:
: @HASH{$index}=@array;
That's a hash slice, almost certainly not what you want. Change the
initial @ to $.
: Do I need to create this data type? I tried to use this in my code and
: it only stores the first element of the @array, am I doing something
: wrong??
Well, yes, since it's not working. :) Both the keys and values of hashes
must be scalars; there's no way to insert a list directly. However,
since references are scalars, you can freely use those (for the value
part, anyway, there are issues with refs as keys). So, in your example,
you could do
$HASH{$index} = [ @array ]; # [] is array ref building syntax.
then access elements like this
$foo = $HASH{$index}[4];
which is really just a convenient shorthand for
$foo = $HASH{$index}->[4];
HTH...
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 15 Apr 1998 14:43:05 -0500
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: Hash of Arrays
Message-Id: <ximzphmeura.fsf@jihad.amd.com>
>>>>> "Ovanes" == Ovanes Manucharyan <olm@email.csun.edu> writes:
Ovanes> How can I create a hash of Arrays. For example, will this
Check out perldsc(1), the Perl Data Structures Cookbook.
Under the Code Examples section you can find code that
creates and accesses hashes of arrays.
Also available via
perldoc perldsc
--
Quentin Fennessy AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals
------------------------------
Date: Wed, 15 Apr 1998 20:02:55 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: PETER SZWEDYK <peter.szwedyk@eq.gs.com>
Subject: Re: HELP: exec($prog) or die "exec failed";
Message-Id: <Pine.GSO.3.96.980415130029.8954K-100000@user2.teleport.com>
On Wed, 15 Apr 1998, PETER SZWEDYK wrote:
> When I waitpid for exec to finish, I can check $? for child error, BUT
> WHAT IF I DON'T waitpid? In this case, $? is always 0, even if exec
> failed.
>
> HOW CAN I CATCH THE die "exec failed" back in the parent program?
What if YOU DON'T PUT WORDS in ALL CAPS? :-)
Here's one idea. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
#!/usr/bin/perl -w
use strict;
use Fcntl;
sub launch_or_why_not {
# This sub should launch a process, or should return
# an error message telling what went wrong.
#
# Return values:
# A number is the child's pid.
# A string is the error message.
my @prog = @_;
return "No program name given" unless @prog;
my($pid, $tries);
local(*R, *W);
pipe(R,W) or die "Can't make pipe: $!";
{
unless (defined($pid = fork)) {
if (++$tries > 5) {
return "fork keeps failing: $!";
}
sleep 3;
redo;
}
}
if ($pid) {
# parent here
close W;
my $message = join '', <R>;
close R;
return $message if $message;
return $pid;
} else {
# child here
unless (fcntl W, F_SETFD, FD_CLOEXEC) {
print W "fcntl failed: $!";
exit;
}
{
local($^W); # Don't warn about this failing...
exec @prog;
}
print W "Exec failed: $!";
exit;
}
}
my @programs = (
[ 'murglTroyd does not exist' ],
[ qw'murglTroyd does not exist' ],
[ ],
[ 'uptime' ],
[ 'echo All okay here' ],
[ qw'echo All okay here' ],
[ 'echo', 'All okay here' ],
[ 'perl', '-e', 'print "A-okay here\\n"' ],
[ 'exit 0' ],
[ '/bin/sh', '-c', 'exit 0' ],
);
$| = 1;
for (@programs) {
my $mess = launch_or_why_not @$_;
print "\nProgram @{[ map qq('$_'), @$_ ]} returned $mess\n\n";
}
__END__
------------------------------
Date: Wed, 15 Apr 1998 14:47:35 -0700
From: Tommy <tkho@technologist.com>
Subject: Help: to eliminate eval() on a HTML Filling script.
Message-Id: <35352AF7.BD02EBC3@technologist.com>
I have a problem on eliminating the eval() that slow down the script.
Can anyone help.
What my script does is turn lines of a template file like:
<B>today's date is $date</B><BR>
What you have just enter on field "Home" is "$IN{Home}"<BR>
to:
<B>today's date is 04/11/97</B><BR>
What you have just enter on field "Home" is "Value From HTML form"<BR>
if the perl have stored variable
$date= "04/11/97";
$IN{Home}= "Value From HTML form";
The major problem is the speed of eval() of the following lines:
if ($L=~ /\$/) { # foreach chomp line
$L=~ s/\"/\\\"/g; # replace " to \"
$L=~ s/\;/\\\;/g; # replace ; to \;
$L=~ s/\@/\\\@/g; # replace @ to \@
$L=~ s/\&/\\\&/g; # replace & to \& because of " ", etc.
$L= "\"$L\"\n"; # put quote on ends
print eval($L); # print the eval()- slooooooooooow.
} else {
print "$L\n"; # print normal line
}
Is there a way to eliminate the eval()?
I know there is a FillIn.pm basically do the same thing, however, I
would like to know how to solve this problem.
Thank you in advance.
------------------------------
Date: Wed, 15 Apr 1998 20:55:39 GMT
From: John Porter <jdporter@min.net>
Subject: Re: how to post to usenet with a perl cgi...
Message-Id: <35352039.72A5@min.net>
Brian Mathis wrote:
>
> Matthew D. Healy, Ph.D. wrote:
> > auctionmaster@auctionaddict.com wrote in message
> > <6h0bji$qqg$1@nnrp1.dejanews.com>...
> > >does anyone know of any scripts that will post to usenet via cgi written in
> > >perl?
> >
> > Please explain why -- OTHER THAN SPAMMING -- you wish to do this.
> >
> > I fervently hope nobody here will be foolish enough to answer this
> > unless a convincing answer is forthcoming!
>
> Um, I do believe that something like "dejanews" is an application of
> this, and it's quite useful if you don't have access to a news server.
> Just one example.
So you're suggesting that Matthew go get the programs that make
DejaNews work? Not likely to happen.
To "post to usenet", you need a new (nntp) server, and your perl
program needs to talk to it. That's what the Net::NNTP module (or
News::NNTPClient) is for.
If one doesn't have an nntp server (questionable, since he was
able manually to post to clpm), one could automate a posting via
DejaNews, using http. That's where LWP::UserAgent comes in handy.
hth,
John Porter
------------------------------
Date: Wed, 15 Apr 1998 15:58:59 -0600
From: mkirsch@didax.com
Subject: IIS 4.0, PW32i316, CGI Programs
Message-Id: <6h372i$qbu$1@nnrp1.dejanews.com>
Problem 1:
Perlis.dll does not pass command line arguments correctly via the web. That
is, invoking the URL
http://www.myserver.com/myprogram.pl?Argument1&Argument2...&Argumentn
causes the myprogram.pl to execute, but @ARGV is empty.
Problem 2:
The association of .pl with %perldir%\bin\perl.exe %s %s does not work as
advertised. Perl is invoked, but just sits there without doing anything -- we
are guessing that no arguments are being passed in via the %s %s.
Does anyone know the solution to either of the above problems (we really want
to see problem 1 solved, since it is so much more efficient to use perlis.dll
than perl.exe via the web)?
Thanks for any help in this.
Mitch Kirsch
mkirsch@didax.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 15 Apr 1998 22:56:46 +0100
From: "Tony Kenny" <tony@cyberscape.net>
Subject: Re: looking for a good win32 perl editor.
Message-Id: <6h3afh$in0$1@svr-c-02.core.theplanet.net>
Charles Engelke wrote in message <35326F3C.4C5@ibm.net>...
>James wrote:
>>
>> Hello all,
>>
>> I'm ready to pull my hair out.
>>
>> Any suggestions?
>>
>> jamesht@idt.net
>
A lot of suggestions eh? I will look at some myself.
In the meantime, I use 'Ed For Windows' which has syntax colouring for a lot
of languages including perl and lots of features. It is at
http://www.getsoft.com/
Anyone know of a Perl editor that i can say 'I want a program to do....' and
it will do it all for me? Now that will be good! :))
~Tony--
------------------------------
Date: 15 Apr 1998 19:53:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Match \/ ?
Message-Id: <6h338m$b0o$4@marina.cinenet.net>
cotal@delphi.com wrote:
: What syntax would you use to match \/, as in abc\/def
Why, /\\\//, of course! :) If you're not a fan of LTS (leaning toothpick
syndrome), you can choose a different delimiter and get a significantly
simpler-looking regex: m!\\/!
HTH!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Wed, 15 Apr 1998 17:04:49 -0400
From: "Scott" <sdh1@anchor.hotmail.com>
Subject: Memory Leak? Embedding into C
Message-Id: <6h37j7$jnu$1@camel29.mindspring.com>
I'm trying to embed the perl interpreter into C, but I'm running into a
major memory leak.
If I take the following code:
static PerlInterpreter *my_perl;
int test(void)
{
my_perl = perl_alloc();
perl_free(my_perl);
}
I don't have a memory leak, but if I make it:
int test(void)
{
my_perl = perl_alloc();
perl_construct(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
}
it leaks like a sieve. I'm not sure what the leak is per call, but I've
seen the process grow
from 2.5 megs to 87 megs in a matter of seconds. Obviously there is a bunch
of other code
involved, but the memory leak starts as soon as I un-comment the middle
lines.
What I'm up to is trying to compile perl into a command interpreter on an
HP/UX 10.2
system (a B180). I've gotten everything to work except for the memory leak
problem. I'm
using Perl 5.004_04 for PA_RISC1.1.
Am I doing something wrong, or is this a "feature" of perl?
Thanks,
-Scott Hall
(drop the anchor to reply by e-mail)
------------------------------
Date: 15 Apr 1998 22:16:43 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Memory Leak? Embedding into C
Message-Id: <6h3bkb$jm33@eccws1.dearborn.ford.com>
<sdh1@anchor.hotmail.com> writes (using a munged From: address ;):
> I'm trying to embed the perl interpreter into C, but I'm running into
> a major memory leak.
>
> ...
>
> int test(void)
> {
> my_perl = perl_alloc();
> perl_construct(my_perl);
> perl_destruct(my_perl);
> perl_free(my_perl);
> }
>
> it leaks like a sieve.
I assume you are calling this in a loop. The "normal" way to use
embedded perl is to create one perl interpreter and then share it among
all the places you need to. In your case, it looks like you should
change to something like:
PerlInterpreter *my_perl;
int test_initialize(void)
{
my_perl = perl_alloc();
perl_construct(my_perl);
}
int test_cleanup(void)
{
perl_destruct(my_perl);
perl_free(my_perl);
}
int test(void)
{
}
There's a whole lot of other stuff (like error checking and calling
perl_parse() etc.) that needs to be done, but I assume you already
know that.
BTW, I'm running 5.004_04 on SunOS 5.5.1 and if I do a tight loop
of your original test() function it leaks like a sieve here too. My
perl doesn't use MULTIPLICITY -- that might make a difference. Anybody
know if the development track has this problem?
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: 15 Apr 1998 22:17:27 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Re: OOPS and several parents
Message-Id: <6h3bln$f63$1@nntpd.lkg.dec.com>
>
>package something;
>@something::ISA = qw( second extra );
>sub new {
> my $pkg = shift;
> my $second = new second;
> my $extra = new extra;
> my $self = bless {
> %$second,
> %$extra,
> cost => 'high',
> @_
> }, $pkg;
>};
>
>
>hth,
>John Porter
John, thanks for the help. Your code works
well but I'm still looking for more automation.
What if I didn't know the number of parents?
$#something::ISA gives me the number of items
in ISA but how can I convert something::new
so that it reblesses the hash references
from all it (unknown number of) parents?
For example, if package extra had a function
package extra;
sub twiddleData {
my $self = shift;
$self->{ state } = "unknown";
};
and I did
package main;
my $thing = new something;
$thing->twiddleData();
this would work only if I knew that
package extra was a parent of package
something.
What I'm looking for is something like
package something;
sub new {
my $self = shift;
my $r = {};
my $temp;
foreach( item in ISA ){
$temp = new ( ith item in ISA );
$r = $r + ( ref to $temp hash items );
};
bless { %$r, @_ ), $self;
};
And can it be made to work when a parent of
package something has more than one key/value
pair in its hash reference?
Or am I trying to force Perl into being C++?
-Daniel
------------------------------
Date: 15 Apr 1998 20:09:45 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: PERL and Win32 email
Message-Id: <memo.19980415210944.33285B@skep.compulink.co.uk.cix.co.uk>
In article <3533A656.2183@gecm.com>, jim.michael@gecm.com (Jim Michael)
wrote:
> There is a 'net send' command for sending messages over your network but
> this is not really email. The SMTP module may be a better choice.
If you're using "Standard" win32 perl then the Net:SMTP module may be the
beast - I havn't got that module to work under Activestate perl - and so I
wrote a quick and dirty hack and provided it as a .pl file.
If you want it, I can send you smtp.zip - which contains the .pl file - a
quick test of that file - and if you really can't stand talking native
SMTP - it also contains linemail - which uses the smtp.pl to imitate the
action of Unix's sendmail -t.
Since I've now bought the Perl Resouce Kit (Unix Edition) - and as the
enclosed CDRom also includes a whole load of CPAN stuff - including both
Activestate and Standard Win32 perl - I'm going to experiment with
Net::SMTP and the Standard Perl distribution - and if that works - out
goes Activestate Perl - which I don't actually need because I don't use
IIS.
Regards
Neil
------------------------------
Date: Wed, 15 Apr 1998 16:42:23 -0400
From: Scott <sboss@ksumail.kennesaw.edu>
Subject: Perl USer Group in Atlanta
Message-Id: <35351BAF.E92@ksumail.kennesaw.edu>
Hello All..
I am looking to start a Perl Users Group in (metro-)Atlanta Georgia.
Anyone interested in help starting or joining, please email me at
sboss@technologist.com. I am looking for place(s) to meet, times
convient, and people. Any ideas or suggestions feel free to email me.
Scott Boss
email: sboss@technologist.com
------------------------------
Date: Wed, 15 Apr 1998 16:22:34 -0400
From: Mark Frost <mfrost@horizsys.com>
Subject: Problem building perl on HPUX 10.20
Message-Id: <3535170A.2DEB14F4@horizsys.com>
I'm trying to build perl 5.004-04 using gcc 2.8.1 under HPUX 10.20.
Most of the compilation goes fine, but it ends up showing me:
./miniperl configpm tmp
sh mv-if-diff tmp lib/Config.pm
File lib/Config.pm not changed
./miniperl -Ilib pod/pod2html.PL
Extracting pod2html (with variable substitutions)
./miniperl -Ilib pod/pod2latex.PL
Extracting pod2latex (with variable substitutions)
./miniperl -Ilib pod/pod2man.PL
Extracting pod2man (with variable substitutions)
./miniperl -Ilib pd/pod2text.PL
Extracting pod2text (with variable substitutions)
AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/Parsewords)
/bin/sh: 7072 Memory fault(coredump)
make: *** [preplibrary] Error 139
It would appear that this is miniperl core dumping when trying to
autosplit lib/Text/ParseWords.pm.
I was unable to find anything in the FAQ about this. Has someone else
perhaps come across this problem?
Thanks
------------------------------
Date: 15 Apr 1998 14:48:55 -0500
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: problems with crypt
Message-Id: <ximyax6euhk.fsf@jihad.amd.com>
>>>>> "Steven" == Steven Smith <steves@wco.com> writes:
Steven> I seem to be getting the same output from crypt for
Steven> differing clear text input. What's wrong here?
Steven-
Only the first 8 characters are used in the input text.
Check out crypt(3), or crypt(3c).
>From perldoc -f crypt:
=item crypt PLAINTEXT,SALT
Encrypts a string exactly like the crypt(3) function in the C library
(assuming that you actually have a version there that has not been
extirpated as a potential munition). This can prove useful for checking
the password file for lousy passwords, amongst other things. Only the
guys wearing white hats should do this.
--
Quentin Fennessy AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals
------------------------------
Date: 15 Apr 1998 16:45:04 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Transferring 'Date/Time' Datatype from Access to Oracle Using DBI
Message-Id: <6h368g$3dr$1@tholian.cse.psu.edu>
Whatever the Date/Time datatype is, you might be able to use the
Oracle TO_DATE function to convert it to Oracle.
Perhaps the Perl Date::Manip will help.
John
groenveld@acm.org
------------------------------
Date: Wed, 15 Apr 1998 14:46:23 -0700
From: Joel Bremson <joelb@docent.com>
Subject: visible in debugger, but not output
Message-Id: <35352AAF.139D0491@docent.com>
Hi,
I'm using Perl on NT for a CGI application. In the following code all
variables are visible using the debugger,
and the code runs correctly if run there, but otherwise the values of
%FORM cannot be printed to STDOUT or
a file.
Ideas?
sub parse_form
{
no strict;
open AFILE, ">\\Website\\cgi-shl\\url.txt" || spit ("ppp 112: $!");
select AFILE;
@fields = qw(terms boolean case course url);
for $field(@fields)
{
$FORM{$field} = $query->param($field) || undef;
print STDOUT "$FORM{$field} : $field\n"; # prints
':field_value'
}
$URL = $ENV{'QUERY_STRING'}; # %ENV does not appear to be
available
print "$FORM{'url'}----$FORM{'boolean'}-------$URL\n"; #prints
'--------------'
select STDOUT;
return \%FORM;
}# end sub parse_form
This is from the debugger. It is all as it should be.
DB<3> x %FORM
0 'boolean'
1 'OR'
2 'course'
3 'all'
4 'url'
5 'IBT120'
6 'terms'
7 'clarinet'
8 'case'
9 'Insensitive'
-Joel Bremson
joelb-at-docent.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2331
**************************************