Module...d::SDL(3pm)
π NAME π
okay bestie, welcome to the Module...d::SDL(3pm) page from User Contributed Perl Documentation β it's the manual for Module::Build::SDL, aka a Module::Build subclass for building SDL apps/games. π¦
β οΈ [not stable yet] β yes, that's literally part of the name line. No cap, it's giving work-in-progress realness. π
β¨ SYNOPSIS β¨
When you're creating a new SDL application/game, you can create Build.PL like this:
use Module::Build::SDL;
my $builder = Module::Build::SDL->new(
module_name => 'Games::Demo',
dist_version => '1.00',
dist_abstract => 'Demo game based on Module::Build::SDL',
dist_author => 'coder@cpan.org',
license => 'perl',
requires => {
'SDL' => 0,
},
#+ others Module::Build options
)->create_build_script();
Once you've created a SDL application/game via Module::Build::SDL as described above, you can use some extra build targets/actions β they're lowkey the best part: β¨
- make a PAR distribution β you can create a PAR distribution like:
$ perl ./Build.PL
$ ./Build
$ ./Build par
There are some extra parameters related to the 'par' action you can pass to Module::Build::SDL->new():
parinput => 'bin/scriptname.pl'
paroutput => 'filename.par.exe',
parlibs => [ qw/SDL SDL_main SDL_gfx/ ], #external libraries (.so/.dll) to be included into PAR
parmods => [ qw/Module::A Module::B/ ], #extra modules to be included into PAR
- run from the distribution directory β to run the game from distribution directory you can use:
$ perl ./Build.PL
$ ./Build
$ ./Build run
- TODO β maybe some additional actions:
parexe,parmsi,deb,rpm
π§ DESCRIPTION π§
Module::Build::SDL is a subclass of Module::Build created to make easy some tasks specific to SDL applications β e.g. packaging SDL application/game into PAR archive. π
πΈ APPLICATION/GAME LAYOUT πΈ
Module::Build::SDL expects the following layout in the project directory:
#example: game with the main *.pl script + data files + modules (*.pm)
Build.PL
lib/
Games/
Demo.pm
bin/
game-script.pl
data/
whatever_data_files_you_need.jpg
the most simple game should look like:
#example: simple one-script apllication/game
Build.PL
bin/
game-script.pl
In short β there are 3 expected subdirectories:
binβ one or more perl scripts (*.pl) to start the actual application/gamelibβ application/game specific modules (*.pm) organized in dir structure in "usual perl manners"dataβ directory for storing application data (pictures, sounds etc.). This subdirectory is handled as a"ShareDir"(seeFile::ShareDirfor more details)- As the project is (or could be) composed as a standard perl distribution it also support standard subdirectory
't'(with tests).
π RULES TO FOLLOW π
When creating a SDL application/game based on Module::Build::SDL it is recommended to follow these rules:
- Use the name for your game from
Games::*namespace; it will make the later release to CPAN much easier. - Put all data files into
datasubdirectory and access the data subdir only viaFile::ShareDir(namely by callingdistdir()function) - TODO β maybe add more
okay that's the whole page, bestie π β this was Module...d::SDL(3pm), from perl v5.42.3, dated 2026-08-19. now go build something iconic πβ¨
π¦ where this page comes from
- ubuntu stonking: libsdl-perl 2.548-6build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms