Skip Menu |

This queue is for tickets about the Function-Parameters CPAN distribution.

Report information
The Basics
Id: 123895
Status: rejected
Priority: 0/
Queue: Function-Parameters

People
Owner: Nobody in particular
Requestors: brianski [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Function::Parameters + Types::Standard + B::Deparse -> =(
Not sure if this is a Function::Parameters or Types::Standard bug, but there seems to be some negative interaction with the two when trying to deparse (the code runs fine, however): ski@dev-ski 22:35:27 ~ $ cat /tmp/foo3.pl use strict; use warnings; use Function::Parameters; use Types::Standard qw( Int ); method set_age( Int $age ) { $self->{ 'age' } = $age; } ski@dev-ski 22:35:28 ~ $ perl -MO=Deparse /tmp/foo3.pl & [1] 1981 ski@dev-ski 22:35:38 ~ $ sleep 10 ski@dev-ski 22:35:50 ~ $ ps auxww | grep foo3 2104 1981 103 1.6 218888 132700 pts/5 R 22:35 0:15 perl -MO=Deparse /tmp/foo3.pl 2104 2071 0.0 0.0 61188 740 pts/5 R+ 22:35 0:00 grep foo3 ski@dev-ski 22:35:53 ~ $ kill %1 [1]+ Terminated perl -MO=Deparse /tmp/foo3.pl ski@dev-ski 22:36:32 ~ $ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-thread-multi Copyright 1987-2011, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. ski@dev-ski 22:36:46 ~ $ perl -V Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=linux, osvers=2.6.18-274.7.1.el5, archname=x86_64-linux-thread-multi uname='linux dev-bszymanski.local 2.6.18-274.7.1.el5 #1 smp thu oct 20 16:21:01 edt 2011 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dcc=gcc -Dprefix=/home/bszymanski/perl5 -Dusethreads -Duseshrplib -Duseithreads -U installusrbinperl -Ddestdir=/home/bszymanski/perl5 -Doptimize=-g' 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='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-g', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-51)', 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='gcc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/bszymanski/perl5/lib/5.14.2/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY 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_PERLIO USE_PERL_ATOF USE_REENTRANT_API Built under linux Compiled at May 19 2014 10:33:41 %ENV: PERL5LIB="/home/bszymanski/devperl/lib:/home/bszymanski/perl5/lib:/home/bszymanski/devperl/lib/site_perl/5.14.2:/home/bszymanski/proj/tgservices/lib:/home/bszymanski/proj/Sphorb/lib:/home/bszymanski/devperl/lib/perl:/home/bszymanski/devperl/lib/perl5:/home/bszymanski/devperl/lib64/perl:/home/bszymanski/devperl/lib64/perl5:/usr/local/lib/site_perl:/home/bszymanski/perl5/lib" @INC: /home/bszymanski/devperl/lib/5.14.2/x86_64-linux-thread-multi /home/bszymanski/devperl/lib/5.14.2 /home/bszymanski/devperl/lib /home/bszymanski/perl5/lib/5.14.2/x86_64-linux-thread-multi /home/bszymanski/perl5/lib/5.14.2 /home/bszymanski/perl5/lib /home/bszymanski/devperl/lib/site_perl/5.14.2/x86_64-linux-thread-multi /home/bszymanski/devperl/lib/site_perl/5.14.2 /home/bszymanski/proj/tgservices/lib /home/bszymanski/proj/Sphorb/lib /home/bszymanski/devperl/lib/perl /home/bszymanski/devperl/lib/perl5 /home/bszymanski/devperl/lib64/perl /home/bszymanski/devperl/lib64/perl5 /usr/local/lib/site_perl /home/bszymanski/perl5/lib/5.14.2/x86_64-linux-thread-multi /home/bszymanski/perl5/lib/5.14.2 /home/bszymanski/perl5/lib /home/bszymanski/perl5/lib/site_perl/5.14.2/x86_64-linux-thread-multi /home/bszymanski/perl5/lib/site_perl/5.14.2 /home/bszymanski/perl5/lib/5.14.2/x86_64-linux-thread-multi /home/bszymanski/perl5/lib/5.14.2 . ski@dev-ski 22:36:47 ~ $ FWIW, getting rid of the type constraint in the signature makes Deparse work again.
Issue exists both on a linux machine running perl 5.14.2 and on a macosx machine running perl 5.18.2
Other type validation libraries don't seem to trigger this bug, so I suspect it's a Types::Standard issue, but leaving it here for the moment since I suspect / hope the author of Function::Parameters may be interested in investigating the issue as well. TGVA3214:local-git ski$ cat Int.pm package Int; use strict; use warnings; sub import { my ($class, @args) = @_; my @caller = caller( 1 ); my $package = $caller[0]; no strict 'refs'; *{$package.'::Int'} = sub { bless {}, "Int" }; } sub check { return defined $_[1] && $_[1] =~ /^-?\d+$/; } sub get_message { return $Int::error; } 1; TGVA3214:local-git ski$ cat type-checking2.pl use strict; use warnings; use Function::Parameters; use Int; method set_age( Int $age ) { $self->{ 'age' } = $age; } TGVA3214:local-git ski$ perl -MO=Deparse type-checking2.pl use Function::Parameters; use Int; sub set_age : method { use warnings; use strict; BEGIN { $^H{'Function::Parameters/config'} = 'HASH(0x7fbb4cbdb430)'; } Function::Parameters::_croak('Too few arguments for method set_age (expected 2, got ' . @_ . ')') if @_ < 2; Function::Parameters::_croak('Too many arguments for method set_age (expected 2, got ' . @_ . ')') if @_ > 2; my $self = shift(); my($age) = @_; Function::Parameters::_croak('In method set_age: parameter 1 ($age): ' . {}->get_message($age)) unless {}->check($age); $$self{'age'} = $age; } use warnings; use strict; BEGIN { $^H{'Function::Parameters/config'} = 'HASH(0x7fbb4cbdb430)'; } ; type-checking2.pl syntax OK TGVA3214:local-git ski$
On Sat Dec 16 22:39:05 2017, BRIANSKI wrote: Show quoted text
> Not sure if this is a Function::Parameters or Types::Standard bug, but > there seems to be some negative interaction with the two when trying > to deparse (the code runs fine, however):
See https://github.com/mauke/Function-Parameters/issues/29#issuecomment-294137390. This is a bug in B::Deparse: https://rt.perl.org/Ticket/Display.html?id=131148 (B::Deparse hangs on cyclic constants).