From: Petr Baudis Date: Mon, 03 Jul 2006 21:49:56 GMT Subject: [PATCH] Eliminate Scalar::Util for something simpler Message-ID: <20060703214956.GP29115@pasky.or.cz> In-Reply-To: <20060703204803.28541.67315.stgit@machine.or.cz> Dear diary, on Mon, Jul 03, 2006 at 10:48:03PM CEST, I got a letter where Petr Baudis said that... > + xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path()); This was silly and requires Scalar::Util. ->8- Signed-off-by: Petr Baudis --- perl/Git.pm | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/perl/Git.pm b/perl/Git.pm index 65acaa7..f2467bd 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -92,13 +92,14 @@ increate nonwithstanding). use Carp qw(carp croak); # but croak is bad - throw instead use Error qw(:try); use Cwd qw(abs_path); -use Scalar::Util; require XSLoader; XSLoader::load('Git', $VERSION); } +my $instance_id = 0; + =head1 CONSTRUCTORS @@ -216,7 +217,7 @@ sub repository { delete $opts{Directory}; } - $self = { opts => \%opts }; + $self = { opts => \%opts, id => $instance_id++ }; bless $self, $class; } @@ -855,7 +856,7 @@ sub _call_gate { # For now, when we will need to do it we could temporarily # chdir() there and then chdir() back after the call is done. - xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path()); + xs__call_gate($self->{id}, $self->repo_path()); } # Having to call throw from the C code is a sure path to insanity. -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Snow falling on Perl. White noise covering line noise. Hides all the bugs too. -- J. Putnam