Kompilierung des list_files.pl Skripts
Option 1: PAR::Packer (Standalone-Executable)
Installation von PAR::Packer
cpanm PAR::Packer
Basis-Kompilierung
pp -o list_files list_files.pl
Empfohlene Kompilierung mit allen Modulen
pp -o list_files \
-M File::Spec \
-M File::stat \
-M File::Basename \
-M Cwd \
-M Cwd::getcwd \
-M Encode \
-M Time::HiRes \
list_files.pl
Weitere nützliche Optionen
Icon hinzufügen (macOS):
pp -o list_files --icon=iconfile.icns list_files.pl
Executable-Größe reduzieren:
pp -o list_files --compress=6 list_files.pl
Keine Kompression (schnelleres Starten):
pp -o list_files --no-compress list_files.pl
Zusätzliche Dateien einbinden:
pp -o list_files -a config.txt list_files.pl
Verbose Ausgabe (für Debugging):
pp -v -o list_files list_files.pl
Option 2: Ausführbare Datei mit Shebang (benötigt Perl)
Das Skript ist bereits mit
#!/usr/bin/env perl ausgestattet.
Einfach ausführbar machen:
chmod +x list_files.pl
./list_files.pl
Option 3: App::FatPacker (Alternative)
Installation
cpanm App::FatPacker
Verwendung
fatpack pack list_files.pl > list_files_packed.pl
chmod +x list_files_packed.pl
Troubleshooting
Problem: "Perl version doesn't match"
Lösung: PAR::Packer für die aktuelle Perl-Version neu installieren:
cpanm --reinstall PAR::Packer
Problem: Module nicht gefunden
Lösung: Module explizit angeben mit -M Modulname
Problem: Große Executable-Datei
Lösung: Kompression verwenden oder nicht benötigte Module entfernen
Dateigröße
Eine typische kompilierte Version wird etwa 5-15 MB groß sein, je nach:
- Verwendeten Modulen
- Kompressionslevel
- Plattform (macOS, Linux, Windows)
Plattform-spezifische Executables
Die kompilierte Datei läuft nur auf der Plattform, auf der sie erstellt wurde.
Für macOS erstellte Executables laufen nicht auf Linux oder Windows.