Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Differences between 3.0 @41 and 44??? Message-ID: <1991Jan31.013659.26210@convex.com> Date: 31 Jan 91 01:36:59 GMT References: <1991Jan31.001253.7441@sdd.hp.com> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: na Organization: CONVEX Software Development, Richardson, TX Lines: 56 Nntp-Posting-Host: pixel.convex.com From the keyboard of harless@sdd.hp.com (Mike Harless): :Was there some change with perl and passing file descriptors in and out of :subroutines? I've applied the 42-44 patches and now one of my backup :scripts is failing with 'memory fault, core dump'. In it, I'm creating a :socket, and then passing it by reference to various subroutines. If I make :the socket descriptor global or go back to 3.0@41 the problem goes away. :I'm on an HP 9000/370 with hp-ux 7.0. : : :Here's an example of what I'm doing: : : make_socket(S) ; : :where subroutine make_socket() looks like: : : sub make_socket() { : : local(*S) = shift(@_) ; # what socket to connect with : : socket(S, &PF_INET, &SOCK_STREAM, $proto) || : die "socket failed, $!" ; I assume you mean &make_socket(S); That's actually the same as &make_socket('S'); which isn't a very good symbol table entry to absorb with your local(*S) assignment. Make sure that if you to a local(*x) that you're assigning a *y to it, not a plain $y. You probably want one of these: &make_socket(*S); ... local(*sock) = shift; socket(sock, ...) or &make_socket('S'); ... local($sock) = shift; socket($sock, ...) I don't personally like passing naked file handles around and letting them turn into strings. I also like to name my subroutine local different than what gets passed into them. --tom -- "Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now he can finally have the whole O/S built-in to his editor like he always wanted!" --me (Tom Christiansen )