[25738] in Perl-Users-Digest
Perl-Users Digest, Issue: 7978 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 15 14:05:42 2005
Date: Fri, 15 Apr 2005 11:05:13 -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 Fri, 15 Apr 2005 Volume: 10 Number: 7978
Today's topics:
ActivePerl / IIS 6 / Windows Server 2003 SP1 <jmoon@uab.edu>
Re: ActivePerl / IIS 6 / Windows Server 2003 SP1 <jmoon@uab.edu>
Re: ActivePerl / IIS 6 / Windows Server 2003 SP1 <jmoon@uab.edu>
Re: ActivePerl / IIS 6 / Windows Server 2003 SP1 <jmoon@uab.edu>
Re: ActivePerl / IIS 6 / Windows Server 2003 SP1 <jmoon@uab.edu>
Re: alternatives to HTTP <nospam@bigpond.com>
Re: COM+ component call with Perl (CB)
Comparing 2 XML files need some suggestions please <rishid@gmail.com>
Re: Comparing 2 XML files need some suggestions please <nospam@bigpond.com>
Re: Comparing 2 XML files need some suggestions please <rishid@gmail.com>
Re: Comparing 2 XML files need some suggestions please <scobloke2@infotop.co.uk>
Re: Composants application COM+ =?ISO-8859-1?Q?appel=E9 <notvalid@email.com>
Re: Creating o non-existing database (Spock)
Re: how to read file when this file is locking.... <sonet.all@msa.hinet.net>
Re: how to read file when this file is locking.... <tadmc@augustmail.com>
Re: how to read file when this file is locking.... <matternc@comcast.net>
Re: how to read file when this file is locking.... <tadmc@augustmail.com>
Re: how to read file when this file is locking.... <noreply@gunnar.cc>
Re: how to read file when this file is locking.... xhoster@gmail.com
memory leak in loop (Mike Solomon)
Net::FTP problem soup_or_power@yahoo.com
PDF and Word to screen rob_1029384756@hotmail.co.uk
Problem using defined constants as hash keys bkimelman@hotmail.com
Re: Problem using defined constants as hash keys <noreply@gunnar.cc>
Re: Problem using defined constants as hash keys <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Apr 2005 11:13:13 -0500
From: "Jim Moon" <jmoon@uab.edu>
Subject: ActivePerl / IIS 6 / Windows Server 2003 SP1
Message-Id: <d3op6p$f50$1@SonOfMaze.dpo.uab.edu>
I've seen a number of postings about this error:
"CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers."
I haven't run any perl script on this machine since before it was running
Win Server 2003.
The Web Service Extension is set up.
The Application Extension for .pl files, to be run by perl.exe is set up.
The IIS anonymous user has permissions on the perl.exe, which is version
5.8.4.810.
The simplest of scripts gives that error. i.e.
#!C:\Perl\bin\perl.exe
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print "show me the monkey";
Replacing "\n" with "" does not help.
Replacing \n\n with \r\n or \n\n\n or \n\n\n\n or \r\n\r\n does not help.
Removing either or both headers does not change the outcome.
Running the same script as .plx with ISAPI and perlis.dll works. Running
the same script as .cgi with perl.exe does not work. Running the .pl script
from command line with perl.exe does work.
The web extension is set up properly. Permissions on perl.exe and the .pl
script seem fine for the anonymous IIS user, and for the identity of the app
pool. The .pl file extension is properly mapped to C:\Perl\bin\perl.exe
"%s" %s
There seems to be no doubt that ActivePerl with IIS 6 on Win Serv 2003 is
finicky.
What can be done to get .pl scripts to work in this environment?
Anybody know?
Jim
------------------------------
Date: Fri, 15 Apr 2005 11:56:24 -0500
From: "Jim Moon" <jmoon@uab.edu>
Subject: Re: ActivePerl / IIS 6 / Windows Server 2003 SP1
Message-Id: <d3orno$fff$1@SonOfMaze.dpo.uab.edu>
Here's a solution.
In the IIS App Pool used to run the Perl script, use one of the predefined
identities:
Network Service
Local Service
Local System
Jim
"Jim Moon" <jmoon@uab.edu> wrote in message
news:d3op6p$f50$1@SonOfMaze.dpo.uab.edu...
> I've seen a number of postings about this error:
> "CGI Error
> The specified CGI application misbehaved by not returning a complete set
> of
> HTTP headers."
>
> I haven't run any perl script on this machine since before it was running
> Win Server 2003.
> The Web Service Extension is set up.
> The Application Extension for .pl files, to be run by perl.exe is set up.
> The IIS anonymous user has permissions on the perl.exe, which is version
> 5.8.4.810.
>
> The simplest of scripts gives that error. i.e.
> #!C:\Perl\bin\perl.exe
> print "HTTP/1.0 200 OK\n";
> print "Content-type: text/html\n\n";
> print "show me the monkey";
>
> Replacing "\n" with "" does not help.
> Replacing \n\n with \r\n or \n\n\n or \n\n\n\n or \r\n\r\n does not help.
>
> Removing either or both headers does not change the outcome.
>
> Running the same script as .plx with ISAPI and perlis.dll works. Running
> the same script as .cgi with perl.exe does not work. Running the .pl
> script from command line with perl.exe does work.
>
> The web extension is set up properly. Permissions on perl.exe and the .pl
> script seem fine for the anonymous IIS user, and for the identity of the
> app pool. The .pl file extension is properly mapped to
> C:\Perl\bin\perl.exe "%s" %s
>
> There seems to be no doubt that ActivePerl with IIS 6 on Win Serv 2003 is
> finicky.
>
> What can be done to get .pl scripts to work in this environment?
>
> Anybody know?
>
> Jim
>
>
>
>
------------------------------
Date: Fri, 15 Apr 2005 12:10:17 -0500
From: "Jim Moon" <jmoon@uab.edu>
Subject: Re: ActivePerl / IIS 6 / Windows Server 2003 SP1
Message-Id: <d3osht$fj0$1@SonOfMaze.dpo.uab.edu>
BUT, that does not work if you create a new application pool--only if you
use the DefaultAppPool!!!!!!!
What the *$#@ ?
"Jim Moon" <jmoon@uab.edu> wrote in message
news:d3orno$fff$1@SonOfMaze.dpo.uab.edu...
> Here's a solution.
> In the IIS App Pool used to run the Perl script, use one of the predefined
> identities:
> Network Service
> Local Service
> Local System
>
> Jim
>
>
> "Jim Moon" <jmoon@uab.edu> wrote in message
> news:d3op6p$f50$1@SonOfMaze.dpo.uab.edu...
>> I've seen a number of postings about this error:
>> "CGI Error
>> The specified CGI application misbehaved by not returning a complete set
>> of
>> HTTP headers."
>>
>> I haven't run any perl script on this machine since before it was running
>> Win Server 2003.
>> The Web Service Extension is set up.
>> The Application Extension for .pl files, to be run by perl.exe is set up.
>> The IIS anonymous user has permissions on the perl.exe, which is version
>> 5.8.4.810.
>>
>> The simplest of scripts gives that error. i.e.
>> #!C:\Perl\bin\perl.exe
>> print "HTTP/1.0 200 OK\n";
>> print "Content-type: text/html\n\n";
>> print "show me the monkey";
>>
>> Replacing "\n" with "" does not help.
>> Replacing \n\n with \r\n or \n\n\n or \n\n\n\n or \r\n\r\n does not help.
>>
>> Removing either or both headers does not change the outcome.
>>
>> Running the same script as .plx with ISAPI and perlis.dll works. Running
>> the same script as .cgi with perl.exe does not work. Running the .pl
>> script from command line with perl.exe does work.
>>
>> The web extension is set up properly. Permissions on perl.exe and the
>> .pl script seem fine for the anonymous IIS user, and for the identity of
>> the app pool. The .pl file extension is properly mapped to
>> C:\Perl\bin\perl.exe "%s" %s
>>
>> There seems to be no doubt that ActivePerl with IIS 6 on Win Serv 2003 is
>> finicky.
>>
>> What can be done to get .pl scripts to work in this environment?
>>
>> Anybody know?
>>
>> Jim
>>
>>
>>
>>
>
>
------------------------------
Date: Fri, 15 Apr 2005 12:28:13 -0500
From: "Jim Moon" <jmoon@uab.edu>
Subject: Re: ActivePerl / IIS 6 / Windows Server 2003 SP1
Message-Id: <d3otjc$fni$1@SonOfMaze.dpo.uab.edu>
I retract the last exclamation.
It works with any application pool.
Jim
"Jim Moon" <jmoon@uab.edu> wrote in message
news:d3osht$fj0$1@SonOfMaze.dpo.uab.edu...
> BUT, that does not work if you create a new application pool--only if you
> use the DefaultAppPool!!!!!!!
>
> What the *$#@ ?
>
>
> "Jim Moon" <jmoon@uab.edu> wrote in message
> news:d3orno$fff$1@SonOfMaze.dpo.uab.edu...
>> Here's a solution.
>> In the IIS App Pool used to run the Perl script, use one of the
>> predefined identities:
>> Network Service
>> Local Service
>> Local System
>>
>> Jim
>>
>>
>> "Jim Moon" <jmoon@uab.edu> wrote in message
>> news:d3op6p$f50$1@SonOfMaze.dpo.uab.edu...
>>> I've seen a number of postings about this error:
>>> "CGI Error
>>> The specified CGI application misbehaved by not returning a complete set
>>> of
>>> HTTP headers."
>>>
>>> I haven't run any perl script on this machine since before it was
>>> running Win Server 2003.
>>> The Web Service Extension is set up.
>>> The Application Extension for .pl files, to be run by perl.exe is set
>>> up.
>>> The IIS anonymous user has permissions on the perl.exe, which is version
>>> 5.8.4.810.
>>>
>>> The simplest of scripts gives that error. i.e.
>>> #!C:\Perl\bin\perl.exe
>>> print "HTTP/1.0 200 OK\n";
>>> print "Content-type: text/html\n\n";
>>> print "show me the monkey";
>>>
>>> Replacing "\n" with "" does not help.
>>> Replacing \n\n with \r\n or \n\n\n or \n\n\n\n or \r\n\r\n does not
>>> help.
>>>
>>> Removing either or both headers does not change the outcome.
>>>
>>> Running the same script as .plx with ISAPI and perlis.dll works.
>>> Running the same script as .cgi with perl.exe does not work. Running
>>> the .pl script from command line with perl.exe does work.
>>>
>>> The web extension is set up properly. Permissions on perl.exe and the
>>> .pl script seem fine for the anonymous IIS user, and for the identity of
>>> the app pool. The .pl file extension is properly mapped to
>>> C:\Perl\bin\perl.exe "%s" %s
>>>
>>> There seems to be no doubt that ActivePerl with IIS 6 on Win Serv 2003
>>> is finicky.
>>>
>>> What can be done to get .pl scripts to work in this environment?
>>>
>>> Anybody know?
>>>
>>> Jim
>>>
>>>
>>>
>>>
>>
>>
>
>
------------------------------
Date: Fri, 15 Apr 2005 12:34:25 -0500
From: "Jim Moon" <jmoon@uab.edu>
Subject: Re: ActivePerl / IIS 6 / Windows Server 2003 SP1
Message-Id: <d3otv1$fp0$1@SonOfMaze.dpo.uab.edu>
Or does it?
"Jim Moon" <jmoon@uab.edu> wrote in message
news:d3otjc$fni$1@SonOfMaze.dpo.uab.edu...
>I retract the last exclamation.
>
> It works with any application pool.
>
> Jim
>
>
> "Jim Moon" <jmoon@uab.edu> wrote in message
> news:d3osht$fj0$1@SonOfMaze.dpo.uab.edu...
>> BUT, that does not work if you create a new application pool--only if you
>> use the DefaultAppPool!!!!!!!
>>
>> What the *$#@ ?
>>
>>
>> "Jim Moon" <jmoon@uab.edu> wrote in message
>> news:d3orno$fff$1@SonOfMaze.dpo.uab.edu...
>>> Here's a solution.
>>> In the IIS App Pool used to run the Perl script, use one of the
>>> predefined identities:
>>> Network Service
>>> Local Service
>>> Local System
>>>
>>> Jim
>>>
>>>
>>> "Jim Moon" <jmoon@uab.edu> wrote in message
>>> news:d3op6p$f50$1@SonOfMaze.dpo.uab.edu...
>>>> I've seen a number of postings about this error:
>>>> "CGI Error
>>>> The specified CGI application misbehaved by not returning a complete
>>>> set of
>>>> HTTP headers."
>>>>
>>>> I haven't run any perl script on this machine since before it was
>>>> running Win Server 2003.
>>>> The Web Service Extension is set up.
>>>> The Application Extension for .pl files, to be run by perl.exe is set
>>>> up.
>>>> The IIS anonymous user has permissions on the perl.exe, which is
>>>> version 5.8.4.810.
>>>>
>>>> The simplest of scripts gives that error. i.e.
>>>> #!C:\Perl\bin\perl.exe
>>>> print "HTTP/1.0 200 OK\n";
>>>> print "Content-type: text/html\n\n";
>>>> print "show me the monkey";
>>>>
>>>> Replacing "\n" with "" does not help.
>>>> Replacing \n\n with \r\n or \n\n\n or \n\n\n\n or \r\n\r\n does not
>>>> help.
>>>>
>>>> Removing either or both headers does not change the outcome.
>>>>
>>>> Running the same script as .plx with ISAPI and perlis.dll works.
>>>> Running the same script as .cgi with perl.exe does not work. Running
>>>> the .pl script from command line with perl.exe does work.
>>>>
>>>> The web extension is set up properly. Permissions on perl.exe and the
>>>> .pl script seem fine for the anonymous IIS user, and for the identity
>>>> of the app pool. The .pl file extension is properly mapped to
>>>> C:\Perl\bin\perl.exe "%s" %s
>>>>
>>>> There seems to be no doubt that ActivePerl with IIS 6 on Win Serv 2003
>>>> is finicky.
>>>>
>>>> What can be done to get .pl scripts to work in this environment?
>>>>
>>>> Anybody know?
>>>>
>>>> Jim
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
------------------------------
Date: Fri, 15 Apr 2005 20:15:32 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: alternatives to HTTP
Message-Id: <425f9505@x-privat.org>
jrefactors@hotmail.com wrote:
> HTTP is the protocol that how client server communicates. HTTP is on
> top of TCP/IP stack. correct?
>
> I want to ask if there are alternatives to HTTP? web services are using
> HTTP also?
>
> please advise. thanks!!
There are hundreds of standard protocols: http, https, ftp, DNS, BGP, OSPF,
etc.
They are in documents called Requests for Comments, and there some 3500
documents. http://www.faqs.org/rfcs/
You can implement these or make up your own.
gtoomey
------------------------------
Date: 15 Apr 2005 07:45:11 -0700
From: charles_blanchet@hotmail.com (CB)
Subject: Re: COM+ component call with Perl
Message-Id: <afb1fffd.0504150645.3aebff4@posting.google.com>
use Win32::OLE;
my $Ressources = Win32::OLE->GetActiveObject('prjProject.clsClass');
$Ressources->FunctionNameInClass($param1, $param2);
My function don't return a object. A string should be turned over by
my function. What is the problem ?
thanks
Eric Bohlman <ebohlman@omsdev.com> wrote in message news:<Xns9638C9A993228ebohlmanomsdevcom@130.133.1.4>...
> charles_blanchet@hotmail.com (CB) wrote in
> news:afb1fffd.0504141202.36fab59d@posting.google.com:
>
> > Hi,
> > I would like to use a fonctionnality in a Com+ component (DLL create
> > with VB6) with Perl Script.
> >
> > How to make to call the DLL functions with Perl command ?
>
> use Win32::OLE;
------------------------------
Date: 15 Apr 2005 06:14:35 -0700
From: "Rishi Dhupar" <rishid@gmail.com>
Subject: Comparing 2 XML files need some suggestions please
Message-Id: <1113570875.113715.307950@f14g2000cwb.googlegroups.com>
Hi,
I have two files that look like:
<ROOT>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcldr.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>150528</FileSize>
</File>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcsetup.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>163840</FileSize>
</File>
</ROOT>
There are about 60,000 File nodes in both files (30 mb or so). The
files nodes are in different order in the files, what module could I
use to do something like this? Just looking for string to string
comparasion? And spit out any discrepancies between the two files.
Thanks for the help,
Rishi D
------------------------------
Date: Fri, 15 Apr 2005 23:50:14 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Comparing 2 XML files need some suggestions please
Message-Id: <425fc763@x-privat.org>
Rishi Dhupar wrote:
> Hi,
>
> I have two files that look like:
> <ROOT>
> <File>
> <FileOwner></FileOwner>
> <FilePath>C:\</FilePath>
> <FileName>arcldr.exe</FileName>
> <FileAccessed>4/12/2005</FileAccessed>
> <FileModified>6/19/2003</FileModified>
> <FileCreated>12/07/1999</FileCreated>
> <FileSize>150528</FileSize>
> </File>
> <File>
> <FileOwner></FileOwner>
> <FilePath>C:\</FilePath>
> <FileName>arcsetup.exe</FileName>
> <FileAccessed>4/12/2005</FileAccessed>
> <FileModified>6/19/2003</FileModified>
> <FileCreated>12/07/1999</FileCreated>
> <FileSize>163840</FileSize>
> </File>
> </ROOT>
>
>
> There are about 60,000 File nodes in both files (30 mb or so). The
> files nodes are in different order in the files, what module could I
> use to do something like this? Just looking for string to string
> comparasion? And spit out any discrepancies between the two files.
>
> Thanks for the help,
>
> Rishi D
I'd make sure they are 'in order' (maybe sort the files based on filename
using Perl) and use unix 'diff'.
But why do you need to do this? (For incremental backup?) What happens if
entire subdirectory trees are missing?
gtoomey
------------------------------
Date: 15 Apr 2005 07:43:15 -0700
From: "Rishi Dhupar" <rishid@gmail.com>
Subject: Re: Comparing 2 XML files need some suggestions please
Message-Id: <1113576194.966905.210210@f14g2000cwb.googlegroups.com>
I am testing whether or not a File scan from an application we write is
accurate on all types of O/S. So I have the application ouput and then
I run a file scan using perl. Then I want to compare the two results
and see if there are any errors.
------------------------------
Date: Fri, 15 Apr 2005 14:58:01 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Comparing 2 XML files need some suggestions please
Message-Id: <d3okpp$epe$1@titan.btinternet.com>
Rishi Dhupar wrote:
> Hi,
>
> I have two files that look like:
> <ROOT>
> <File>
> <FileOwner></FileOwner>
> <FilePath>C:\</FilePath>
> <FileName>arcldr.exe</FileName>
> <FileAccessed>4/12/2005</FileAccessed>
> <FileModified>6/19/2003</FileModified>
> <FileCreated>12/07/1999</FileCreated>
> <FileSize>150528</FileSize>
> </File>
> <File>
> <FileOwner></FileOwner>
> <FilePath>C:\</FilePath>
> <FileName>arcsetup.exe</FileName>
> <FileAccessed>4/12/2005</FileAccessed>
> <FileModified>6/19/2003</FileModified>
> <FileCreated>12/07/1999</FileCreated>
> <FileSize>163840</FileSize>
> </File>
> </ROOT>
>
>
> There are about 60,000 File nodes in both files (30 mb or so). The
> files nodes are in different order in the files, what module could I
> use to do something like this? Just looking for string to string
> comparasion? And spit out any discrepancies between the two files.
>
I'd do something like ...
perl -ne <foo> file1 | sort > file1.txt
perl -ne <foo> file2 | sort > file2.txt
diff file1.txt file2.txt
rm file[12].txt
where <foo> is something like (untested) ...
$x.=$_; if (m!^\s*</filea>\s*$!) { print "$x\n"; $x=''; }
But I'm not a perl wizard, so there's certain to be far better ways to
do this :-)
------------------------------
Date: Fri, 15 Apr 2005 16:34:03 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: Composants application COM+ =?ISO-8859-1?Q?appel=E9s_en_?= =?ISO-8859-1?Q?PERL?=
Message-Id: <%1S7e.1966$J12.1788@newssvr14.news.prodigy.com>
CB wrote:
> Bonjour,
> J'aimerais que mon script PERL puisse utiliser des fonctionnalités
> d'une composante (DLL codé en VB6) présente dans une application COM+.
>
> Qu'elle est la façon de faire en Perl pour que je puisse appeler et
> utiliser les fonctions et méthodes de cette DLL ?
Voir Win32::API dans CPAN (search.cpan.org).
--Ala
------------------------------
Date: 15 Apr 2005 10:53:00 -0700
From: hackeras@gmail.com (Spock)
Subject: Re: Creating o non-existing database
Message-Id: <edb4631.0504150953.322532c@posting.google.com>
Whats Webmin?
------------------------------
Date: Fri, 15 Apr 2005 17:48:01 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: Re: how to read file when this file is locking....
Message-Id: <d3o2lv$sst$1@netnews.hinet.net>
sorry ! my english is very poor. i can not understand what is top-post.
am i top-post now??
Question:
how to make the program(app1.pl) append data to the file(testfile) and
read(app2.pl) the file in the same time but it can not append data in the
same time(ex.run app1.pl >= 2 times)?
<snip>
app1:
#!/usr/bin/perl
use Fcntl qw(:DEFAULT :flock);
open(HANDLE,">>testfile");
&lock;
for (1..15){
print HANDLE "process $$ is adding this line # $_\n";
sleep 2;
}
close(HANDLE);
sub lock {
print "Now trying to get lock...\n";
flock(HANDLE,LOCK_EX) or die "could not lock file: $!";
# if replace LOCK_EX with LOCK_SH
#solaris will get error message ~ could not lock file: Bad file number
at ./flock.pl line xx"
#win2k will got null file(data not append to file) but no error
messages
print "locked!\n";
seek(HANDLE, 0, 2);
}
app2:
#!/usr/bin/perl
F:open(HANDLE,"testfile");
use Fcntl qw(:DEFAULT :flock);
flock(HANDLE,LOCK_SH);
while(<HANDLE>){
print $_,"\n";
}
close(HANDLE);
goto F;
------------------------------
Date: Fri, 15 Apr 2005 08:03:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: how to read file when this file is locking....
Message-Id: <slrnd5vesp.bnn.tadmc@magna.augustmail.com>
sonet <sonet.all@msa.hinet.net> wrote:
>
> if i use flock LOCK_EX flag when append data(app1),another program(app2)
> that use LOCK_SH flag
> can not read the file until app1 execute LOCK_UN or close filehandle.
Yes, that is exactly how file locking is *supposed* to work.
How is that a problem?
> if i use flock LOCK_SH flag when append data(app1),
A shared lock should be used only for *readers* of the file.
File writers should get an exclusive lock.
[ snip TOFU, please learn the proper way of composing a followup ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 15 Apr 2005 11:41:40 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: how to read file when this file is locking....
Message-Id: <N6adnc8BquopfcLfRVn-pA@comcast.com>
sonet wrote:
>
> if i use flock LOCK_EX flag when append data(app1),another program(app2)
> that use LOCK_SH flag
> can not read the file until app1 execute LOCK_UN or close filehandle.
>
> Solaris:
> if i use flock LOCK_SH flag when append data(app1), i got the message
> "could not lock file: Bad file
> number at ./flock.pl line xx"
>
> Win2k:
> if i use flock LOCK_SH flag when append data,i got null file(data not
> append to file).
Well, yes. That's how locking works. You're asking to lock the file,
but not really lock it after all. That seems self-defeating.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Fri, 15 Apr 2005 09:16:17 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: how to read file when this file is locking....
Message-Id: <slrnd5vj5g.bqr.tadmc@magna.augustmail.com>
sonet <sonet.all@msa.hinet.net> wrote:
> sorry ! my english is very poor. i can not understand what is top-post.
http://www.catb.org/~esr/jargon/html/T/top-post.html
> am i top-post now??
No, now you have a *different* problem, namely you are not
quoting any context.
Have you seen the Posting Guidelines that are posted here frequently?
Have you followed this link from the guidelines?
http://web.presby.edu/~nnqadmin/nnq/nquote.html
> Question:
> how to make the program(app1.pl) append data to the file(testfile) and
> read(app2.pl) the file in the same time
You will introduce a race if you insist on doing that.
You must not read while any process is writing, else you risk
getting a corrupted read.
> open(HANDLE,">>testfile");
You should always, yes *always*, check the return value from open():
open(HANDLE,">>testfile") or die "could not open 'testfile' $!";
> &lock;
You should not use an ampersand on function calls unless you know
why you are using an ampersand on function calls. See perlsub.pod
for what the difference is.
lock();
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 15 Apr 2005 18:01:19 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: how to read file when this file is locking....
Message-Id: <3ca6tsF6if61bU1@individual.net>
Tad McClellan wrote:
> sonet <sonet.all@msa.hinet.net> wrote:
>>if i use flock LOCK_SH flag when append data(app1),
>
> A shared lock should be used only for *readers* of the file.
>
> File writers should get an exclusive lock.
Well, it was I who suggested LOCK_SH since the OP asked for a locking
method that would prevent other processes from writing while still
allowing reading. The thought was that the (admittedly unusual) method
would prevent other programs from getting exclusive locks.
Was it an improper advice?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 15 Apr 2005 16:40:51 GMT
From: xhoster@gmail.com
Subject: Re: how to read file when this file is locking....
Message-Id: <20050415124051.224$CG@newsreader.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Tad McClellan wrote:
> > sonet <sonet.all@msa.hinet.net> wrote:
> >>if i use flock LOCK_SH flag when append data(app1),
> >
> > A shared lock should be used only for *readers* of the file.
> >
> > File writers should get an exclusive lock.
>
> Well, it was I who suggested LOCK_SH since the OP asked for a locking
> method that would prevent other processes from writing while still
> allowing reading. The thought was that the (admittedly unusual) method
> would prevent other programs from getting exclusive locks.
>
> Was it an improper advice?
Yes and no. Your advice would allow him to accomplish his (probably
irrational) immediate goal, on some systems. Other systems do not allow
this. I prefer the first systems over the second. If the system is going
to arrogantly decide that share can only be used for reading and exclusive
can only be used for writing, why not just call them "read" and "write"
rather than "share" and "exclusive"?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 15 Apr 2005 09:54:11 -0700
From: mike_solomon@lineone.net (Mike Solomon)
Subject: memory leak in loop
Message-Id: <56568be5.0504150854.4b74f777@posting.google.com>
Using the following code I get a memory leak
I am using ActiveState Perl 5.8.0 on Windows
I suspect it is caused by Xbase
Any ideas to fix it would be much appreciated
use strict;
use XBase;
for (0 .. 100000000) { Process($_); sleep 3;}
exit;
sub Process {
my ($counter) = @_;
my $error;
my $dbf;
unless ($dbf = new XBase "survey.dbf") {
$error = XBase->errstr;
print $error;
}
#get last record from audit
my $last = $dbf->last_record;
$dbf->close;
print "LAST RECORD FROM dbf $last $counter\n";
return;
}
__END__
------------------------------
Date: 15 Apr 2005 11:02:40 -0700
From: soup_or_power@yahoo.com
Subject: Net::FTP problem
Message-Id: <1113588160.814864.315660@f14g2000cwb.googlegroups.com>
The following code is generating the error: can't connect (in the code
below) I'm guessing the FTP is sending the username and hostname
separated by @ instead of sending just the host name followed by user
name and password and commands. It worked fine for some time but now
quit on me. Thanks for any of your help.
sub get_ftp_handle {
my($self, $ftp_host, $ftp_user, $ftp_pwd)=@_;
my $ftp_site = $ftp_host || "storm";
my $ftp_pass = $ftp_pwd || "pqww2o4";
$ftp_user ||= "qauser";
my $ftp = Net::FTP->new($ftp_site) || do {
warn "$ftp_user\@$ftp_site: can't connect\n";
return -1;
};
$ftp->login($ftp_user, $ftp_pass) || warn "$ftp_user\@$ftp_site:
can't login\n";
$ftp->binary();
return $ftp || die("cannot open ftp connection");
}
------------------------------
Date: 15 Apr 2005 09:33:36 -0700
From: rob_1029384756@hotmail.co.uk
Subject: PDF and Word to screen
Message-Id: <1113582816.318561.97130@z14g2000cwz.googlegroups.com>
Hi,
I'm having a few difficulties with perl. I have a database (mysql)
full of files, in particular medium blobs all of which are word
documents (for 1 type) and pdf's (for another type). I can download
these quite happily (all works / no corruption).
However, what I would really like to do is load a page with some text,
the infomation on the word document, and the info on the pdf.
Is this possible? I have been searching, but am finding nothing except
a little about creating pdf/docs. If so, it would be a great help if
someone could point me in the right direction or link me to any
documentation.
Unsure to what version of perl I am using (will be quite recent) but
its being run on unix servers.
Thanks for any help,
Rob.
------------------------------
Date: 15 Apr 2005 05:05:01 -0700
From: bkimelman@hotmail.com
Subject: Problem using defined constants as hash keys
Message-Id: <1113566700.997194.71500@o13g2000cwo.googlegroups.com>
I am using perl version 5.8.6 on a Windows XP PC.
I am having a problem using defined constants as hash keys.
Here is an examaple to demonstrate the problem
====================================
use strict;
use constant;
use Class::Struct;
use Data::Dumper;
use constant OPT_BOOLEAN => 'b';
use constant OPT_STRING => 's';
use constant OPT_INTEGER => 'i';
use constant OPT_NOPARM => '-';
my ( %types );
%types = ( OPT_BOOLEAN => "boolean flag" , OPT_STRING => "string" ,
OPT_INTEGER => "integer" , OPT_NOPARM => "" ) ;
print Dumper(\%types),"\n";
exit 0;
==============================
When I run the above perl script the output from the print statement
shows the "names" of the defined constants as the values of the hash
keys. Can you get it to use the value of the defined constants as the
values of the hash keys ?
Currently I am forced into doing this until I c an solve this problem :
@parm_types = ( OPT_BOOLEAN , OPT_STRING , OPT_INTEGER , OPT_NOPARM );
@parm_type_notes = ( "boolean flag" , "string" , "integer" , "" );
%types = map { $parm_types[$_] , $parm_type_notes[$_] } ( 0 ..
$#parm_types);
------------------------------
Date: Fri, 15 Apr 2005 14:27:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem using defined constants as hash keys
Message-Id: <3c9qcbF6nefquU1@individual.net>
bkimelman@hotmail.com wrote:
> I am having a problem using defined constants as hash keys.
>
> Here is an examaple to demonstrate the problem
>
> ====================================
>
> use strict;
> use constant;
> use Class::Struct;
> use Data::Dumper;
>
> use constant OPT_BOOLEAN => 'b';
> use constant OPT_STRING => 's';
> use constant OPT_INTEGER => 'i';
> use constant OPT_NOPARM => '-';
>
> my ( %types );
>
> %types = ( OPT_BOOLEAN => "boolean flag" , OPT_STRING => "string" ,
> OPT_INTEGER => "integer" , OPT_NOPARM => "" ) ;
>
> print Dumper(\%types),"\n";
>
> exit 0;
>
> ==============================
>
> When I run the above perl script the output from the print statement
> shows the "names" of the defined constants as the values of the hash
> keys. Can you get it to use the value of the defined constants as the
> values of the hash keys ?
Yes, you can do
%types = ( OPT_BOOLEAN() => "boolean flag", ...
--------------------------^^
See the "Bugs" section in "perldoc constant".
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 15 Apr 2005 08:09:20 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Problem using defined constants as hash keys
Message-Id: <slrnd5vf80.bnn.tadmc@magna.augustmail.com>
bkimelman@hotmail.com <bkimelman@hotmail.com> wrote:
> I am having a problem using defined constants as hash keys.
> use constant OPT_BOOLEAN => 'b';
> use constant OPT_STRING => 's';
> %types = ( OPT_BOOLEAN => "boolean flag" , OPT_STRING => "string" ,
> When I run the above perl script the output from the print statement
> shows the "names" of the defined constants as the values of the hash
> keys.
Because => is auto-quoting the constant's names.
> Can you get it to use the value of the defined constants as the
> values of the hash keys ?
Sure, you can either write it so that auto-quoting won't quote:
%types = ( OPT_BOOLEAN() => "boolean flag", OPT_STRING() => "string",
or don't use the operator that does auto-quoting:
%types = ( OPT_BOOLEAN, "boolean flag", OPT_STRING, "string",
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 7978
***************************************