[26075] in Perl-Users-Digest
Perl-Users Digest, Issue: 8276 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 25 09:05:31 2005
Date: Mon, 25 Jul 2005 06:05:06 -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 Mon, 25 Jul 2005 Volume: 10 Number: 8276
Today's topics:
Argument list too long (keep reading, it's not the FAQ) <pasdepub.Hugues.de-Mazancourt@lingway.com>
paging page trouble <""alexjaquet\"@[no spam]msn.com">
Re: paging page trouble <dejanews@email.com>
Re: posting an array <bart.lateur@pandora.be>
Re: posting an array <usenet@NOSPAM.obantec.net>
Re: Question about hashes of hashes (Anno Siegel)
Re: Question about hashes of hashes <scobloke2@infotop.co.uk>
Re: standalone perl interpreter for Windows? <prawnMUNG@prawn.me.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 25 Jul 2005 14:28:02 +0200
From: "Hugues de Mazancourt" <pasdepub.Hugues.de-Mazancourt@lingway.com>
Subject: Argument list too long (keep reading, it's not the FAQ)
Message-Id: <dc2m50$hg2$1@s1.news.oleane.net>
Hi,
I have a Perl deamon that keeps running, forking other (perl) processes,
which in turn issue (among other things) system() calls.
After some time (...), the scripts issue "Argument list too long" to every
system() that is made, as if there was a global buffer that ran out of
space.
I don't have any wildcards in my system() calls, no <*> either.
My solution was to make the daemon loop a certain number of times, then
exiting, and have a shell-script that re-lauches the deamon every time it is
finished. This works, but is little satisfactory, and I'm constantly
decreasing that "certain number", as new installations raise the problem
again and again.
Platform is Linux, FC-[1-3] or RH-9.
Any ideas ?
Best,
Hugues
--
Hugues de Mazancourt
CTO
Lingway
33-35, rue Ledru-Rollin
94200 Ivry/Seine
FRANCE
http://www.lingway.com
Tel: +33-1 56 20 28 33 - Mob: +33-6 72 78 70 33
------------------------------
Date: Mon, 25 Jul 2005 10:10:09 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: paging page trouble
Message-Id: <42e49e74$0$1148$5402220f@news.sunrise.ch>
Hi
I got a little trouble while trying to create index of pages
I want to to something like :
<0-> <-1-> <-2-> <-3->
once user click <-3-> new page counter start with
<4-> <-5-> <-6-> <-7-> ..
I do like that :
local our $nb_page = arrondi ($total / 4, 1);
local our $min_index = $query->param("min_index") || '0';
local our $max_index = $query->param("max_index") || '4';
local our $page_nbr = $query->param("pagenbr") ;
local our $page_start = $query->param("page_start") || '0';;
local our $page_end = $query->param("page_end") || '4';;
local our $tmp = $page_nbr + 1;
local our $tmp2 = $tmp %= 4;
local our $max = $max_index;
if ($tmp2 eq '0') {
$page_start = $page_end;
$page_end = $page_end + 4;
$min_index = $max_index;
$max_index = $max_index + 4;
}
for (local our $i = $page_start; $i < $page_end;$i++) {
$string .= "<a
href=\"/cgi-bin/recordz.cgi?lang=$lang&session=$session_id&min_index=$min_index&max_index=$max_index&cat=$cat&depot=$depot&pagenbr=$page_nbr&page_start=$page_start&page_end=$page_end\"
class=\"menulink\" class=&{ns4class};><-$i-></a> <img
src=\"../images/next.gif\">";
$min_index += 4;
$max_index = $min_index + 4;
$page_nbr += 1;
$page_end = $page_start + 4;
}
but my result is false is wrong when I click
a page number like <-1-> the second time I click for this page the page
number is one position bigger
exemple :
http://supermarket.no-ip.biz/cgi-bin/recordz.cgi?lang=fr&session=f37e7364eee6306f4d1092048df6f1dd;
------------------------------
Date: Mon, 25 Jul 2005 12:11:41 GMT
From: samwyse <dejanews@email.com>
Subject: Re: paging page trouble
Message-Id: <1G4Fe.360$IH2.67@newssvr27.news.prodigy.net>
Alexandre Jaquet > wrote:
> Hi
>
> I got a little trouble while trying to create index of pages
>
> I want to to something like :
>
> <0-> <-1-> <-2-> <-3->
> once user click <-3-> new page counter start with
>
> <4-> <-5-> <-6-> <-7-> ..
>
> I do like that :
>
> local our $nb_page = arrondi ($total / 4, 1);
> local our $min_index = $query->param("min_index") || '0';
> local our $max_index = $query->param("max_index") || '4';
> local our $page_nbr = $query->param("pagenbr") ;
> local our $page_start = $query->param("page_start") || '0';;
> local our $page_end = $query->param("page_end") || '4';;
[snip]
It looks to me like your params are getting out of sync. Instead of
passing everything each time, why not calculate it all from the current
page number? This is untested code, but I think it does what you intend.
use constant PAGESPAN => 4;
use constant ITEMSPERPAGE => 4;
my $nb_page = arrondi ($total / ITEMSPERPAGE, 1);
my $page_nbr = $query->param('pagenbr');
my $page_start = max(0, $page_nbr - PAGESPAN )
my $page_end = min(nb_page, $page_nbr + PAGESPAN )
my $min_index = ITEMSPERPAGE * $page_nbr;
my $max_index = $min_index + ITEMSPERPAGE - 1;
BTW, why the 'local our' in your code? Is that your own convention, or
just something I've not seen before? Also, it's a good idea to not use
any constants other than 0 or 1 in your code. You seem to be using 4
for two distinct things; you've just made trouble for yourself if you
ever want to change one and not the other.
------------------------------
Date: Mon, 25 Jul 2005 10:26:58 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: posting an array
Message-Id: <r3f9e1lvs04oelc6f703aj8f8mgj9ronhm@4ax.com>
Mark D Smith wrote:
>i am posting a hidden values called accounts which is a number of usernames
>pushed to an array.
>
>print "<input type=hidden name=accounts value=\"@accounts\">";
>
>the page that receives the data should be able to unpack the array but i am
>having problems
Use one such line per array item. And please *html-escape* each item.
foreach (@accounts) {
printf "<input type=hidden name=accounts value=\"%s\">\n",
escapeHTML($_);
}
>&ReadParse();
Ugh. Please don't tell me you're still using cgilib.pl.
escapeHTML() is exported if you use CGI like this:
use CGI ':standard';
--
Bart.
------------------------------
Date: Mon, 25 Jul 2005 13:55:09 +0100
From: "Mark D Smith" <usenet@NOSPAM.obantec.net>
Subject: Re: posting an array
Message-Id: <42e4e14c$0$30679$db0fefd9@news.zen.co.uk>
"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:r3f9e1lvs04oelc6f703aj8f8mgj9ronhm@4ax.com...
> Mark D Smith wrote:
>
> >i am posting a hidden values called accounts which is a number of
usernames
> >pushed to an array.
> >
> >print "<input type=hidden name=accounts value=\"@accounts\">";
> >
> >the page that receives the data should be able to unpack the array but i
am
> >having problems
>
> Use one such line per array item. And please *html-escape* each item.
>
> foreach (@accounts) {
> printf "<input type=hidden name=accounts value=\"%s\">\n",
> escapeHTML($_);
> }
>
> >&ReadParse();
>
> Ugh. Please don't tell me you're still using cgilib.pl.
>
> escapeHTML() is exported if you use CGI like this:
>
> use CGI ':standard';
>
> --
> Bart.
Hi All
I am modifying a script supplied by someone else who uses cgilib.pl, i do
use CGI for scripts i write from the ground up.
with the input from this group i have resolved my problem.
thanks to all
Mark
------------------------------
Date: 25 Jul 2005 09:03:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about hashes of hashes
Message-Id: <dc29tp$66n$1@mamenchi.zrz.TU-Berlin.DE>
Tom <lfs.1@spam.net> wrote in comp.lang.perl.misc:
> "Sven-Thorsten Fahrbach" <sven-thorsten.fahrbach@gmx.net> wrote in message
> news:20050724231742.6eeb0ab2.sven-thorsten.fahrbach@gmx.net...
> > On Sun, 24 Jul 2005 22:39:31 +0200
> > djacober <djacober@swissonline.ch> wrote:
[...]
> > > my $ref_color = @_;
> >
> > Wrong context. This doesn't mean 'give me the first element of @_' (which
> is what you probably had in mind) but 'give me the number of elements in the
> list'. You pass the hashref \%white to the sub, so @_ contains one element,
> i.e. 1 is being assigned to $ref_color, hence the error message 'Can't use
> string ("1")...'. What you want to do is either:
[...]
> I am still having trouble with why "1" is not X0001
> or some such.
$ref_color becomes the number of elements in the array @_. In the given
case the number is 1. It is not X0001 and will never be.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Mon, 25 Jul 2005 10:01:21 +0000 (UTC)
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Question about hashes of hashes
Message-Id: <dc2d9h$q6q$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>
Anno Siegel wrote:
> Tom <lfs.1@spam.net> wrote in comp.lang.perl.misc:
>
>>"Sven-Thorsten Fahrbach" <sven-thorsten.fahrbach@gmx.net> wrote in message
>>news:20050724231742.6eeb0ab2.sven-thorsten.fahrbach@gmx.net...
>>
>>>On Sun, 24 Jul 2005 22:39:31 +0200
>>>djacober <djacober@swissonline.ch> wrote:
>
>
> [...]
>
>
>>>> my $ref_color = @_;
>>>
>>>Wrong context. This doesn't mean 'give me the first element of @_' (which
>>
>>is what you probably had in mind) but 'give me the number of elements in the
>>list'. You pass the hashref \%white to the sub, so @_ contains one element,
>>i.e. 1 is being assigned to $ref_color, hence the error message 'Can't use
>>string ("1")...'. What you want to do is either:
>
>
> [...]
>
>
>>I am still having trouble with why "1" is not X0001
>>or some such.
>
>
> $ref_color becomes the number of elements in the array @_. In the given
> case the number is 1. It is not X0001 and will never be.
>
It seems to me that Tom's question was about the internal representation
hinted at by the error message. The number of elements in an array is an
integer so why does the error message mention a string? Why seemingly
hex 0x31 and not hex 0x01?
Anno's answer still applies of course but doesn't shed much light on
perl's choice of internal representations.
I suspect the error message is mainly saying that the thing was not a
hash ref. Perl seems happy to transform string representations of
numbers into numbers as needed for arithmentic etc. As an
unsophisticated programmer of Perl I mostly don't need to know or care
about whether perl stores numbers as strings internally.
------------------------------
Date: Mon, 25 Jul 2005 13:41:42 +0100
From: prawn <prawnMUNG@prawn.me.uk>
Subject: Re: standalone perl interpreter for Windows?
Message-Id: <3kk4vqFuv5ulU1@individual.net>
DN wrote:
> Are there any free or inexpensive standalone perl interpreters for writing
> and testing PHP code on Windows? I'd like to avoid having to install or
> activate web server software.
>
> Thanks.
FWIW, I use IndigoPerl <http://www.indigostar.com/indigoperl.htm>.
HTH.
--
p
------------------------------
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 8276
***************************************