[Catalyst] Catalyst + PAR + Module::Install::Catalyst

Denis denis at uzvik.kiev.ua
Tue Dec 6 14:56:01 CET 2005


Hello Carl,

How to add add Version no. to exe ?

CF> See the PAR docs on available options.

CF> As an example, below is a script I use to build an exe, rather than using `pp`.

CF> You can of course ignore everything underneath the
CF> # add Version no. to exe

CF> Cheers,
CF> Carl


CF> #!C:\Perl\bin\perl.exe
CF> use strict;
CF> use warnings;
CF> use PAR ();
CF> use PAR::Packer ();
CF> use Module::ScanDeps ();
CF> use App::Packer::PAR ();

CF> my %opt;
CF> $opt{l} = [qw/
CF>   c:\\usr\\perl\\site\\lib\\auto\\Wx\\wxbase26u_gcc_custom.dll
CF>   c:\\usr\\perl\\site\\lib\\auto\\Wx\\wxmsw26u_adv_gcc_custom.dll
CF>   c:\\usr\\perl\\site\\lib\\auto\\Wx\\wxmsw26u_core_gcc_custom.dll
CF> /];

CF> $opt{M} = [qw/
CF>   File::Basename
CF>   Wx::DND
CF>   Wx::DocView
CF>   Wx::FS
CF>   Wx::Grid
CF>   Wx::Help
CF>   Wx::Html
CF>   Wx::MDI
CF>   Wx::Print
CF> /];

CF> $opt{I} = [qw/
CF>   lib
CF> /];

CF> $opt{g} = 1; # --gui
CF> $opt{C} = 1; # --clean

CF> $opt{i} = 'build/mondrian.ico'; # --icon
CF> $opt{o} = "build/Set Permissions.exe";

CF> my $pl2exe = 'build/set_permissions.pl';

App::Packer::PAR->>new(
CF>     frontend    => 'Module::ScanDeps',
CF>     backend     => 'PAR::Packer',
CF>     frontopts   => \%opt,
CF>     backopts    => \%opt,
CF>     args        => [$pl2exe],
)->>go;


CF> # add Version no. to exe

CF> use Win32::Exe;
CF> my $exe     = Win32::Exe->new( $opt{o} );
my $rsrc    = $exe->>resource_section;
CF> my $version = $rsrc->first_object('Version');
CF> my $try;

CF> eval {
CF>   push @INC, @{ $opt{I} };
CF>   require CAMS::SetPerms::topFrame;
CF>   if ($CAMS::SetPerms::topFrame::VERSION =~ /^(\d+)\.(\d)?(\d)?(\d)?$/) {
CF>     my @points = ($1, $2, $3, $4);
CF>     $_ ||= 0 for @points;
CF>     $try = join( ',', @points );
CF>   }
CF> };

CF> $try ||= '1,0,0,0';

$version->>set( FileVersion => $try );
$version->>set( CompanyName => 'x' );

$version->>refresh;
$exe->>write_file( $opt{o}, $exe->dump );

CF> print "built .exe version $try\n";



-- 
Best regards,
 Denis                            mailto:denis at uzvik.kiev.ua




More information about the Catalyst mailing list