RE: pass by reference from parent to child
by Angelos Karageorgiou other posts by this author
Aug 2 2004 3:03PM messages near this date
view in the new Beta List Site
RE: pass by reference from parent to child
|
RE: perl problem, continued - serializing...
Not at all , data handles are really pointers to in-ram objects , so
no 2 processes can have identical pointers in two seperate unix VMs.
I am sure there must be a better way , say a shared plain table with
numeric indices to refferences ...
On Mon, 2 Aug 2004, bruce wrote:
> Date: Mon, 2 Aug 2004 07:55:40 -0700
> From: bruce <bedouglas@[...].net>
> To: '$Bill Luebkert' <dbecoll@[...].net>
> Cc: perl-win32-users@[...].com
> Subject: RE: pass by reference from parent to child
>
> never mind!!!
>
> a quick test of the perl IPC::Shareable function revealed that shared memory
> within perl appears to support text only, but not 'data'...or at least not
> DB connection handles...
>
> hmmmmm.. curiouser...
>
> thanks
>
>
> -----Original Message-----
> From: perl-win32-users-bounces@[...].com
> [mailto:perl-win32-users-bounces@[...].com]On Behalf Of
> bruce
> Sent: Monday, August 02, 2004 6:54 AM
> To: '$Bill Luebkert'
> Cc: perl-win32-users@[...].com
> Subject: RE: pass by reference from parent to child
>
>
> bill...
>
> in your reply, you state that one can't use shared memory to 'share' db
> handles!!!
>
> are you sure about this?
>
> -bruce
>
>
> -----Original Message-----
> From: perl-win32-users-bounces@[...].com
> [mailto:perl-win32-users-bounces@[...].com]On Behalf Of
> $Bill Luebkert
> Sent: Sunday, August 01, 2004 10:52 PM
> To: bedouglas@[...].net
> Cc: perl-win32-users@[...].com
> Subject: Re: pass by reference from parent to child
>
>
> bruce wrote:
> > hi...
> >
> > is it possible to pass an arg by ref from parent to child via exec/system
> > shell and be able to retrieve the original value...
>
> I thought this was pretty much answered. You cannot pass objects to
> children/processes - what you can pass is basically ASCII strings.
>
> In UNIX, you could open a connection and fork a child and be able to
> access the FDs the parent opened, but we're talking Win32 here and
> you would have to go to threads and most Perl modules aren't thread
> safe yet.
>
> You can pass data though files and shared memory etc, but not active
> objects like open file or DB handles.
>
> > #use strict;
> > use DBI;
> > require ('mysql.inc');
> >
> >
> > my $dbh = "";
> >
> > print "open db\n";
> > $dbh = open_dbi();
> >
> > # at this point, dbh should be the connection id...
> > print "dbh = ".$dbh."\n";
> > my $db1;
> > my $db2;
> > $db1 = \$dbh;
> > print "db1 = ".$db1."\n";
> > system 'perl', 'aaa.pl', $db1;
> >
> > $db2 = $$db1;
> > print "db2 = ".$db2."\n";
> >
> > this successfully gets 'db2' to have 'dbh', which is what one expects...
> >
> > and within the child app, it actually gets the correct REF... however, i'm
> > not sure if it's possible to retrieve the actual val via this approach..
> >
> > using the $$arg doesn't get the correct val in the child app...
>
> Passing a handle to another process will do you no good - it isn't
> usable by the other process. The other process would have to open
> it's own object to access the data source.
>
> --
> ,-/- __ _ _ $Bill Luebkert Mailto:dbecoll@[...].net
> (_/ / ) // // DBE Collectibles Mailto:dbe@[...].com
> / ) /--< o // // Castle of Medieval Myth & Magic
> http://www.todbe.com/
> -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
>
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
--
Angelos Karageorgiou
Masters of Computer Science
City University of New York
http://www.unix.gr
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
$Bill Luebkert
bruce
bruce
Angelos Karageorgiou
|