Skip to content

Instantly share code, notes, and snippets.

@bokutin
Created November 8, 2013 05:58
Show Gist options
  • Save bokutin/7366846 to your computer and use it in GitHub Desktop.
Save bokutin/7366846 to your computer and use it in GitHub Desktop.
Validation script that could address the reference is reused in Perl
#!/usr/bin/env perl
package AAA;
sub new { bless {} }
package main;
my $obj = AAA->new;
my $str = "".$obj;
my $addr = 0+$obj;
my $try = 0;
while (1) {
$try++;
$obj = AAA->new;
if ($obj == $addr) {
die $try;
}
}
__END__
fvm bokutin % perl a.pl
4 at a.pl line 19.
fvm bokutin % perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
Platform:
osname=freebsd, osvers=9.1-release-p4, archname=amd64-freebsd-thread-multi
uname='freebsd fvm 9.1-release-p4 freebsd 9.1-release-p4 #0: mon jun 17 11:42:37 utc 2013 root@amd64-builder.daemonology.net:usrobjusrsrcsysgeneric amd64 '
config_args='-de -Dprefix=/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded -Dusethreads -Aeval:scriptdir=/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
optimize='-O',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070831 patched [FreeBSD]', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt
perllibs=-lm -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under freebsd
Compiled at Jul 13 2013 15:42:31
%ENV:
PERL5LIB="/usr/local/ming/lib/perl5/site_perl/5.12.0/darwin-thread-multi-2level/:/home/bokutin/git/BOKUTIN-Private/lib:/home/bokutin/git/BOKUTIN-Utils/lib"
PERLBREW_BASHRC_VERSION="0.64"
PERLBREW_HOME="/home/bokutin/.perlbrew"
PERLBREW_MANPATH="/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/man"
PERLBREW_PATH="/home/bokutin/perl5/perlbrew/bin:/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/bin"
PERLBREW_PERL="5.16.3-threaded"
PERLBREW_ROOT="/home/bokutin/perl5/perlbrew"
PERLBREW_VERSION="0.64"
PERL_AUTOINSTALL_PREFER_CPAN="1"
PERL_CPANM_OPT="--mirror http://www.cpan.org/ --mirror http://bokut.in/darkpan/ --mirror sftp://bokut.in/home/bokutin/public_html/privpan/"
@INC:
/usr/local/ming/lib/perl5/site_perl/5.12.0/darwin-thread-multi-2level/
/home/bokutin/git/BOKUTIN-Private/lib
/home/bokutin/git/BOKUTIN-Utils/lib
/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/lib/site_perl/5.16.3/amd64-freebsd-thread-multi
/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/lib/site_perl/5.16.3
/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/lib/5.16.3/amd64-freebsd-thread-multi
/home/bokutin/perl5/perlbrew/perls/5.16.3-threaded/lib/5.16.3
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment