On Sat 13 Sep, Ben Kal wrote: > > May I ask your help for setting up !Perl on my Risc PC with Select.
I don't have Select, but all this is probably the same there as it is here on RISC OS 3.7. > I was glad to see that Perl is available for RISC OS, so I > copied it from the latest Foundation RISC User cd (that was > version 5.005) and even downloaded Alex Waugh's version 5.8.0. I haven't tried Alex Waugh's 5.8.0 because it didn't sound like he was confident that it was finished. Stability and completeness have always been higher priority for me than new features. Perhaps Alex will let us know if things have changed since. For what follows assume Perl 5.005_03 as found here: http://plum.flirble.org/~nick/P/perl_113_riscpc.zip > Then I wanted to set things up so that I would be able to > really do Perl programming under RISC OS, but failed. I wonder what you mean by "really do". Perl on RISC OS is unfortunately not practical in all the places you may have used Basic. This is because Basic is a "language module" that stays resident in memory and can start Basic programs instantly and with only about 8K overhead per program. In contrast, when a Perl program runs, a massive 1Mb of application memory is required to load a *separate* copy of the perl executable each time. Even if memory was not a constraint, the loading itself takes several seconds thus making it impractical to run periodic scripts, and the like, as you might have been used to on Linux. I would dearly love to be able to use Perl instead of Basic for all my RISC OS programming, but until someone implements it as a language module, this isn't a realistic option. I hate to think what a RISC OS based web server's response time would be when a visitor requests a resource from a Perl CGI script. Having said all that, I'm not skilled in the art of porting Unix software to RISC OS myself, and I'm damn grateful to have Perl at all. > After a full day of trying I feel that it will take ages before > I shall have figured out myself how Perl has to be set up. If you simply place the !Perl application into your !Boot.Resources directory (and reboot) then Perl scripts will run in the same manner that Basic programs run by default, ie. in a non-multitasking command window if double-clicked, or from the command line. Personally, I prefer to run Perl progs in task windows so that I can interact with them whilst still having access to the rest of the desktop. Line 57 of the !Perl.!Boot file can be uncommented to set the runtype for Perl programs so that they are launched in a task window with more than enough memory. This is fine if you *only* wish to run them in a task window. I don't use this myself. So that I can have a *little* more flexibility over where to run Perl progs from, I made a few small alterations as follows: Leave line 57 of the !Perl.!Boot file commented out. Comment out line 46 of the !Perl.!Boot file which sets the runtype so that the perl executable is started directly. Delete the last two lines of the !Perl.!Run file and replace them with the following three lines: If "<Wimp$State>"="desktop" then TaskWindow "/<Obey$Dir>.Perl %*0" 1024k Perl -quit If "<Wimp$State>"="commands" then WimpSlot 1024k If "<Wimp$State>"="commands" then /<Obey$Dir>.Perl %*0 The result of these alterations (after a reboot of course) is that you can run Perl progs from the command line, or double-click them to run them in a task window. However, when typing into a task window Wimp$State is "desktop" and this causes each command to launch into a new task window (rather like launching X applications from within an xterm). Of course, the !PerlRun application is designed to detect when you are within a task window and do the right thing accordingly. I don't use it myself, although I probably should. However, I'm surprised you could not get it to work for you. > 1. I see no way to make the Risc PC gracefully handle running Perl scripts: > - by double clicking a script file in the desktop (how to pass parameters > then if needed?); Parameters can never be passed to a double-clicked file. This is not a Perl limitation, it is a natural result of the fact you're double-clicking the file rather than typing a command line. > I found !PerlRun which seems designed to solve this problem, but if I use > that I invariably get a 'No writable memory at this address' message. I'm sorry, I can't think what would have caused that. Does it make a difference when you set the Wimp's "Next" slot to more than 1024K? > 2. Perl cannot find the packages that many, many scripts rely on One of my gripes about the RISC OS Perl situation is that so many modules require compilation via a "make install". I have never managed to get that to work on RISC OS because it is too Unix specific and I don't know enough about porting Unix software. (If anyone else has had success in this area and can offer tips, I'd love to know.) The bottom line is that many Perl modules cannot be installed on RISC OS and furthermore none of the modules that depend on those other modules can be installed either. Bummer eh? > Perl very often reports that it cannot find a certain package in a list > of directories in @INC (yes I know what that is for) that in no way > corresponds to the directory structure within !Perl. *perl -MWibble Can't locate Wibble.pm in @INC (@INC contains: /PerlPrivLib:zip /PerlArchLib: /PerlPrivLib: /PerlSiteArchLib: /PerlSiteLib: .). BEGIN failed--compilation aborted. Hmmm, those are path variables which you can see like this: *show Perl*$Path Perl$Path : ADFS::HD.$.!Boot.Resources.!Perl. PerlArchLib$Path : ADFS::HD.$.!Boot.Resources.!Perl.riscos. PerlP$Path : ADFS::HD.$.!BOOT.Resources.!Scrap.ScrapDirs.ScrapDir. PerlPrivLib$Path : ADFS::HD.$.!Boot.Resources.!Perl.lib.,ADFS::HD.$.!Boot.Resources.!Perl.more-lib. PerlScript$Path : ADFS::HD.$.!Boot.Resources.!Perl.scripts. PerlSiteLib$Path : ADFS::HD.$.!Boot.Resources.!Perl.lib.site_perl. The last line there is the directory into which you may install any modules you find which are Perl-only and are not dependent upon other modules that require compilation. Yes, there are a few. > I cannot believe that I am supposed to rearrange all the packages > into directories > /home/riscos/cross/local/lib/perl5/5.8.0/riscos-aof > /home/riscos/cross/local/lib/perl5/5.8.0 > /home/riscos/cross/local/lib/perl5/site_perl/5.8.0/riscos-aof > /home/riscos/cross/local/lib/perl5/site_perl/5.8.0 > /home/riscos/cross/local/lib/perl5/site_perl Where did you get those directories from? > It is equally hard to believe that I am supposed to edit the start of > each and every supplied script to make it change @INC at compile time; I've never found that necessary on my own machine. It tends to be necessary only on systems where you cannot update the central module repository but where you can install modules into your own home directory. > apart from that, attempts to do it failed. Is there a way to do it > globally? You shouldn't need to on RISC OS, but if you wanted to add specific directories to the setting of PerlSiteLib$Path in the !Perl.!Boot file then nobody would stop you. > Please, can someone enlighten me on how to solve these > problems, so that I can *conveniently* use RISC OS Perl? Well, I've done my best, but you may not find it as convenient as you were hoping. > And of course, if someone is able and willing to write such instructions, > publish them on the internet and make RISC OS Ltd add them to their next > Foundation User cd. I think the functionality of !PerlRun could be added to the !Perl application itself and then no such instructions would be necessary. I might have a go at that. I certainly wouldn't wish you to duplicate the waffle I wrote above. :-) Good luck! -- James Taylor, Cheltenham, Gloucestershire, UK. PGP key: 3FBE1BF9