[17077] in Perl-Users-Digest
Perl-Users Digest, Issue: 4489 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 09:12:30 2000
Date: Mon, 2 Oct 2000 06:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970492217-v9-i4489@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 2 Oct 2000 Volume: 9 Number: 4489
Today's topics:
Re: Is this is Regexp bug? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Re: Is this is Regexp bug? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Re: Is this is Regexp bug? <bart.lateur@skynet.be>
Re: Is this is Regexp bug? <glynFOOdwr@FSCKdeleteEmeD.co.uk>
LWP::UserAgent - wie entferne ich Header aus HTML-Datei <replynews@bigfoot.com>
Re: Newbie can't handle the "true"th... explanation de <lr@hpl.hp.com>
Re: Perl CGI <bart.lateur@skynet.be>
PLEASE HELPS! kily@my-deja.com
Re: Regex comparing street addresses <flavell@mail.cern.ch>
Result of functions in child processes <Torsten.Schindler@ccc.uni-erlangen.de>
Searching for an IDE <gy@fyuo.fjd>
sort files <calvin_newsgroup@hotmail.com>
Re: sort files (Rafael Garcia-Suarez)
Sorting of Form-Fields ??? <news@sinus-medien.de>
Re: Sorting of Form-Fields ??? (Rafael Garcia-Suarez)
Strange behaviour with @{...} <moell@ID-PRO.de>
Testing for non-numerics in a scalar (Steve)
Re: Testing for non-numerics in a scalar <brian+usenet@smithrenaud.com>
Re: Testing for non-numerics in a scalar <jeffp@crusoe.net>
use Perl instead (was: Need sed or awk solution for rec (Reinier Post)
Re: use Perl instead (was: Need sed or awk solution for (Rafael Garcia-Suarez)
Re: Win32::API needs help <wstsoi@netvigator.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 2 Oct 2000 09:17:17 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Is this is Regexp bug?
Message-Id: <guXB5.6239$uq5.141140@news6-win.server.ntlworld.com>
"Andrew N. McGuire " <anmcguire@ce.mediaone.net> wrote in message
news:Pine.LNX.4.21.0010020044560.1845-100000@hawk.ce.mediaone.net...
> I will let another validate whether what you have is a bug or not, as
> it is getting late, and I have to get some rest. However, if you are
> trying to validate an email address, do a perldoc -q email and read:
>
> How do I check a valid mail address?
>
> Also, not mentioned there is Abigail's RFC822::Address module, for which
> you will also need Parse::ReDescent.
>
> HTH.
Probably not - part of this SafePerl rubbish is that we can't run *any*
modules at all, or indeed almost anything else useful. I shall check the
perldoc, however. Cheers.
--
-=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Mon, 2 Oct 2000 09:18:42 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Is this is Regexp bug?
Message-Id: <BvXB5.6240$uq5.140823@news6-win.server.ntlworld.com>
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:39D773F3.9E2E7F2A@rochester.rr.com...
> > foreach (<DATA>) {
> > chomp $_;
> > if ($_ =~ /^[a-zA-Z0-9.\-]+@[a-z-A-Z0-9.\-]+/)
> >
> > print "$_ is valid\n";
> > } else {
> > print "$_ is invalid\n";
> > }
> > }
> > __DATA__
> > x@y.com
> > foo.bar@doo-bar.uk
> > foo@bar.com
> >
> > Which runs fine - they are all validated as valid email addresses (on
>
> Really??? It won't even compile. You need a { after the ) in the if
> statement.
Doh. Clearly, I am unable to even cut and paste between two windows. This
does not bode well for my future career...
> I don't know. Sounds like "SafePerl" has some problems. Are you
> certain his program is the same as your code above?
Yes, I have his entire script in front of me.
--
-=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Mon, 02 Oct 2000 11:01:49 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is this is Regexp bug?
Message-Id: <2pqgtscou2esb51u9gr6f65o8l5ohln15q@4ax.com>
Glyndwr wrote:
> if ($_ =~ /^[a-zA-Z0-9.\-]+@[a-z-A-Z0-9.\-]+/)
You forgot a backslash in front of the '@'.
--
Bart.
------------------------------
Date: Mon, 2 Oct 2000 12:18:26 +0100
From: "Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
Subject: Re: Is this is Regexp bug?
Message-Id: <48_B5.6775$L12.159475@news2-win.server.ntlworld.com>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:2pqgtscou2esb51u9gr6f65o8l5ohln15q@4ax.com...
> Glyndwr wrote:
>
> > if ($_ =~ /^[a-zA-Z0-9.\-]+@[a-z-A-Z0-9.\-]+/)
>
> You forgot a backslash in front of the '@'.
I didn't think '@' was a metacharacter in regexps? Mind you, I always have
trouble remembering what is and isn't a metacharacter...
/me digs out Perl Bookshelf CD
"The list of metacharacters is: \ | ( ) [ { ^ $ * + ? ."
So, possibly not that.
--
-=G=-
print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
Web: http://www.fscked.co.uk ICQ: 66545073
------------------------------
Date: Mon, 2 Oct 2000 13:58:26 +0200
From: "Ralf Siedow" <replynews@bigfoot.com>
Subject: LWP::UserAgent - wie entferne ich Header aus HTML-Datei
Message-Id: <8r9t8p$h8eo8$1@ID-23826.news.cis.dfn.de>
Hallo,
wenn ich mit LWP::UserAgent einen HTML-Seite laden, dann habe ich immer
Header dieser Art in meiner HTML-Datei:
HTTP/1.1 200 OK
Cache-Control: private
Date: Mon, 02 Oct 2000 11:54:26 GMT
Server: Microsoft-IIS/4.0
Content-Type: text/html
Client-Date: Mon, 02 Oct 2000 11:54:31 GMT
Client-Peer: 212.105.204.195:80
Link: <../shared/styles.css>; rel="stylesheet"
Set-Cookie: ASPSESSIONIDQGQQQQEI=FCNFDFJDKDGPLCJEJADPONJG; path=/
Title: Premiere Analog
Gibt es eine Funktion mit der diese unterdrückt werden oder ist die einzige
Möglichkeit die wegzubekommen das Abschneiden der ersten x Zeilen?
cu Ralf
------------------------------
Date: Mon, 2 Oct 2000 00:31:15 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <MPG.1441d99b9692e8aa98ade7@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <8r8af2$lh2$1@charm.magnus.acs.ohio-state.edu>,
ilya@math.ohio-state.edu says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.143ea41f212df92698addf@nntp.hpl.hp.com>:
> > Though you didn't ask explicitly, the only 'false' values are:
> >
> > an arithmetic expression that evaluates to 0
> > the string '0'
> > the undefined value (undef, or not assigning anything)
>
> [ the string '' as noted in other followups...]
>
> ... and whatever with an overloaded 'bool'-accessor which returns
> false (this is recursive!).
Yeah, whatever. It's easy to forget that some people insist on twisting
Perl into C++.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 02 Oct 2000 10:48:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl CGI
Message-Id: <chpgtskvtec5ftlo9u24salqnvp3uebkdh@4ax.com>
Young Chi-Yeung Fan wrote:
>use CGI::Carp qw(fatalsToBrowser);
>
>Is there anything else I can put in there to help me debug easier? I
>think I saw a post about that last week, but I'm having trouble finding
>it.
Does this automatically send error messages to the browser? I think not.
I'm used to that, but I made my own library.
Well, you can make your own error log, if you don't have easy access to
the standard error logs. I don't. Open a file in a directory to which
anybody has write access, and make CGI::Carp use that file handle,
through carpout(), in a BEGIN block. See the example code snippet in
CGI::Carp. And, just as with fatalsToBrowser, you need to import this
function explicitely:
use CGI::Carp qw(fatalsToBrowser carpout);
--
Bart.
------------------------------
Date: Mon, 02 Oct 2000 07:37:44 GMT
From: kily@my-deja.com
Subject: PLEASE HELPS!
Message-Id: <8r9e08$3li$1@nnrp1.deja.com>
Hello,
I'm wondering for a script which can read on my flopy a file
containing two columns , then delete the first column.
Thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 2 Oct 2000 10:44:49 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Regex comparing street addresses
Message-Id: <Pine.GHP.4.21.0010021043330.25668-100000@hpplus03.cern.ch>
On Sun, 1 Oct 2000, Anonymous wrote:
> Quite frequently, before I post, I will actually
> click my cursor at a line start, and manually
> count how many characters are present.
Heavens - don't you have a computer to do that for you?
------------------------------
Date: Mon, 02 Oct 2000 14:32:34 +0200
From: Torsten Schindler <Torsten.Schindler@ccc.uni-erlangen.de>
Subject: Result of functions in child processes
Message-Id: <39D88062.95BF1BAC@ccc.uni-erlangen.de>
Hello,
How can I get the result of my function afunc back from the child
process?
The following piece of code illustrates my problem:
#---------------
my $var = 10;
print "(0) var = $var\n";
my $res;
unless (defined($pid = fork)) {
die "fork of process failed: $!";
}
unless ($pid) {
$res = &afunc(\$var);
print "(1) var = $var\n";
exit 0;
}
wait;
print "(2) var = $var\n"; # Should it not be 20?
print "res = $res\n"; # Why is the result uninitialized?
sub afunc { # This function changes my variable
my $var = shift;
my $res = 30;
${$var} = 20;
return $res;
}
#---------------
Is there a way to get my result from child process back without printing
the result to a file
and reading that file later in the parent process?
Thanks for your help,
Torsten
------------------------------
Date: Mon, 2 Oct 2000 12:15:23 +0200
From: "Jan van de Pol" <gy@fyuo.fjd>
Subject: Searching for an IDE
Message-Id: <8r9n7i$rho$1@news.IAEhv.nl>
Hi,
What is a good IDE (windows platform). I'm thinking of the following
features:
* Debugging with stepping trough code
* Color syntaxing
* Context sensitive help
* ...
Thanks in advance
Jan van de Pol
------------------------------
Date: Mon, 2 Oct 2000 16:59:28 +0800
From: "Calvin" <calvin_newsgroup@hotmail.com>
Subject: sort files
Message-Id: <8r9isn$4v9$1@eng-ser1.erg.cuhk.edu.hk>
I want to sort the files and directories by last modified. What should I
add/change ? Thank you very much!
:
:
foreach $dir (sort @dirs) {
$dir_url = $dir;
$dir_url =~ s/ /\%20/g;
print "<tr>\n<td>\n";
print "<font size=2 face=arial><b>\n";
print "<img src=\"$imagedir/dir.gif\" align=\"absbottom\"><a
href=\"$script?browse&$thisdir$dir_url\">$dir</a></b></font>\n";
print "</td>\n";
print "<td align=right><font size=2
face=arial><b>$last_mod{$dir}</b></font></td>\n";
print "<td align=right><font size=2
face=arial><b>$filesize{$dir}</b></font></td>\n";
print "</tr>\n";
}
foreach $file (sort @files) {
$ext = substr($file, rindex($file, "\.")+1);
$type = "file";
foreach $filetype (@filetypes) {
if (lc($ext) eq $filetype) {$type = $filetype;}
}
$file_url = $file;
$file_url =~ s/ /\%20/g;
print "<tr>\n<td>\n";
print "<font size=2 face=arial><b>\n";
print "<img src=\"$imagedir/$type.gif\" align=\"absbottom\"><a
href=\"$script?get&$thisdir$file_url\">$file</a></b></font>\n";
print "</td>\n";
print "<td align=right><font size=2
face=arial><b>$last_mod{$file}</b></font></td>\n";
print "<td align=right><font size=2
face=arial><b>$filesize{$file}</b></font></td>\n";
print "</tr>\n";
}
:
:
------------------------------
Date: Mon, 02 Oct 2000 09:25:05 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: sort files
Message-Id: <slrn8tglg7.pbs.rgarciasuarez@rafael.kazibao.net>
Calvin wrote in comp.lang.perl.misc:
>I want to sort the files and directories by last modified. What should I
>add/change ? Thank you very much!
Get the last modification time with:
my $mtime = (stat($filename))[9];
(make sure that $filename is not only the filename, but the full path
to it, i.e. with the directory name prepended.)
So you can get the sorted list by:
my @sorted = sort { (stat($a))[9] <=> (stat($b))[9] } @files;
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 02 Oct 2000 10:35:07 +0200
From: Christian =?iso-8859-1?Q?R=FCggeberg?= <news@sinus-medien.de>
Subject: Sorting of Form-Fields ???
Message-Id: <39D848BA.C8B879BF@sinus-medien.de>
Hi,
in my Form there are ca. 25 Fields. I want to output this fields
automatic in the same
sorting-order as they are in the Form, but the perl-script recieves them
not sorted...
Is there a way to fix this??? Without outputting manually???
thanx,
Christian
------------------------------
Date: Mon, 02 Oct 2000 08:49:28 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Sorting of Form-Fields ???
Message-Id: <slrn8tgjdf.p8n.rgarciasuarez@rafael.kazibao.net>
Christian Rüggeberg wrote in comp.lang.perl.misc:
>Hi,
>
>in my Form there are ca. 25 Fields. I want to output this fields
>automatic in the same
>sorting-order as they are in the Form, but the perl-script recieves them
>not sorted...
>
>Is there a way to fix this??? Without outputting manually???
The browser chooses the order of sent POST data. This order may vary
from browser to browser: it is not specified by the RFCs (and, even if
it'd be, don't expect popular browsers to comply).
As this is not a Perl problem, there is no way to fix it in your Perl
script. Hardcode the order of your fields.
And, by the way, you should consider using the CGI.pm module.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 02 Oct 2000 14:55:49 +0200
From: Volker Moell <moell@ID-PRO.de>
Subject: Strange behaviour with @{...}
Message-Id: <39D885D5.57C6D5C@ID-PRO.de>
Hi, all!
I found a strange behaviour concerning the @{...} operator.
(Don't ask about the sense of this small programm. :)
Call the following program:
-------------------------(snipp)------------------------
#!/usr/bin/perl -w
use strict;
my $a = undef;
print $a;
foreach (@{$a}) { }
print $a;
-------------------------(snapp)------------------------
The output (both 5.6.x and 5.0.x) will be:
-------------------------(snipp)------------------------
Use of uninitialized value in print at ./test.pl line 5.
ARRAY(0x80eedb0)
-------------------------(snapp)------------------------
My question is: Why does @{...} changes the value of the variable $a?
Or is this a Perl bug?
Thanks in advance for any hint,
-volker
--
Volker Moell <moell@ID-PRO.de> (Products & Developement)
* ID-PRO Deutschland GmbH * Am Hofgarten 20 * D-53113 Bonn
* Tel. +49 (0) 2 28-4 21 54-0 * Fax -3 59
* http://open-for-the-better.com
------------------------------
Date: Mon, 02 Oct 2000 11:06:32 GMT
From: steve@nospam.co.uk (Steve)
Subject: Testing for non-numerics in a scalar
Message-Id: <39d96ab3.93568164@news.redhotant.com>
I am trying to identify non-numerics in an integer.
Could anyone comment on why this doesn't work?
$numbercheck= 1234ty56;
if ($m = ~m"(\d/$numbercheck/)")
{
print "non-numerics found\n";
}
Steve
------------------------------
Date: Mon, 02 Oct 2000 08:17:55 -0400
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: Testing for non-numerics in a scalar
Message-Id: <brian+usenet-8AA7B0.08175502102000@news.panix.com>
In article <39d96ab3.93568164@news.redhotant.com>, steve@nospam.co.uk
wrote:
> I am trying to identify non-numerics in an integer.
> $numbercheck= 1234ty56;
>
> if ($m = ~m"(\d/$numbercheck/)")
why not just
if( m/\D/ )
> {
> print "non-numerics found\n";
> }
>
> Steve
--
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Mon, 2 Oct 2000 08:28:13 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Testing for non-numerics in a scalar
Message-Id: <Pine.GSO.4.21.0010020821500.12979-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 2, Steve said:
>I am trying to identify non-numerics in an integer.
A regular expression seems like the way to go here.
>Could anyone comment on why this doesn't work?
Because it doesn't even compile.
>$numbercheck= 1234ty56;
You can't just embed alphabetic characters in a number like that. Perl
won't let you. It'd have to be something like:
$numbercheck = "1234ty56";
>if ($m = ~m"(\d/$numbercheck/)")
>{
>print "non-numerics found\n";
>}
You don't appear to have a good grasp of regular expressions. That puts a
number (~0, specifically) in $m. I think you should look online for the
'perlretut' documentation, which is a tutorial to regular expressions,
soon to be (or that already is) in the standard Perl docs.
You MEAN to be doing:
if ($numbercheck =~ /\D/) {
print "non-numerics found\n";
}
But that's not 100% accurate, since 123.456 is a valid number
(non-integer, albeit) but the . character IS matched by \D.
Perhaps you want to look at the Perl FAQ, section 4:
japhy% perldoc -q float
How do I determine whether a scalar is a number/whole/integer/float?
[...]
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: 2 Oct 2000 10:37:12 GMT
From: rp@win.tue.nl (Reinier Post)
Subject: use Perl instead (was: Need sed or awk solution for recursive html site.)
Message-Id: <8r9ogo$k71$1@news.tue.nl>
Russ Allbery <rra@stanford.edu> wrote:
>Reinier Post <rp@win.tue.nl> writes:
>
>> As a side remark, please learn Perl instead. Practically everything you
>> can do with sed and awk is easier in Perl, and it can do so much more.
>
>I use Perl extensively for things like this and I still don't agree with
>this. Simple substitutions on streams are much easier to do in sed.
I disagree. Perl substititions are always at least as easy as sed's.
Deletions and additions are marginally more verbose. The rest of sed
should be avoided like the plague - with all due respect to sed veterans.
>Printing out columns of whitespace-separated data is much easier in awk.
Perl is less concise in that it needs an explicit 'split' statement.
I admit to using awk on the command line for that reason.
>For a good example of something that I think is more intuitive in awk and
>sed than in Perl, try:
>
> sed 1,/Total/d sizes | awk '{ total += $6 } END { print total }'
perl -nle '1../Total/ or $total += (split)[5]; END {print $total}' sizes
In a script, I'd use explicit while loops instead, but sed's range
and awk's END feature are there for those who want them.
>Perl's great for one-liners on the command line, but awk and sed have
>their place too.
Sure, awk and sed have their place in terms of mindshare and written
code; also, Perl is still banned from some Unix systems. But looking
purely at the languages, Perl can completely supersede them: sed and
awk constructs exist in Perl, so you don't even have to rethink the
program logic. This is already true on the command line: sed/awk lines
can usually be translated to Perl with a few extra brackets or
keywords. Perl bends over backwards to sed and awk users.
Perl's true strength is in the fact that it generalises and extends
this to a general purpose language; it really shines in longer scripts,
where instead of having to use the shell, sed, awk and a bunch of
other utilities, the programmer can remain within Perl to do it all.
I have plenty of sh+sed+awk scripts containing the comment "this has
grown too complex - rewrite it in Perl!" I should have started them
in Perl right away.
This is why I feel Perl is a much better investment of one's time
than sed or awk. Learn as much sed or awk as you need to maintain
sed or awk code, learn Perl for new scripts.
(I'm posting this in comp.unix.solaris because it's one of the more
useful things I learnt as a Solaris systems administrator, but it
really belongs in a language advocacy newsgroup. Not sure where
to send it.)
[Followups set to comp.lang.perl.misc]
>Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
--
Reinier Post reinpost@win.tue.nl
------------------------------
Date: Mon, 02 Oct 2000 11:59:47 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: use Perl instead (was: Need sed or awk solution for recursive html site.)
Message-Id: <slrn8tgui9.ppr.rgarciasuarez@rafael.kazibao.net>
Reinier Post wrote in comp.lang.perl.misc:
>Russ Allbery <rra@stanford.edu> wrote:
>
>>Reinier Post <rp@win.tue.nl> writes:
>>Printing out columns of whitespace-separated data is much easier in awk.
>
>Perl is less concise in that it needs an explicit 'split' statement.
>I admit to using awk on the command line for that reason.
Well, lookup the -a and -F switches in perlrun (autosplit mode). (I
think that they were introduced to emulate awk and its -F switch).
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 2 Oct 2000 19:51:29 +0800
From: "Lucas" <wstsoi@netvigator.com>
Subject: Re: Win32::API needs help
Message-Id: <8r9srg$8lm1@imsp212.netvigator.com>
It works
Thanks you.
Thanks very much.
"Tye McQueen" <tye@metronet.com> ¼¶¼g©ó¶l¥ó
news:8qtbjf$m59@beanix.metronet.com...
> "Lucas" <wstsoi@hongkong.com> writes:
> ) $initTTS = new Win32::API("cutalk", "initTTS", [P, I], I);
> ) $spkTTS = new Win32::API("cutalk", "spkTTS", [P, N, I], I);
> ) $termTTS = new Win32::API("cutalk", "termTTS", [], V);
>
> You really should test for success above.
>
> As I recall, the last time I used Win32::API, there was no "V" nor
> "I" and you use "N" to pass integers (but I also recall the docs
> not being very clear on this so I could be wrong). To pass a
> double you might need to use "N" (to pass in an integer) and do:
>
> # The value we want to pass in:
> my $val= 2.0;
> # Stuff it into a buffer in the proper format (as a C<double>):
> my $buf= pack( "d", $val );
> # Get the address of the buffer:
> my $addr= 0 + \$buf;
>
> then pass in C<$addr> instead of C<2.0>. You can probably get
> away with doing this all at once:
>
> $spkTTS->Call( $the_string, 0+\pack("d",2.0), 1 )
>
> Dang! I think I'm wrong here. I think a double would be passed
> on the stack and this would pass it by reference. Perhaps this
> might work:
>
> # The value we want to pass in:
> my $val= 2.0;
> # Stuff it into a buffer in the proper format (as a C<double>):
> my $buf= pack( "d", $val );
> my @ints= unpack( "L*", $buf );
> # Or you might need this next line instead:
> # my @ints= reverse unpack( "L*", $buf );
>
> $spkTTS->Call( $the_string, @ints, 1 )
>
> and then initialize $spkTTS to take N integers in place of the 1
> double (where N should be 2 on most platforms including Win32).
>
> I suggest you grab C::Dynalib or the FFI module and use one of them
> instead of Win32::API [but nobody takes my advice, not even me].
> --
> Tye McQueen Nothing is obvious unless you are overlooking something
> http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
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 4489
**************************************