Balakumar
Balakumar

Reputation: 650

Create exe with custom icon using Perl Par Packer

I am trying to create a exe file from Perl script with custom icon .i have tried with these commands

pp -i "myicon.ico" -o file.exe file.pl
pp --icon "myicon.ico" -o file.exe file.pl
pp --icon "fullpath\myicon.ico" -o file.exe file.pl

but couldnt solve the issue.any suggestions would be greatly appreciated.Thanks.

Update : for this code pp --gui --icon myicon.ico -o out.exe file.pl . I have got an error as

Unknown option: icon
Binary 'myicon.ico' sure doesn't smell like perl source!
Can't locate method "maybe_command" via package "MM"

Upvotes: 4

Views: 4446

Answers (2)

Daniel Abson
Daniel Abson

Reputation: 76

The options --icon and --info have been removed from the latest versions of PAR::Packer. According to comments from the module's author on the CPAN bug tracker, the options sometimes corrupt files, and since they delegated to Win32::Exe anyway he now expects people to just use Win32::Exe directly.1

Here's a handy one-liner to remove the default camel icon and add your own from a .ico file. As noted by Hariboo, your icon file must match the attributes of the original camel icon, i.e. 32x32 pixels.

perl -e "use Win32::Exe; $exe = Win32::Exe->new('myapp.exe'); $exe->set_single_group_icon('myicon.ico'); $exe->write;"

See the perldoc for Win32::Exe for other icon-related API calls. There is a script exe_update.bat that ships with Win32::Exe, but some users have reported corruption issues (e.g. in this other question).

If you're still getting corrupted EXEs, try downgrading your Archive::Zip, and then rebuilding PAR.

force install NEDKONZ/Archive-Zip-1.08.tar.gz
force install PAR 

I have a separate, install of portable Strawberry just for packing and modifying EXEs with PAR::Packer. Be sure to pass -X Portable.pm to pp when using portable.2

Upvotes: 5

PodTech.io
PodTech.io

Reputation: 5264

Just to add to Daniels solution..

The icon file size must match the existing pp.ico file. This is 32x32.

When using anything larger or smaller I got signature errors.

Upvotes: 0

Related Questions