ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
pass by reference from parent to child
by Bruce other posts by this author
Aug 1 2004 9:18PM messages near this date
view in the new Beta List Site
RE: perl problem, continued - serializing... | Re: perl problem, continued - serializing...
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...

#

#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...

thanks

-bruce


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
bruce
Tobias Hoellrich
bruce
Bruce
Rhesa Rozendaal

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved