On Fri, Apr 25, 2008 at 11:09:32PM +0300, Burak Gürsoy wrote:
> I think you need PAR

        Maybe, but this seems a bit like killing an ant with a nuclear bomb.
It means the app will have to suck everything in memory at compile time.
It will also need to be rewritten to use special PAR methods to access data,
and since data is no longer in files as expected they will have to be copied
out by the user if one wanted to access them via external tools. It also may
make the finished package non-cross-platform. Etc. etc.. It's a solution,
just not a very good one.

        Because the "fix_shebang" Module::Build (or the equivalent EU::MM
"fixin") method exists and alters perl scripts to be executable, someone
obviously thought that it should be possible to bundle apps with modules.

        It should be completely simple for a brain dead newbie to be able to
write a simple application and just have it work and be distributable without
a bunch of complexity or fooling around. It should be just as easy as
distributing a module. 

        ..shouldn't it?

        Austin

> 
> -----Original Message-----
> From: Austin Schutz [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 25, 2008 10:43 PM
> To: module-authors@perl.org
> Subject: Application Building
> 
>       Ok, so here's what must be a question with a really simple answer:
> how do I write a perl app?
> 
>       For example: I want to display a jpeg.
> 
> 
> MyApp/script/display.pl:
> 
> #!/path/to/perl
> use Myapp::Display;
> Myapp::Diplay->new()->display('example.jpg');
> __END__
> 
> MyApp/lib/Myapp/Display.pm
>   ...
> 
> MyApp/share/example.jpg
>   ...
> 
> MyApp/Build.PL:
> my $build = new Module::Build (
>    script_files => [ 'script/display.pl' ],
>    jpeg_files => { 'share/example.jpg' => 'share/example.jpg' }
> );
> $build->add_build_element('jpeg');
> $build->create_build_script;
> 
>    
> 
>       Ok, so now I do:
> 
> /path/to/perl ./Build.PL install_base=$HOME/MyApp
> ./Build install
> 
> ...
> ...
> 
> 
>       If I put #!perl at the top of display.pl it will have a path to perl
> (though not the one I specified), but it won't have "use lib
> $HOME/MyApp/lib"
> at the top of the script, so it can't run.
>       Furthermore, there's no way for the script to know what was used
> for install_base, so there's no way for the script to know where the data
> file is located.
> 
>       This must be something people do, right? Currently I hard code paths
> and force the installation to be where I want it, but this seems really
> sub-optimal, doesn't work for having test environments, etc.
>       I've been considering parsing $0 at the top of the script, is that
> what other people do?
> 
>       Austin
> 
> 
> 
> !DSPAM:48123a8b186984550419146!

Reply via email to