[24498] in Perl-Users-Digest
Perl-Users Digest, Issue: 6678 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 11 00:06:07 2004
Date: Thu, 10 Jun 2004 21:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Jun 2004 Volume: 10 Number: 6678
Today's topics:
'my' doesn't totally isolate (John Brock)
Re: 'my' doesn't totally isolate <noreply@gunnar.cc>
Re: 'my' doesn't totally isolate <ittyspam@yahoo.com>
Re: 'my' doesn't totally isolate (John Brock)
Re: 'my' doesn't totally isolate (Randal L. Schwartz)
Re: 'my' doesn't totally isolate (John Brock)
Re: 'my' doesn't totally isolate <uri@stemsystems.com>
Re: 'my' doesn't totally isolate <uri@stemsystems.com>
Re: 'my' doesn't totally isolate (John Brock)
Re: 'my' doesn't totally isolate <uri@stemsystems.com>
Re: Expanding scalar hash element in array ref. (Anno Siegel)
Getting started on perl on my PC <None@nowh.ere>
Re: Getting started on perl on my PC <postmaster@castleamber.com>
Re: Getting started on perl on my PC <noreply@gunnar.cc>
Re: Getting started on perl on my PC <None@nowh.ere>
Re: Getting started on perl on my PC <postmaster@castleamber.com>
Re: How to get "perl -V"'s output programmatically? <jkrugman345@yahbitoo.com>
Re: How to get "perl -V"'s output programmatically? <spamtrap@dot-app.org>
Microsoft Word and Perl (Ilaiyarasan)
Nameed pipes Vs sockets (Palaniappan)
parsing file name assigning extension to a variable (Alexander Heimann)
Re: parsing file name assigning extension to a variable (Sam Holden)
Re: parsing file name assigning extension to a variable <postmaster@castleamber.com>
Re: parsing file name assigning extension to a variable <gnari@simnet.is>
Re: perl IF DBI::errsrt ctcgag@hotmail.com
Perl socket on linux won't accept connections from wind (Eli Sidwell)
Re: Perl socket on linux won't accept connections from <postmaster@castleamber.com>
Testing scripts? <socyl@987jk.com>
XML::DOM Query <thesnake_123@-NO-S_P_A_M-hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jun 2004 21:11:52 -0400
From: jbrock@panix.com (John Brock)
Subject: 'my' doesn't totally isolate
Message-Id: <cab0so$oha$1@panix2.panix.com>
I seem to have misunderstood something about 'my'. I was under
the impression that when you defined a variable in a function or
block using 'my' the variable was totally private and totally
isolated from anything that happens anywhere else. In particular
I thought that unless I explicitly gave the variable a value it
would start out undefined every time the function or block was
called. But in fact this does not seem to be the case, as the
following script illustrates:
=== Begin script ===
sub zzz {
my @aaa;
print "defined: '", defined(@aaa), "', last: $#aaa\n";
@aaa = (1, 2, 3);
}
zzz();
zzz();
=== End script ===
I would have expected that both calls to zzz() would produce exactly
the same output. But in fact what I get, using Perl 5.8.0 under
Solaris, is:
=== Begin output ===
defined: '', last: -1
defined: '1', last: -1
=== End output ===
In the first invocation of zzz() array @aaa start out undefined,
while in the second @aaa starts out as a defined array with length
0. This is not what I expected at all! I haven't been able to
find this behavior written up anywhere, so is it possible it is a
bug? If not, can anyone explain what is happening, or point me to
an explanation?
--
John Brock
jbrock@panix.com
------------------------------
Date: Fri, 11 Jun 2004 03:20:49 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: 'my' doesn't totally isolate
Message-Id: <2isfpnFq4pbsU1@uni-berlin.de>
John Brock wrote:
> I seem to have misunderstood something about 'my'.
You have rather misunderstood something about the defined() function.
perldoc -f defined
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 10 Jun 2004 21:32:56 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: 'my' doesn't totally isolate
Message-Id: <20040610213155.S8971@dishwasher.cs.rpi.edu>
On Thu, 10 Jun 2004, John Brock wrote:
> I seem to have misunderstood something about 'my'. I was under
> the impression that when you defined a variable in a function or
> block using 'my' the variable was totally private and totally
> isolated from anything that happens anywhere else. In particular
> I thought that unless I explicitly gave the variable a value it
> would start out undefined every time the function or block was
> called. But in fact this does not seem to be the case, as the
> following script illustrates:
>
> === Begin script ===
> sub zzz {
> my @aaa;
>
> print "defined: '", defined(@aaa), "', last: $#aaa\n";
>
> @aaa = (1, 2, 3);
> }
>
> zzz();
> zzz();
> === End script ===
>
> I would have expected that both calls to zzz() would produce exactly
> the same output. But in fact what I get, using Perl 5.8.0 under
> Solaris, is:
>
> === Begin output ===
> defined: '', last: -1
> defined: '1', last: -1
> === End output ===
perldoc -f defined:
Use of "defined" on aggregates (hashes and arrays)
is deprecated. It used to report whether memory for
that aggregate has ever been allocated. This
behavior may disappear in future versions of Perl.
You should instead use a simple test for size:
Paul Lalli
------------------------------
Date: 10 Jun 2004 21:46:47 -0400
From: jbrock@panix.com (John Brock)
Subject: Re: 'my' doesn't totally isolate
Message-Id: <cab2u7$j9k$1@panix2.panix.com>
In article <2isfpnFq4pbsU1@uni-berlin.de>,
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>John Brock wrote:
>> I seem to have misunderstood something about 'my'.
>You have rather misunderstood something about the defined() function.
>
> perldoc -f defined
Hmmm.... So how am I supposed to distinguish between an array
which has not been assigned to and one whose length just happens
to be zero?
Also, I can still get the behavior I expected by using undef() on
the array in question after I define it with 'my', but I am not
sure why this works if undefined() simply tells me whether memory
for the array has *ever* been allocated. Can I trust this behavior?
--
John Brock
jbrock@panix.com
------------------------------
Date: Fri, 11 Jun 2004 02:11:45 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: 'my' doesn't totally isolate
Message-Id: <1730eb2493fa60400c1ab7af77117a22@news.teranews.com>
>>>>> "John" == John Brock <jbrock@panix.com> writes:
John> Hmmm.... So how am I supposed to distinguish between an array
John> which has not been assigned to and one whose length just happens
John> to be zero?
You don't. The difference between the two is (ahem) undefined. :)
defined() on aggregates is deliberately undefined, because it depends
on allocation strategies. You want to slow down *all* of Perl just
to get something you should figure out from context instead?
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 10 Jun 2004 22:32:45 -0400
From: jbrock@panix.com (John Brock)
Subject: Re: 'my' doesn't totally isolate
Message-Id: <cab5kd$o4m$1@panix2.panix.com>
In article <1730eb2493fa60400c1ab7af77117a22@news.teranews.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "John" == John Brock <jbrock@panix.com> writes:
>John> Hmmm.... So how am I supposed to distinguish between an array
>John> which has not been assigned to and one whose length just happens
>John> to be zero?
>
>You don't. The difference between the two is (ahem) undefined. :)
>
>defined() on aggregates is deliberately undefined, because it depends
>on allocation strategies. You want to slow down *all* of Perl just
>to get something you should figure out from context instead?
Well, I thought I *was* figuring it out from context. I thought
Perl had a nice little feature where I could tuck some extra
information into one variable rather than defining two. But if it
doesn't work that way then it doesn't work that way.
I guess that means I can't even trust that defined(@aaa) will always
return FALSE if I call it after calling undef(@aaa) (even though
that seems to work for me right now). Bummer!
--
John Brock
jbrock@panix.com
------------------------------
Date: Fri, 11 Jun 2004 02:34:31 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: 'my' doesn't totally isolate
Message-Id: <x7brjqakli.fsf@mail.sysarch.com>
>>>>> "JB" == John Brock <jbrock@panix.com> writes:
JB> In article <2isfpnFq4pbsU1@uni-berlin.de>,
JB> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>> John Brock wrote:
>>> I seem to have misunderstood something about 'my'.
>> You have rather misunderstood something about the defined() function.
>>
>> perldoc -f defined
JB> Hmmm.... So how am I supposed to distinguish between an array
JB> which has not been assigned to and one whose length just happens
JB> to be zero?
why should you care? do you have a valid reason?
JB> Also, I can still get the behavior I expected by using undef() on
JB> the array in question after I define it with 'my', but I am not
JB> sure why this works if undefined() simply tells me whether memory
JB> for the array has *ever* been allocated. Can I trust this behavior?
undef on aggregates is also something you don't want. it will free the
allocated ram and it also leads coders (like you) to think that defined
has meaning on aggregates. you clear arrays and hashes by assigning an
empty list () to them. my by itself will always create an empty array or
hash as that is its runtime effect.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 11 Jun 2004 02:38:07 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: 'my' doesn't totally isolate
Message-Id: <x78yeuakff.fsf@mail.sysarch.com>
>>>>> "JB" == John Brock <jbrock@panix.com> writes:
JB> In article <1730eb2493fa60400c1ab7af77117a22@news.teranews.com>,
JB> Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>>> "John" == John Brock <jbrock@panix.com> writes:
John> Hmmm.... So how am I supposed to distinguish between an array
John> which has not been assigned to and one whose length just happens
John> to be zero?
>>
>> You don't. The difference between the two is (ahem) undefined. :)
>>
>> defined() on aggregates is deliberately undefined, because it depends
>> on allocation strategies. You want to slow down *all* of Perl just
>> to get something you should figure out from context instead?
JB> Well, I thought I *was* figuring it out from context. I thought
JB> Perl had a nice little feature where I could tuck some extra
JB> information into one variable rather than defining two. But if it
JB> doesn't work that way then it doesn't work that way.
JB> I guess that means I can't even trust that defined(@aaa) will always
JB> return FALSE if I call it after calling undef(@aaa) (even though
JB> that seems to work for me right now). Bummer!
you are not making much sense here. why should you care if an array was
allocated or not? it is not a useful boolean as you have little control
over it. what control you see is an undocumented side effect and may go
away.
now state your real problem and stop worrying about array storage
allocation and undef. it is a red herring and you should drop it now.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 10 Jun 2004 22:53:35 -0400
From: jbrock@panix.com (John Brock)
Subject: Re: 'my' doesn't totally isolate
Message-Id: <cab6rf$92j$1@panix2.panix.com>
In article <x78yeuakff.fsf@mail.sysarch.com>,
Uri Guttman <uri@stemsystems.com> wrote:
>you are not making much sense here. why should you care if an array was
>allocated or not? it is not a useful boolean as you have little control
>over it. what control you see is an undocumented side effect and may go
>away.
If would be a useful boolean if I did have control over it. What
I've learned here is that I don't. Too bad. Live and learn.
>now state your real problem and stop worrying about array storage
>allocation and undef. it is a red herring and you should drop it now.
Calm down! My real problem was perfectly right clear from my first
post. I didn't properly understand a feature of the language. I
understand it better now, so my purpose in coming here has been
accomplished.
--
John Brock
jbrock@panix.com
------------------------------
Date: Fri, 11 Jun 2004 03:23:01 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: 'my' doesn't totally isolate
Message-Id: <x71xkmaicp.fsf@mail.sysarch.com>
>>>>> "JB" == John Brock <jbrock@panix.com> writes:
JB> In article <x78yeuakff.fsf@mail.sysarch.com>,
JB> Uri Guttman <uri@stemsystems.com> wrote:
>> you are not making much sense here. why should you care if an array was
>> allocated or not? it is not a useful boolean as you have little control
>> over it. what control you see is an undocumented side effect and may go
>> away.
JB> If would be a useful boolean if I did have control over it. What
JB> I've learned here is that I don't. Too bad. Live and learn.
you still haven't explained a real use for this. i reread your OP and it
just bitches about undef and defined and such without stating a REASON
for needing this boolean.
>> now state your real problem and stop worrying about array storage
>> allocation and undef. it is a red herring and you should drop it now.
JB> Calm down! My real problem was perfectly right clear from my first
JB> post. I didn't properly understand a feature of the language. I
JB> understand it better now, so my purpose in coming here has been
JB> accomplished.
but your original need for this feature is still unknown. you are having
what is called an XY problem. your real problem is X but you think the
problem is Y and you ask how to solve Y.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 10 Jun 2004 22:23:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Expanding scalar hash element in array ref.
Message-Id: <caan0q$mls$2@mamenchi.zrz.TU-Berlin.DE>
Ben Morrow <usenet@morrow.me.uk> wrote in comp.lang.perl.misc:
> and you want to convert them all to arrayrefs, you can do this:
>
> for (keys %var) {
> $var{$_} = [ $var{$_} ] unless ref $var{$_};
> }
...or even
ref or $_ = [ $_] for values %var;
Anno
------------------------------
Date: Thu, 10 Jun 2004 20:47:52 -0400
From: None <None@nowh.ere>
Subject: Getting started on perl on my PC
Message-Id: <MPG.1b32cb453563baa698968a@news.uncensorednewsfeed.com>
I have done a small amount of perl.cgi for my websites, as well as HTML.
I am slow, inept, and clumsy, but I can usually eventually get the job
done.....
I want to write a couple of programs to identify and analyze data which
is stored in a strictly numerical form, comma separated. I could do this
by uploading it to a website, but I want to keep it on my own computer.
I have downloaded and installed "Active Perl." The documentation assumes
that I know a lot more than I do.
Can someone suggest a book or other source that will tell me how to get
started on writing and running such a "local" program?
Thanks
Dave
DLRiegel@runbox.com
------------------------------
Date: Thu, 10 Jun 2004 20:01:13 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Getting started on perl on my PC
Message-Id: <40c9045a$0$196$58c7af7e@news.kabelfoon.nl>
None wrote:
> I have done a small amount of perl.cgi for my websites, as well as HTML.
> I am slow, inept, and clumsy, but I can usually eventually get the job
> done.....
>
> I want to write a couple of programs to identify and analyze data which
> is stored in a strictly numerical form, comma separated. I could do this
> by uploading it to a website, but I want to keep it on my own computer.
>
> I have downloaded and installed "Active Perl." The documentation assumes
> that I know a lot more than I do.
>
> Can someone suggest a book or other source that will tell me how to get
> started on writing and running such a "local" program?
"Learning Perl" is a good start :-D
There is a Win32 version.
With Active Perl double click on a .pl file runs it with Perl. I prefer
using cmd.exe or "dosbox" however. Also get a decent editor, for example
textpad (http://www.textpad.com/ ), it has syntax highlighting for Perl.
If you path to "Perl" is C:\Perl bookmark C:\Perl\html\index.html in
your browser ( file:///C:/Perl/html/index.html ). It has a lot of
documentation. Start reading the core documentation.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Fri, 11 Jun 2004 03:05:28 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Getting started on perl on my PC
Message-Id: <2isesvFq09o9U1@uni-berlin.de>
None wrote:
> I have downloaded and installed "Active Perl." The documentation
> assumes that I know a lot more than I do.
Since you mentioned CGI and HTML, you should probably install a web
server as well. I suggest that you try this package:
http://www.indigostar.com/indigoperl.htm
It gives you Perl + Apache + PHP etc., and the simple installation
includes an automatic Apache configuration.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 10 Jun 2004 21:33:15 -0400
From: None <None@nowh.ere>
Subject: Re: Getting started on perl on my PC
Message-Id: <MPG.1b32d5e2ac2663c498968b@news.uncensorednewsfeed.com>
In article <40c9045a$0$196$58c7af7e@news.kabelfoon.nl>,
postmaster@castleamber.com says...
> None wrote:
>
> > I have done a small amount of perl.cgi for my websites, as well as HTML.
> > I am slow, inept, and clumsy, but I can usually eventually get the job
> > done.....
> >
> > I want to write a couple of programs to identify and analyze data which
> > is stored in a strictly numerical form, comma separated. I could do this
> > by uploading it to a website, but I want to keep it on my own computer.
> >
> > I have downloaded and installed "Active Perl." The documentation assumes
> > that I know a lot more than I do.
> >
> > Can someone suggest a book or other source that will tell me how to get
> > started on writing and running such a "local" program?
>
> "Learning Perl" is a good start :-D
>
> There is a Win32 version.
>
> With Active Perl double click on a .pl file runs it with Perl. I prefer
> using cmd.exe or "dosbox" however. Also get a decent editor, for example
> textpad (http://www.textpad.com/ ), it has syntax highlighting for Perl.
>
> If you path to "Perl" is C:\Perl bookmark C:\Perl\html\index.html in
> your browser ( file:///C:/Perl/html/index.html ). It has a lot of
> documentation. Start reading the core documentation.
>
I just bought the Lizard. It is right up there on the shelf with the
Camel and the Llama. All I want to know is what the shebang line
(assuming there is one in "local" programming) should be, and I will use
my Edit Pad as usual, save the file, and call it up with my Netscape. At
least this is how I envision the process...
Thanks - I considered Visual Basic for this job, but I know absolutely
NOTHING about that - the Perl I at least can do the basic scripting..
BTW, I am one of the diehards that is clinging desperately to W98SE :)
Dave
------------------------------
Date: Thu, 10 Jun 2004 20:56:39 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Getting started on perl on my PC
Message-Id: <40c91158$0$189$58c7af7e@news.kabelfoon.nl>
None wrote:
> In article <40c9045a$0$196$58c7af7e@news.kabelfoon.nl>,
> postmaster@castleamber.com says...
>
>>None wrote:
>>
>>
>>>I have done a small amount of perl.cgi for my websites, as well as HTML.
>>>I am slow, inept, and clumsy, but I can usually eventually get the job
>>>done.....
>>>
>>>I want to write a couple of programs to identify and analyze data which
>>>is stored in a strictly numerical form, comma separated. I could do this
>>>by uploading it to a website, but I want to keep it on my own computer.
>>>
>>>I have downloaded and installed "Active Perl." The documentation assumes
>>>that I know a lot more than I do.
>>>
>>>Can someone suggest a book or other source that will tell me how to get
>>>started on writing and running such a "local" program?
>>
>>"Learning Perl" is a good start :-D
>>
>>There is a Win32 version.
>>
>>With Active Perl double click on a .pl file runs it with Perl. I prefer
>>using cmd.exe or "dosbox" however. Also get a decent editor, for example
>>textpad (http://www.textpad.com/ ), it has syntax highlighting for Perl.
>>
>>If you path to "Perl" is C:\Perl bookmark C:\Perl\html\index.html in
>>your browser ( file:///C:/Perl/html/index.html ). It has a lot of
>>documentation. Start reading the core documentation.
>
> I just bought the Lizard. It is right up there on the shelf with the
> Camel and the Llama. All I want to know is what the shebang line
The Cookbook, you must buy the cookbook too :-D.
> (assuming there is one in "local" programming) should be,
Windows works different compared to *nix. The .pl extension is
associated with perl, so just use that extension. Use
use strict;
use warnings;
at the start of your script. You don't "need" the -w then.
> and I will use
> my Edit Pad as usual, save the file, and call it up with my Netscape. At
> least this is how I envision the process...
If you want to see the result in a browser, you should install a
webserver. If you are happy with the output in cmd.exe, or a file, use
Perl. If you want to see it in a window, use Tk.
> Thanks - I considered Visual Basic for this job, but I know absolutely
> NOTHING about that - the Perl I at least can do the basic scripting..
>
> BTW, I am one of the diehards that is clinging desperately to W98SE :)
:-D. Look for Command Prompt here shell extension then. It used to be
part of the so called PowerToys.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Thu, 10 Jun 2004 22:35:45 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: Re: How to get "perl -V"'s output programmatically?
Message-Id: <caano1$5vc$1@reader2.panix.com>
In <caa858$eie$1@mamenchi.zrz.TU-Berlin.DE> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>J Krugman <jkrugman345@yahbitoo.com> wrote in comp.lang.perl.misc:
>>
>>
>> Is there a better way to get, within a Perl script, the string
>> generated by "perl -V" than going through sh:
>>
>> my $perl_V = do { local $/; `perl -V` };
>Why the do-block to undef $/?
Ah, thanks for reminding me. I'd forgotten that `` already does
what I want in scalar context (not to mention my genius for
complexitudinositification).
>But there is indeed a better way:
> use Config;
> my $perl_V = Config::myconfig();
>That reproduces most of the text of "perl -V". There are a few insertions
>in "perl -V" that are not in myconfig (probably those you are complaining
>about in the part I snipped).
Thanks. Not that it's too important, but I wonder how I could find
out where in perl's code those "few insertions" are generated. I
suspect they are nothing more than processed bits from %Config::Config,
but I can't figure out who/what is doing the processing.
Thanks again,
jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: Thu, 10 Jun 2004 22:13:16 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How to get "perl -V"'s output programmatically?
Message-Id: <ZN-dnT_rtPejiFTdRVn-vg@adelphia.com>
J Krugman wrote:
> Thanks. Not that it's too important, but I wonder how I could find
> out where in perl's code those "few insertions" are generated.
It's in perl.c. Look for "case 'V':" - in 5.8.4, it starts on line 1440.
> suspect they are nothing more than processed bits from %Config::Config,
> but I can't figure out who/what is doing the processing.
Actually, it doesn't look that way. :-(
There are a series of #ifdefs, and in each one a call to sv_catpv() that
appends the appropriate string to a print statement. It's not drawing those
particular bits from Config.pm at all.
That's not to say that the info isn't available via Config.pm - just that
it's not where -V gets it from.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 10 Jun 2004 18:09:56 -0700
From: Ilaiy@hotmail.com (Ilaiyarasan)
Subject: Microsoft Word and Perl
Message-Id: <1980fc05.0406101709.196399b0@posting.google.com>
I have been trying to update my word document using perl, i used
$word->Selection->WholeStory;
$word->Selection->Fields->{Update};
But this is a little slow and at times doesnot update completely. I
modified the code and right now getting a wired error but the same in
VBA works really well .
my $newdoc = $word->ActiveDocument;
foreach my $obj_Story ($newdoc->StoryRanges ){
$obj_Story->Fields->{Update}; ==> Cannot find object
while ($obj_Story->NextStoryrange != ""){
$obj_Story = $obj_Story->NextStoryRange;
$obj_Story->Fields->{Update}; ==> Cannot find object
}
}
The equivalent in VBA is ..
Dim obj_Story As Range
For Each obj_Story In ActiveDocument.StoryRanges
obj_Story.Fields.update
While Not (obj_Story.NextStoryRange Is Nothing)
Set obj_Story = obj_Story.NextStoryRange
obj_Story.Fields.update
Wend
Next obj_Story
Set obj_Story = Nothing
Could someone tell me where am i going on.
Ilaiy
------------------------------
Date: 10 Jun 2004 20:55:43 -0700
From: palam_analog@yahoo.co.in (Palaniappan)
Subject: Nameed pipes Vs sockets
Message-Id: <a7b604a1.0406101955.6658a8bd@posting.google.com>
Hi all,
Now i am using two named pipes for Inter Process communication (IPC).
will i get speed advantage if i use sockets ?.
which one is best for perl IPC ?
anybody analyzed this earlier in perl ?
Thanks in advance,
palani
------------------------------
Date: 10 Jun 2004 17:01:28 -0700
From: AlexanderHeimann@yahoo.com (Alexander Heimann)
Subject: parsing file name assigning extension to a variable
Message-Id: <1c63154d.0406101601.29f1448f@posting.google.com>
Hi guys. I am new to Perl(four days). I am having a blast playing with
it. There seems to be a hundred ways to solve each problem I am faced
with.
Currently I am working on migrating data to a new database. I need to
read the contents of a few thousand files and then insert the contents
into a database. The trick is the files are named desc.121655 with
121655 being the record number or primary key in the database. So I
need to parse the filename and save the extension to a variable to
later use in my SQL statement. The steps I think i need to take are
below any comments would be great
1. open directory..
2. go file by file
3 assign extension of file to a variable @recordNum
4 assign contents of file to a variable @content
5 then insert content with SQL statement where PK = @recordNum
6 then do next file until end of directory
sorry if that sounds confusing i am a bit new at this
Alex
------------------------------
Date: 11 Jun 2004 00:19:45 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: parsing file name assigning extension to a variable
Message-Id: <slrncchul0.goj.sholden@flexal.cs.usyd.edu.au>
On 10 Jun 2004 17:01:28 -0700,
Alexander Heimann <AlexanderHeimann@yahoo.com> wrote:
> Hi guys. I am new to Perl(four days). I am having a blast playing with
> it. There seems to be a hundred ways to solve each problem I am faced
> with.
> Currently I am working on migrating data to a new database. I need to
> read the contents of a few thousand files and then insert the contents
> into a database. The trick is the files are named desc.121655 with
> 121655 being the record number or primary key in the database. So I
> need to parse the filename and save the extension to a variable to
> later use in my SQL statement. The steps I think i need to take are
> below any comments would be great
>
> 1. open directory..
perldoc -f opendir
> 2. go file by file
perldoc -f readdir
perldoc perlsyn [look for for, foreach, while]
> 3 assign extension of file to a variable @recordNum
perldoc File::Basename
You certainly don't want to use an array for a single extension
(and you don't seem to need to keep all the data at once)
> 4 assign contents of file to a variable @content
perldoc -f open
perldoc -f readline
perldoc -f read
perldoc -f close
> 5 then insert content with SQL statement where PK = @recordNum
perldoc DBI
> 6 then do next file until end of directory
'}'
perldoc is a command on most perl installs to read the documentation you
may have it available as HTML or in some other format, in which case
"perldoc -f foo" means the foo function documented in the perlfunc
documentation. "perldoc File::Basename" means the documentation for
the File::Basename module. perldoc perlsyn means the perlsyn
documentation.
--
Sam Holden
------------------------------
Date: Thu, 10 Jun 2004 19:54:58 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: parsing file name assigning extension to a variable
Message-Id: <40c902e3$0$209$58c7af7e@news.kabelfoon.nl>
Sam Holden wrote:
> On 10 Jun 2004 17:01:28 -0700,
> Alexander Heimann <AlexanderHeimann@yahoo.com> wrote:
>
>>Hi guys. I am new to Perl(four days). I am having a blast playing with
>>it. There seems to be a hundred ways to solve each problem I am faced
>>with.
>>Currently I am working on migrating data to a new database. I need to
>>read the contents of a few thousand files and then insert the contents
>>into a database. The trick is the files are named desc.121655 with
>>121655 being the record number or primary key in the database. So I
>>need to parse the filename and save the extension to a variable to
>>later use in my SQL statement. The steps I think i need to take are
>>below any comments would be great
>>
>>1. open directory..
>
> perldoc -f opendir
>
>>2. go file by file
>
>
> perldoc -f readdir
> perldoc perlsyn [look for for, foreach, while]
Or File::Find
>>3 assign extension of file to a variable @recordNum
>
> perldoc File::Basename
>
> You certainly don't want to use an array for a single extension
> (and you don't seem to need to keep all the data at once)
>
>>4 assign contents of file to a variable @content
>
> perldoc -f open
> perldoc -f readline
> perldoc -f read
> perldoc -f close
File::Slurp (you probably have to install that one, see ppm)
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Fri, 11 Jun 2004 00:12:08 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: parsing file name assigning extension to a variable
Message-Id: <caat96$7ne$1@news.simnet.is>
"Alexander Heimann" <AlexanderHeimann@yahoo.com> wrote in message
news:1c63154d.0406101601.29f1448f@posting.google.com...
[snip problem without actual question]
> 1. open directory..
> 2. go file by file
> 3 assign extension of file to a variable @recordNum
$recordNum ?
> 4 assign contents of file to a variable @content
$content ?
> 5 then insert content with SQL statement where PK = @recordNum
ditto
> 6 then do next file until end of directory
sounds good. go for it and let us know how it goes.
gnari
------------------------------
Date: 10 Jun 2004 22:49:18 GMT
From: ctcgag@hotmail.com
Subject: Re: perl IF DBI::errsrt
Message-Id: <20040610184918.176$Ss@newsreader.com>
Xaver Biton <javier@t-online.de> wrote:
> Ben Morrow wrote:
>
> > I'm afraid I don't understand you here: do you mean 'if an error
> > occurred I would like to insert the record into a separate table of
> > errors'? That shouldn't be hard; I'm not sure what it would gain you,
> > though. In particular, what do you want to do if the insert into the
> > error table fails as well?
>
> hi;
>
> Sorry if I didn't explain the concept clearly enough. What I mean is for
> example, the program has to insert 30000 record in a table, now if the
> record 25550 causes an error than the whole process break. I want to
> avoid this.
Assuming that you are using RaiseError, you could do something like:
my $get=$dbh1->prepare('select blah1, blah2 from table1');
my $insert=$dbh2->prepare('insert into table1a (blah1, blah2) values (?,
?)'); my $backup=$dbh2->prepare('insert into trable1a_error(blah1,blah2)
values (?,?)');
$get->execute();
while (my $stuff = $get->fetch() ) {
eval {$insert->execute(@$stuff)};
if ($@) {
warn $@;
$backup->execute(@$stuff);
};
};
Since insert and backup go into same DB, I am assuming that if the failure
is do to database crash or something, than the "backup" insert will also
fail, causing your script to die. If I didn't assume that, you would want
to check that the error in $@ is actually a data integrity error versus
some other (unrecoverable) kind of error.
>
> I would like to insert the record which fail in a separate table and let
> the program finish the work.
>
> the biggest problem is that I must check the referetial integrity of the
> data in the new database,
I didn't know that mysql supported referential integrity checks.
> the old database has not referiatial integrity
> and many records have no reference, but also why I must tranfer about 20
> GB data and I can't stop and go with a such volume.
I'd by tempted to implement this checking in Perl proper, not Mysql. That
is, assuming all the keys of the "parent" table can fit into a hash at one
time. Have Perl write two data dumps, one of known good, the other of
known bad, and then use Mysql's bulk loading tools to load the good ones.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 10 Jun 2004 15:21:08 -0700
From: sidwelle@alexian.net (Eli Sidwell)
Subject: Perl socket on linux won't accept connections from windows clients
Message-Id: <ef9a95b0.0406101421.797c97a3@posting.google.com>
I am trying to write a tcp server for linux using perl.
When I run the file it works, but it only accepts connects form linux,
won't accept connects from windows apps.
Any help is appreciated.
Sid.
------------------------------
Date: Thu, 10 Jun 2004 17:43:34 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl socket on linux won't accept connections from windows clients
Message-Id: <40c8e417$0$212$58c7af7e@news.kabelfoon.nl>
Eli Sidwell wrote:
> I am trying to write a tcp server for linux using perl.
>
> When I run the file it works, but it only accepts connects form linux,
> won't accept connects from windows apps.
As in: it works on localhost, not from the outside world?
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Thu, 10 Jun 2004 22:26:52 +0000 (UTC)
From: kj <socyl@987jk.com>
Subject: Testing scripts?
Message-Id: <caan7c$5nh$1@reader2.panix.com>
I've noticed that none of the few scripts (as opposed to modules)
that I have downloaded from CPAN comes with a test (as normally
found in a distribution's t directory, for example). Is testing
plain scripts (as opposed to modules) something that is simply not
done?
If anyone knows of a good example of a test script for a halfway
complicated script (i.e. with lots of options, prompts, etc.),
please let me know.
Thanks!
kj
--
NOTE: In my address everything before the period is backwards.
------------------------------
Date: Fri, 11 Jun 2004 01:05:37 GMT
From: "-Brad-" <thesnake_123@-NO-S_P_A_M-hotmail.com>
Subject: XML::DOM Query
Message-Id: <Bz7yc.1723$sj4.1007@news-server.bigpond.net.au>
Hi all, Im using the XML::DOM module to process an xml document but having a
few problems.
Im trying to loop though all the node attributes and retreive their values.
But having a few promlems.
The Perl code I have so far is
foreach my $child ($root->getChildNodes()) {
if ($child->getNodeType == TEXT_NODE){
#print "Text: ", $child->getData();
print "--------\n";
} elsif ($child->getNodeType == ELEMENT_NODE) {
print $child->getNodeName(), " = ",
$child->getFirstChild()->getData(), "\n";
$attribs = $child->getAttributes();
while ( my ($key, $value) = each(%$attribs) ) {
print "$key => $value\n";
# HERE I WOULD LIKE TO PRINT THE NAME AND VALUE OF
THE ATTRIBUTES
}
#$att = $attribs->getNamedItem("LetterHasDate");
#print " Attribute = " , $att->getValue() , "\n";
#print " ALSO = " ,
$child->getAttributes()->getNamedItem("att")->getValue() , "\n";
}
}
----------------When Run it gives me this. ---------------------
RequestID => XML::DOM::Attr=ARRAY(0x84d5908)
LetterHasSignatory => XML::DOM::Attr=ARRAY(0x84d699c)
LetterHasParameters => XML::DOM::Attr=ARRAY(0x84d6c3c)
ActionCode => XML::DOM::Attr=ARRAY(0x84d5740)
------------------------------------------------------------------
So as you can see it prints the $key valus out correctly, but the $value
seems to be an array.
How would I go about printing that out?
Thank you!
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6678
***************************************