On Mon, 2006-11-06 at 14:26 +0100, Roderich Schupp wrote:
> On 11/6/06, Peter Gordon <[EMAIL PROTECTED]> wrote:
> > > has Scalar/Util.pm (and also Scalar/Util.so or Scalar/Util.dll) been
> > > packaged,
> > > run "unzip -l your_executable" to check
> > # unzip -l app_diag.exe | grep Util
> > 56: 2050 11-06-06 08:21 lib/List/Util.pm
> > 61: 3572 11-06-06 08:21 lib/Scalar/Util.pm
> > 117: 0 11-06-06 08:21 lib/auto/List/Util/Util.bs
> > 118: 32871 08-29-06 12:49 lib/auto/List/Util/Util.dll
> > 119: 789 08-29-06 12:49 lib/auto/List/Util/Util.exp
>
> OK, they are in the zip part (but stale copies might also be in the
> "embedded" stuff
> of the executable). Could you run the attached script on app_diag.exe and
> check whether the extracted Util.* stuff matches your installed stuff
> (pm's might have comments/pod stripped, that's normal).
I did the extract and and I ran unzip. Even the dlls have different
sizes.
perl /tmp/extract-embedded.pl app_diag.exe /tmp/extract
find . -name 'Ut*' -ls
9732524 4 drwxr-xr-x 2 root root 4096 Nov 7 08:16
./auto/List/Util
9732525 32 -rw-r--r-- 1 root root 28746 Nov 7 08:16
./auto/List/Util/Util.dll
9732472 4 -rw-r--r-- 1 root root 596 Nov 7 08:16
./List/Util.pm
9732474 4 -rw-r--r-- 1 root root 909 Nov 7 08:16
./Scalar/Util.pm
unzip -l app_diag.exe | grep Util
2050 11-06-06 08:50 lib/List/Util.pm
3572 11-06-06 08:50 lib/Scalar/Util.pm
0 08-29-06 12:49 lib/auto/List/Util/Util.bs
32871 08-29-06 12:49 lib/auto/List/Util/Util.dll
789 08-29-06 12:49 lib/auto/List/Util/Util.exp
================================================================
This is List/Util.pm as extracted with extract-embedded.pl
more /tmp/extract/List/Util.pm
#line 1 "D:/cpanrun/build/5-8-0/lib/List/Util.pm"
# List::Util.pm
#
# Copyright (c) 1997-2001 Graham Barr <[EMAIL PROTECTED]>. All rights
reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
package List::Util;
require Exporter;
require DynaLoader;
our @ISA = qw(Exporter DynaLoader);
our @EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle);
our $VERSION = "1.07_00";
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
bootstrap List::Util $XS_VERSION;
1;
__END__
====================================================================
And this is List/Util.pm from the unzip.
mkdir /tmp/localtest
unzip /mnt1/utils/Utils/Diagnostics/app_diag.exe
cd /tmp/localtest/lib/List
more Util.pm
#line 1 "List/Util.pm"
# List::Util.pm
#
# Copyright (c) 1997-2005 Graham Barr <[EMAIL PROTECTED]>. All rights
reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
package List::Util;
use strict;
use vars qw(@ISA @EXPORT_OK $VERSION $XS_VERSION $TESTING_PERL_ONLY);
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle);
$VERSION = "1.18";
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
eval {
# PERL_DL_NONLAZY must be false, or any errors in loading will just
# cause the perl code to be tested
local $ENV{PERL_DL_NONLAZY} = 0 if $ENV{PERL_DL_NONLAZY};
eval {
require XSLoader;
XSLoader::load('List::Util', $XS_VERSION);
1;
} or do {
require DynaLoader;
local @ISA = qw(DynaLoader);
bootstrap List::Util $XS_VERSION;
};
} unless $TESTING_PERL_ONLY;
# This code is only compiled if the XS did not load
# of for perl < 5.6.0
if (!defined &reduce) {
eval <<'ESQ'
sub reduce (&@) {
my $code = shift;
no strict 'refs';
return shift unless @_ > 1;
use vars qw($a $b);
my $caller = caller;
local(*{$caller."::a"}) = \my $a;
local(*{$caller."::b"}) = \my $b;
$a = shift;
foreach (@_) {
$b = $_;
$a = &{$code}();
}
$a;
}
sub first (&@) {
my $code = shift;
foreach (@_) {
return $_ if &{$code}();
}
undef;
}
ESQ
}
# This code is only compiled if the XS did not load
eval <<'ESQ' if !defined ∑
use vars qw($a $b);
sub sum (@) { reduce { $a + $b } @_ }
sub min (@) { reduce { $a < $b ? $a : $b } @_ }
sub max (@) { reduce { $a > $b ? $a : $b } @_ }
sub minstr (@) { reduce { $a lt $b ? $a : $b } @_ }
sub maxstr (@) { reduce { $a gt $b ? $a : $b } @_ }
sub shuffle (@) {
my @a=\(@_);
my $n;
my [EMAIL PROTECTED];
map {
$n = rand($i--);
(${$a[$n]}, $a[$n] = $a[$i])[0];
} @_;
}
ESQ
1;
__END__
=======================================================================
At this point either I have made a mistake and/or am thoroughly
confused.
=======================================================================
> > > - did you build PAR yourself (esp. on Windows) on the computer where you
> > > did the pp'ing?
> > Yes
>
> ... and with the version of perl and Scalar::Util that is now installed?
>
> > There is an odd thing that I noticed in Archive::Tar.pm, which may
> > provide a clue to what is happening.
> >
> > BEGIN {
> > use Config;
> > $HAS_PERLIO = $Config::Config{useperlio};
> >
> > ### try and load IO::String anyway, so you can dynamically
> > ### switch between perlio and IO::String
> > eval {
> > require IO::String;
> > import IO::String;
> > };
> > $HAS_IO_STRING = $@ ? 0 : 1;
>
> Shouldn't be a problem.
>
> > > > 1. Besides adding lots of print statements, is it possible to debug a pp
> > > > package?
> > >
> > > Sorry, no, because you can't pass the "-d" switch down to the packaged
> > > version of perl.
> > >
> > If I unpack the files, is it then possible to use -d somehow?
>
> Again no, because it is using a custom-built perl interpreter that does not
> obey the -d switch (and has no other way to enable debug mode):
>
> > I also have another problem: I run external programs using backticks and
> > pack without using the --gui flag. When the user double clicks on the
> > file name a dos box shows. With the --gui flag, no dos box shows, but on
> > the other hand, every time I run the backticks, a dos box starts up and
> > closes down, which appears as a flashing dos box to the user. This does
> > not happen without pp.
>
> I know that one, but see no easy fix.
>
> What happens is this:
> - programs started with backticks need to run in
> a "DOS box", otherwise Windows won't endow them with stdin/stdut/stderr
> - the perl runtime knows about this and will start the program in a DOS box
> if itself isn't runing in one already
> - so without --gui, you already got one, no need to create any for backticks
> (but of course the users sees the initial DOS box)
>
> You could try what happens for system() (don't remember). If system() doesn't
> flash a DOS box with --gui, you could replace the backticks by using
> IPC::Run3 (that allows you to catch stdout/stderr into a string, but way more
> flexible as backticks), because it uses system() internally.
>
> If system() doesn't work, maybe some advanced use of Win32::Process and/or
> Win32::Console might to the trick?
>
> Cheers, Roderich