[31294] in Perl-Users-Digest
Perl-Users Digest, Issue: 2539 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 18:09:43 2009
Date: Thu, 6 Aug 2009 15:09:09 -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, 6 Aug 2009 Volume: 11 Number: 2539
Today's topics:
conditional modules <john1949@yahoo.com>
Re: conditional modules <thepoet_nospam@arcor.de>
Re: conditional modules <smallpond@juno.com>
Re: FAQ 8.14 How do I modify the shadow password file o <kst-u@mib.org>
Re: Function prototype <willem@stack.nl>
Re: Function prototype <rkb@i.frys.com>
Re: Function prototype <tadmc@seesig.invalid>
Re: Function prototype <tzz@lifelogs.com>
Re: Function prototype <cwilbur@chromatico.net>
Re: Function prototype <usenet05@drabble.me.uk>
Re: Function prototype <tadmc@seesig.invalid>
Re: Function prototype <hjp-usenet2@hjp.at>
Re: Help with traversing an XML structure <thepoet_nospam@arcor.de>
Re: Improving page layout when doing elementary CGI pro <smallpond@juno.com>
Re: Improving page layout when doing elementary CGI pro <sbryce@scottbryce.com>
issue with multiprocess - fork <hirenshah.05@gmail.com>
PIA Earned $6 Million through Engineering services <shahzad021@gmail.com>
Re: problem with fork <hirenshah.05@gmail.com>
Re: Process to upload multiple files from a single <inp <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 6 Aug 2009 17:03:09 +0100
From: "John" <john1949@yahoo.com>
Subject: conditional modules
Message-Id: <h5eurq$odc$1@news.albasani.net>
Hi
Can you access modules with a condition, ie
my ($language,$text);
if ($language eq 'English') {use English; $text=new English;}
elsif ($language eq 'German') {use German; $text=new German;}
etc
or is this preferable
use Language qw(english};
I don't want to load all languages when I am going to use only one.
Regards
John
------------------------------
Date: Thu, 06 Aug 2009 18:45:00 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: conditional modules
Message-Id: <4a7b087f$0$32675$9b4e6d93@newsspool2.arcor-online.net>
John wrote:
> Can you access modules with a condition, ie
>
> my ($language,$text);
> if ($language eq 'English') {use English; $text=new English;}
> elsif ($language eq 'German') {use German; $text=new German;}
> etc
>
> or is this preferable
>
> use Language qw(english};
>
> I don't want to load all languages when I am going to use only one.
How about the following?
use Language;
my $text = new Language('English');
-Chris
------------------------------
Date: Thu, 6 Aug 2009 13:59:52 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: conditional modules
Message-Id: <a5e096fd-16bc-4250-afa6-f99df761913b@h30g2000vbr.googlegroups.com>
On Aug 6, 12:03=A0pm, "John" <john1...@yahoo.com> wrote:
> Hi
>
> Can you access modules with a condition, ie
>
> my ($language,$text);
> if ($language eq 'English') {use English; $text=3Dnew English;}
> elsif ($language eq 'German') {use German; $text=3Dnew German;}
> etc
>
> or is this preferable
>
> use Language qw(english};
>
> I don't want to load all languages when I am going to use only one.
=3D=3D=3D foo =3D=3D=3D
$pkg =3D shift;
eval "use $pkg";
MainWindow->new();
MainLoop();
perl foo Tk
This brought up a Tk window so I guess runtime
package binding is fine.
You need to eval the use statement that you want to
do to avoid having all of your packages loaded at
compile time.
------------------------------
Date: Thu, 06 Aug 2009 09:52:24 -0700
From: Keith Thompson <kst-u@mib.org>
Subject: Re: FAQ 8.14 How do I modify the shadow password file on a Unix system?
Message-Id: <lnhbwkj35j.fsf@nuthaus.mib.org>
PerlFAQ Server <brian@stonehenge.com> writes:
[...]
> 8.14: How do I modify the shadow password file on a Unix system?
>
> If perl was installed correctly and your shadow library was written
> properly, the getpw*() functions described in perlfunc should in theory
> provide (read-only) access to entries in the shadow password file. To
> change the file, make a new shadow password file (the format varies from
> system to system--see passwd for specifics) and use pwd_mkdb(8) to
> install it (see pwd_mkdb for more details).
[...]
This should mention that pwd_mkdb may not be available on all
systems. It doesn't exist on my Ubuntu system or on Solaris 9.
I think it's a BSDism.
There are probably recommended ways to modify the shadow password
file on systems that don't have pwd_mkdb, but I don't know what they
are, other than the usual tools that create or modify individual
entries. In fact, using the usual tools is probably better than
trying to modify the file anyway.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
------------------------------
Date: Thu, 6 Aug 2009 13:29:06 +0000 (UTC)
From: Willem <willem@stack.nl>
Subject: Re: Function prototype
Message-Id: <slrnh7lml2.24mr.willem@turtle.stack.nl>
pavunkumar wrote:
) I want to write a function , that should accept specific
) number of arguments .
) example :
)
) I have a function called "add" , I wrote definition for that adding
) two numbers,which I am going to pass as a argument. In this case if I
) pass more than two argument, compile has to say error. Actually it is
) not saying . So How can I achieve this one.
Rewrite the function 'add' so that it can add any number of arguments.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
------------------------------
Date: Thu, 6 Aug 2009 06:43:18 -0700 (PDT)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Function prototype
Message-Id: <97bd9d67-d41c-4b7d-b024-0bd4671a1696@a37g2000prf.googlegroups.com>
On Aug 6, 6:01=A0am, pavunkumar <pavun....@gmail.com> wrote:
> On Aug 6, 5:45 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>
>
>
> > pavunkumar <pavun....@gmail.com> wrote:
> > > =A0 How can I declare the prototype for a function =A0in
> > > Perl.
>
> > It is exceedingly likely that you do NOT want to declare a
> > prototype for a function.
>
> > What is it that you hope to accomplish by using a prototype?
>
> > See why Perl's prototypes are nearly always not what you are looking fo=
r:
>
> > =A0 =A0http://www.perl.com/language/misc/fmproto.html
>
> > --
> > Tad McClellan
> > email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> Dear Sir,
>
> =A0 =A0 =A0 =A0 I want to write a function , that should accept specific
> number of arguments .
> example :
>
> I have a function called "add" =A0, I wrote definition for that adding
> two numbers,which I am going to pass as a argument. =A0In this case if I
> pass more than two argument, compile has to say error. Actually it is
> not saying . So How can I achieve this one.
>
> Thanks.
The args passed to the sub are in the @_ array. So, just check the
number of elements in the array then print your warning and exit the
sub if the count isn't what you want.
------------------------------
Date: Thu, 06 Aug 2009 08:48:04 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Function prototype
Message-Id: <slrnh7lnah.e80.tadmc@tadmc30.sbcglobal.net>
pavunkumar <pavun.bks@gmail.com> wrote:
> On Aug 6, 5:45 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>> pavunkumar <pavun....@gmail.com> wrote:
>> > How can I declare the prototype for a function in
>> > Perl.
>>
>> It is exceedingly likely that you do NOT want to declare a
>> prototype for a function.
>>
>> What is it that you hope to accomplish by using a prototype?
>>
>> See why Perl's prototypes are nearly always not what you are looking for:
>>
>> http://www.perl.com/language/misc/fmproto.html
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
It is bad manners to quote .sigs.
> Dear Sir,
>
> I want to write a function , that should accept specific
> number of arguments .
Did you read the link I provided?
Perl's prototypes do not do that... so we were right, you
do not want (or need) prototypes to accomplish what you want.
> I have a function called "add" , I wrote definition for that adding
> two numbers,which I am going to pass as a argument. In this case if I
> pass more than two argument, compile has to say error. Actually it is
> not saying . So How can I achieve this one.
sub add {
die "add() must be called with exactly 2 arguments\n" unless @_ == 2;
...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 06 Aug 2009 10:07:06 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Function prototype
Message-Id: <877hxhq8v9.fsf@lifelogs.com>
On Thu, 06 Aug 2009 08:48:04 -0500 Tad J McClellan <tadmc@seesig.invalid> wrote:
TJM> pavunkumar <pavun.bks@gmail.com> wrote:
>> I have a function called "add" , I wrote definition for that adding
>> two numbers,which I am going to pass as a argument. In this case if I
>> pass more than two argument, compile has to say error. Actually it is
>> not saying . So How can I achieve this one.
TJM> sub add {
TJM> die "add() must be called with exactly 2 arguments\n" unless @_ == 2;
TJM> ...
On Thu, 6 Aug 2009 06:43:18 -0700 (PDT) Ron Bergin <rkb@i.frys.com> wrote:
RB> The args passed to the sub are in the @_ array. So, just check the
RB> number of elements in the array then print your warning and exit the
RB> sub if the count isn't what you want.
He specifically asked for compile-time checks.
OP: look at `perldoc perlsub' to learn about prototypes. Here are some
examples from the documentation (you probably want the first example):
Declared as Called as
sub mylink ($$) mylink $old, $new
sub myvec ($$$) myvec $var, $offset, 1
sub myindex ($$;$) myindex &getstring, "substr"
sub mysyswrite ($$$;$) mysyswrite $buf, 0, length($buf) - $off, $off
sub myreverse (@) myreverse $a, $b, $c
sub myjoin ($@) myjoin ":", $a, $b, $c
sub mypop (\@) mypop @array
sub mysplice (\@$$@) mysplice @array, @array, 0, @pushme
sub mykeys (\%) mykeys %{$hashref}
sub myopen (*;$) myopen HANDLE, $name
sub mypipe (**) mypipe READHANDLE, WRITEHANDLE
sub mygrep (&@) mygrep { /foo/ } $a, $b, $c
sub myrand (;$) myrand 42
sub mytime () mytime
Prototypes have many flaws, but they *are* a Perl feature.
Ted
------------------------------
Date: Thu, 06 Aug 2009 11:50:32 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Function prototype
Message-Id: <868whx0wmv.fsf@mithril.chromatico.net>
>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
TZ> On Thu, 06 Aug 2009 08:48:04 -0500 Tad J McClellan
TZ> <tadmc@seesig.invalid> wrote:
TJM> pavunkumar <pavun.bks@gmail.com> wrote:
>>> I have a function called "add" , I wrote definition for that
>>> adding two numbers,which I am going to pass as a argument. In
>>> this case if I pass more than two argument, compile has to say
>>> error. Actually it is not saying . So How can I achieve this
>>> one.
TJM> sub add { die "add() must be called with exactly 2 arguments\n"
TJM> unless @_ == 2; ...
TZ> On Thu, 6 Aug 2009 06:43:18 -0700 (PDT) Ron Bergin
TZ> <rkb@i.frys.com> wrote:
RB> The args passed to the sub are in the @_ array. So, just check
RB> the number of elements in the array then print your warning and
RB> exit the sub if the count isn't what you want.
TZ> He specifically asked for compile-time checks.
And how do you propose that the compiler can check that?
If the compiler sees
my $sum = add(some_function());
how is it supposed to know that some_function() will return exactly two
elements in a list, for instance?
TZ> Prototypes have many flaws, but they *are* a Perl feature.
In this case, however, they're a poor attempt to work around a
fundamental miscomprehension of how Perl works. Better to fix the
miscomprehension than to patch over it with prototypes.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Thu, 06 Aug 2009 16:28:21 +0100
From: Graham Drabble <usenet05@drabble.me.uk>
Subject: Re: Function prototype
Message-Id: <Xns9C5FA791246BEgrahamdrabblelineone@drabble.me.uk>
On 06 Aug 2009 Tad J McClellan <tadmc@seesig.invalid> wrote in
news:slrnh7lnah.e80.tadmc@tadmc30.sbcglobal.net:
> pavunkumar <pavun.bks@gmail.com> wrote:
>> I have a function called "add" , I wrote definition for that
>> adding two numbers,which I am going to pass as a argument. In
>> this case if I pass more than two argument, compile has to say
>> error. Actually it is not saying . So How can I achieve this one.
>
>
> sub add {
> die "add() must be called with exactly 2 arguments\n"
> unless @_ == 2; ...
He does actually say he wants it done at compile time and your solution
works at run time.
I suspect that it's not possible to do what he wants but would love to
be proven wrong.
--
Graham Drabble
http://www.drabble.me.uk/
------------------------------
Date: Thu, 06 Aug 2009 12:53:28 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Function prototype
Message-Id: <slrnh7m5mk.g5s.tadmc@tadmc30.sbcglobal.net>
Graham Drabble <usenet05@drabble.me.uk> wrote:
> On 06 Aug 2009 Tad J McClellan <tadmc@seesig.invalid> wrote in
> news:slrnh7lnah.e80.tadmc@tadmc30.sbcglobal.net:
>
>> pavunkumar <pavun.bks@gmail.com> wrote:
>
>>> I have a function called "add" , I wrote definition for that
>>> adding two numbers,which I am going to pass as a argument. In
>>> this case if I pass more than two argument, compile has to say
>>> error. Actually it is not saying . So How can I achieve this one.
>>
>>
>> sub add {
>> die "add() must be called with exactly 2 arguments\n"
>> unless @_ == 2; ...
>
> He does actually say he wants it done at compile time and your solution
> works at run time.
Oh, I missed that.
Sorry.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 6 Aug 2009 21:45:53 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Function prototype
Message-Id: <slrnh7mcni.3g6.hjp-usenet2@hrunkner.hjp.at>
On 2009-08-06 15:50, Charlton Wilbur <cwilbur@chromatico.net> wrote:
>>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
>
> TZ> On Thu, 06 Aug 2009 08:48:04 -0500 Tad J McClellan
> TZ> <tadmc@seesig.invalid> wrote:
>
> TJM> pavunkumar <pavun.bks@gmail.com> wrote:
>
> >>> I have a function called "add" , I wrote definition for that
> >>> adding two numbers,which I am going to pass as a argument. In
> >>> this case if I pass more than two argument, compile has to say
> >>> error. Actually it is not saying . So How can I achieve this
> >>> one.
>
> TJM> sub add { die "add() must be called with exactly 2 arguments\n"
> TJM> unless @_ == 2; ...
>
> TZ> On Thu, 6 Aug 2009 06:43:18 -0700 (PDT) Ron Bergin
> TZ> <rkb@i.frys.com> wrote:
>
> RB> The args passed to the sub are in the @_ array. So, just check
> RB> the number of elements in the array then print your warning and
> RB> exit the sub if the count isn't what you want.
>
> TZ> He specifically asked for compile-time checks.
>
> And how do you propose that the compiler can check that?
>
> If the compiler sees
>
> my $sum = add(some_function());
>
> how is it supposed to know that some_function() will return exactly two
> elements in a list, for instance?
With a suitable prototype in scope, it knows that some_function() will
return exactly one element, since it is called in scalar context.
Yes, that means that with a prototype
sub add($$);
this
my $sum = add(some_function());
cannot work, because the compiler will notice at compile time that add
has only one argument, not two, and will abort the compilation. This may
be a problem or it may be what the OP wants.
> TZ> Prototypes have many flaws, but they *are* a Perl feature.
>
> In this case, however, they're a poor attempt to work around a
> fundamental miscomprehension of how Perl works. Better to fix the
> miscomprehension than to patch over it with prototypes.
Prototypes are a part of "how Perl works". I'd call denying the
existence of prototypes a fundamental miscomprehension of how Perl
works.
hp
------------------------------
Date: Thu, 06 Aug 2009 19:11:23 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Help with traversing an XML structure
Message-Id: <4a7b0ead$0$32669$9b4e6d93@newsspool2.arcor-online.net>
Michaelp schrieb:
> I have a large number of huge XML-documents that I need to do things
> with relatively fast.
>
> I am trying to use the package XML::CompactTree::XS to interact with
> the (relatively simple) XML-structurem of these documents.
>
> (see a fragment here: http://inex.hio.no/~michaelp/test.xml )
>
> The package parses a tree.
>
> $reader = XML::LibXML::Reader->new(location => $url);
> $tree = XML::CompactTree::XS::readSubtreeToPerl($reader );
>
> Prettyprinting this tree with the aid of a data dumper, I get the
> following:
>
>> print Data::Dumper->Dump($tree);
>
> $VAR1 = 9;
> $VAR2 = 'UTF-8';
> $VAR3 = [
> [
> 1,
> 'document',
> 0,
> undef,
> [
> 'ARRAY(0x260eb90)',
> .
> many of those ...
> .
> 'ARRAY(0xa639448)',
> 'ARRAY(0xa648668)',
> 'ARRAY(0xa649280)'
> ]
> ]
> ];
>
> I am interested in traversing the low-level array (with the many
> entries) with a foreach loop:
>
> foreach $page (@pageAarray){
> # do something
> }
>
> But am unable to get a proper handle to this lowe level array.
>
> I have tried referencing and dereferencing my way down this
> hierarchy, but to no avail. Greatful to any hint.
You have to check the node type, just as in the example in the pod.
When the node type is XML_READER_TYPE_DOCUMENT, the children are in
$node->[2], whereas when it's XML_READER_TYPE_ELEMENT, you need to
expand $node->[4] (or $node->[5], if you passed the XTC_LINE_NUMBERS
flag).
So it should be something like:
...
my $childnodes = $tree->[2];
foreach my $node ( @$childnodes ) {
if( $node->[0] == XML_READER_TYPE_ELEMENT ) {
my $grandchildren = $node->[4];
...
}
}
-Chris
------------------------------
Date: Thu, 6 Aug 2009 14:14:22 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: Improving page layout when doing elementary CGI programming.
Message-Id: <dee81e95-f38a-4fd4-a8e2-1a353eda9280@p28g2000vbn.googlegroups.com>
On Aug 6, 4:46=A0am, Justin C <justin.0...@purestblue.com> wrote:
> On 2009-08-05, Ted Byers <r.ted.by...@gmail.com> wrote:
>
>
>
> > OK, I am using several CGI packages. =A0This is relatively easy and
> > quick. =A0And the pages are much much faster than similar web pages mad=
e
> > using JSP/JSF in NetBeans.
>
> > However, one thing I miss from when I am developing web pages using
> > JSP/JSF/Java servlets is that Netbeans makes it trivially easy to
> > place controls anywhere on the web page.
>
> > No, I am not looking for a perl development environment that will
> > duplicate Netbeans! =A0What I am looking for is an easy way to do thing=
s
> > like place that login button in the top right corner, a quarter inch
> > from the top and a quarter inch from the side, regardless of the
> > geometry of the users' screens, or place this chart in the middle of
> > the screen with a client side image map that displays the correct info
> > when the mouse is over the chart; and to do these things writing perl
> > code.
>
> > Therefore, my question is, "Is there a package related to the CGI
> > package, or complimentary to it, that makes it easy to handle page
> > layout for the web pages produced?"
>
> Surely that's what the HTML/CSS does for you, and is nothing to do with
> the CGI?
>
> =A0 =A0 =A0 =A0 Justin.
>
There are a lot of perl modules for parsing CSS. It would be handy
if there was some WYSIWYG tool for generating CSS. The last perl
UI that I worked on had paper & pencil layout, then a lot of
tweaking and testing of CSS in an editor, then viewing the result
in a browser and guessing how to make it look like you want.
Changing "75px" to "100px" in a file, saving it, and reloading it
in a browser is much lower productivity then just grabbing it with
the mouse and sliding it an inch to the right.
------------------------------
Date: Thu, 06 Aug 2009 15:58:00 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Improving page layout when doing elementary CGI programming.
Message-Id: <h5fk46$js9$1@news.eternal-september.org>
smallpond wrote:
> It would be handy if there was some WYSIWYG tool for generating CSS.
> The last perl UI that I worked on had paper & pencil layout, then a
> lot of tweaking and testing of CSS in an editor, then viewing the
> result in a browser and guessing how to make it look like you want.
>
> Changing "75px" to "100px" in a file, saving it, and reloading it in
> a browser is much lower productivity then just grabbing it with the
> mouse and sliding it an inch to the right.
OK, but this has nothing to do with Perl. Use whatever editor/generator
you want to create your HTML and CSS. Perl is not an HTML editor.
When you have the HTML, use it to build a template, then you can use
Perl to drop your dynamic content into the template and send it to the
browser.
------------------------------
Date: Thu, 6 Aug 2009 10:28:38 -0700 (PDT)
From: "friend.05@gmail.com" <hirenshah.05@gmail.com>
Subject: issue with multiprocess - fork
Message-Id: <b58a240d-6f12-4db9-ba77-86843a64a3f6@t11g2000prh.googlegroups.com>
My script is using fork so there are child processes. Sometimes my
script runs properly and output is correct. But sometime my script
gets stuck just after exiting child process.
Below is psudo code. (not sure if this helps, it is juist snap shot)
foreach my $w (keys %worklist) {
my $child;
unless ($child = fork()) {
die("connot for: $!") unless defined $child;
foreach my $file (@{$worklist{$w}}) {
#reading files processing of data and
creating hash tables.
}
#ouput files from hash tables. outfile files will be
for each child.
print "Worker $w $$ exiting\n";
#child
exiting
(#it gets stuck after printing this statement)
exit;
}
push(@workers, $child); #array of child PID
}
#wating for each child to finish.
foreach my $pid (@workers) {
$s = waitpid($pid, 0);
print "$s finished\n";
}
The freeze happens sometimes.
And I check the trace(truss -p on sun). I found that sometimes one of
the child goes to sleeping and parent is still waiting for that child
exit status. But it never gets that bcoz child is sleeping.
And suggestion what can be problem or else how can I debug more.
Thanks
------------------------------
Date: Thu, 6 Aug 2009 08:34:17 -0700 (PDT)
From: shahi <shahzad021@gmail.com>
Subject: PIA Earned $6 Million through Engineering services
Message-Id: <2d45f97a-8567-48c6-bd2e-947f3b37ee58@13g2000prl.googlegroups.com>
Karachi, 01 November 2008: Capt. Mohammad Aijaz Harron, Managing
Director PIA re-iterated his vision of having profitable engineering
facilities by offering engineering and maintenance services to other
airlines. He was speaking at the roll out ceremony of Orient Thai B747
aircraft after heavy maintenance at PIA engineering facilities. The
project earned landmark revenue of US$ 1.1 million in four weeks time.
For more details visite on.........................
http://shahzad-airline.blogspot.com/
------------------------------
Date: Thu, 6 Aug 2009 09:27:59 -0700 (PDT)
From: "friend.05@gmail.com" <hirenshah.05@gmail.com>
Subject: Re: problem with fork
Message-Id: <5cc593e9-ca71-4885-b80f-fb77e011a954@p36g2000prn.googlegroups.com>
On Aug 4, 12:25=A0am, Xho Jingleheimerschmidt <xhos...@gmail.com> wrote:
> friend...@gmail.com wrote:
> > My scipt is using fork so there are child processes. Sometimes my
> > script runs properly and output is correct. But sometime my script
> > gets stuck just after exiting child process. And this does happen
> > always.
>
> I am confused. =A0The freeze happens sometimes, or it happens always?
>
> <I've applied some reformatting>
>
>
>
> > foreach my $w (keys %worklist) {
> > =A0 =A0my $child;
> > =A0 =A0unless ($child =3D fork()) {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0die("connot for: $!") unless defined $child;
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 foreach my $file (@{$worklist{$w}}) {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #reading files proc=
essing of data and creating hash tables.
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 print "Worker $w exiting\n";
>
> I'd print $$ here as well.
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #it gets stuck after printing this stat=
ement
>
> How do you know? =A0What are you expecting to see that you do not see?
> What system monitoring tool do you use to know that it has not exited?
>
>
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 exit;
> > =A0 =A0}
> > =A0 =A0 =A0 =A0 =A0 =A0push(@workers, $child); =A0 #array of child PID
> > }
>
> > #wating for each child to finish.
> > foreach my $pid (@workers) {
>
> =A0 =A0 =A0 =A0 =A0print "About to wait for $pid\n";
>
> > =A0 =A0 =A0 $s =3D waitpid($pid, 0);
> > =A0 =A0print "$s finished\n";
> > }
>
> Xho
The freeze happens sometimes.
And I check the trace(truss -p on sun). I found that sometimes one of
the child goes to sleeping and parent is still waiting for that child
exit status. But it never gets that bcoz child is sleeping.
And once this does happens only sometimes. Sometime everything works
fine.
And suggestion what can be problem or else how can I debug more.
Thanks
------------------------------
Date: Thu, 6 Aug 2009 22:13:31 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Process to upload multiple files from a single <input type=file>
Message-Id: <slrnh7mebc.3g6.hjp-usenet2@hrunkner.hjp.at>
On 2009-08-05 19:23, Ed Jay <edMbj@aes-intl.com> wrote:
> I have a form that allows multiple files to be selected using a single
> input element, e.g., <input type='file' min='1' max='999'>,
http://www.w3.org/TR/html401/ doesn't mention any "min" and "max"
attributes for the input element, and this doesn't seem to let you
select multiple files in IE7 or FF3.5. In which browser does this work?
hp
------------------------------
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 V11 Issue 2539
***************************************