Re: Using precompiled modules, Assembling a project into one single file (pbc)
On Fri, Jun 17, 2011 at 12:02:16PM +0200, Moritz Lenz wrote: > >Also, if you look at the (pir) code for any compiled script, > >it becomes clear that it uses some library called "perl6_ops". > >Does this mean that the file can not be run on a machine > >where you have installed parrot but have not installed perl6? > > That is correct. > Just consider the case where your program calls the eval() function > - it needs the full Perl 6 compiler available. So you need rakudo > installed to run Perl 6 scripts. Not only the compiler for eval(), but you need the runtime libraries as well for all of the builtin types and functions. The generated .pir files for a HLL program aren't nearly sufficient. By way of analogy, most C programs also require external libraries to be installed and available before they can run. Pm
Re: Using precompiled modules, Assembling a project into one single file (pbc)
Am 17.06.2011 11:40, schrieb Георгий Устинов: If you compile Hello.pm to Hello.pir and remove Hello.pm, PIR module does not load. Why? Because .pm files are the authoritative source of information (for example regarding version information, but also regarding actual program code), and .pir files are just caches for that. Also, if you look at the (pir) code for any compiled script, it becomes clear that it uses some library called "perl6_ops". Does this mean that the file can not be run on a machine where you have installed parrot but have not installed perl6? That is correct. Just consider the case where your program calls the eval() function - it needs the full Perl 6 compiler available. So you need rakudo installed to run Perl 6 scripts. Also, I do not understand, is there a way to build a project from a large number of classes and roles (that placed in different files and folders) into a single executable portable pbc-file. I don't think parrot supports merging of .so and .pbc files, which would be required for such a step. Essentially you'd have to create something like Par::Packer, which extracts various files from an archive and makes that available. This can be very useful for scripting in desktop applications. I pinned my hopes on pbc_merge, but it seems compiled modules do not work together. It would be useful, but I don't think it is as straight-forward as you hoped it would be. Cheers, Moritz
Using precompiled modules, Assembling a project into one single file (pbc)
For example, there is a basic script and a module used by this script. main.pl -- #!/usr/bin/perl6 use v6; need Hello; my $h = Hello.new(); $h.hello('world'); $h.hello('sun'); Hello.pm --- #!/usr/bin/perl6 use v6; class Hello; method hello ($a) { say 'Hello, ' ~ $a ~ '!'; } - If you compile Hello.pm to Hello.pir and remove Hello.pm, PIR module does not load. Why? [Perl6 2011.04, parrot 3.3.0] ===SORRY!=== Unable to find module 'Hello' in the @*INC directories. (@*INC contains: /home/carmen/.perl6/lib /opt/rakudo-star-2011.04/install/lib/parrot/3.3.0/languages/perl6/lib .) Also, if you look at the (pir) code for any compiled script, it becomes clear that it uses some library called "perl6_ops". Does this mean that the file can not be run on a machine where you have installed parrot but have not installed perl6? Also, I do not understand, is there a way to build a project from a large number of classes and roles (that placed in different files and folders) into a single executable portable pbc-file. This can be very useful for scripting in desktop applications. I pinned my hopes on pbc_merge, but it seems compiled modules do not work together.