> From: ssh...@li...
> [mailto:ssh...@li...]On Behalf Of
> Robert Landrum
> Sent: Wednesday, December 22, 2004 2:49 PM
> Subject: Re: [Ssh-sftp-perl-users] Net::SFTP Patch
>=20
> > Ideally undef'ing drops the refcount to zero, which=20
> destroys the Net::SFTP object, which cascades to the=20
> Net::SSH::Perl and its sub-objects and eventually the socket=20
> is closed.
>=20
> The refcount doesn't reach zero. Because Socket is used, and because
> Socket does the gensym call, the reference created from the resulting =
file
> handle, when collected, doesn't release the symbol. As I recall, it =
has=20
> something to due with scope, but my memory is hazy. All this=20
> is done within Net::SSH::Perl. An explicit close needs to be called =
on the=20
> filehandle (which I don't think is happening) in order for it to=20
> correctly close the socket because apache/mod_perl process will never =
(or rarely)=20
> garbage collect it.
Are you using the latest Net::SSH::Perl (or at least a version >=3D =
1.24)?
In the version I have (1.25) there's a _create_socket that calls gensym =
directly.
This quick test shows there's nothing innate about gensyms that stops =
them from being destroyed when they go out of scope:
perl -MSymbol -wle '{sub Foo::DESTROY { print "DESTROY" } my =
$a=3Dgensym; bless $a, "Foo";} print "OUTER"'
prints "DESTROY" and then "OUTER" as expected.
Since perl does refcounted g/c, it's either yes or no; I don't think =
"rarely" is an option, as it might be for Java, which uses its own =
heuristics to decide when to g/c and isn't refcount based.
> Robert Landrum
> Systems Programmer
--=20
Dave
Isa. 40:31
|