cpanel / perl-compiler

cPanel's custom implementation of B::C
https://cpanel.net
Other
8 stars 3 forks source link

Error while lazy loading DBD::Pg #74

Closed atoomic closed 7 years ago

atoomic commented 7 years ago

When compiling this script which lazy load DBD::Pg

use Exporter 5.57 'import'; # removing the Exporter version make it succeeds
use DBD::mysql   ();        # require to make it fails

sub load {
  my $mod = shift;
  return ( eval "use $mod (); qq[ok\n]"  or $@ );
}

print load('DBD::Pg');

Can notice an error when accessing to PG_ANY

Undefined subroutine &Exporter::Heavy::PG_ANY called at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/Exporter/Heavy.pm line 242.
Compilation failed in require at (eval 1) line 1.
BEGIN failed--compilation aborted at (eval 1) line 1.
atoomic commented 7 years ago

notice that the broken version is saving UNIVERSAL::VERSION

atoomic commented 7 years ago

the broken version is using one extra setting of UNIVERSAL::VERSION

    gp_list[404].gp_cv = GvCV( gv_fetchpv(COWPV268, 0, SVt_PVCV) ); /* XS CV UNIVERSAL::VERSION */
    gp_list[455].gp_cv = GvCV( gv_fetchpv(COWPV333, 0, SVt_PVCV) ); /* XS CV UNIVERSAL::can */
    gp_list[599].gp_cv = GvCV( gv_fetchpv(COWPV268, 0, SVt_PVCV) ); /* XS CV UNIVERSAL::VERSION */
atoomic commented 7 years ago

fixed with 1f012670caf0f65bd2127c91d728aae76f67203b but probably want a better fix