Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

palm perl porting, problems?

by dr_lambado (Hermit)
on Jul 24, 2001 at 16:26 UTC ( #99303=perlquestion: print w/replies, xml ) Need Help??
dr_lambado has asked for the wisdom of the Perl Monks concerning the following question:

<html> <body>

Hello all, I seek your divine wisdom on the topic of porting perl to my brand new Handpring Visor Deluxe. I know that it has been mentioned before, but that was quite a long time ago but I have some aditional information.....

I have done a little research into programming on the Motorola Dragonball processor and the limitations/strengths of the PalmOS. Please bear in mind I have only about 3 months experiance with perl (I primarilly websurf and mess around with linux) and remember what your mother said: "if you don't have anything nice to say, don't say anything at all".

But enough rambling. On the subject of porting perl to PalmOS I found a project on SourceForge about it initially I was disheartened at the homepage, but then I looked at the project summary which said that the project was created on the 21st June 2001 so this looks promising.

It has been mentioned before about porting perl to the PalmOS and some had said that it woulkd be very difficult. Which got me thinking how difficult would it be. The Dragonball is a 32bit chip (some stuff about the Dragonball here, an emulator here and the official page here) and there are dozens of cross compilers for porting c programs to the PalmOS. I found this which "consists of patches to binutils, gdb and GCC to support Palm OS, along with several post-linker tools" with a tutorial here. I also found this which basically tells you what PalmOS does and doesn't support when it comes to c. I don't know c so I can't tell you how useful this is/could be. There is also a zip with the a full set of FAQ's about programming for Palm here.

I am told that space is a problem with the palm devices. On the old Palm Pilots and Palm III's perhaps but my Handspring has 8MB of storage :) and even if this isn't enough (which I doubt, see below) the Visor takes Spingboard expansion modules (pdf whitepaper here) which include Compact Flash and Smart Media readers/writers which, I believe, can add up to 256Megs of storage to your Palm. Now considering that even my Windows perl distro is 32Megs, I think that this is ample space :). Also I found the Minix port of perl. This is only 923KB zipped (2.6Megs unzipped) which fits neatly into the 8Megs of space, still leaving room for swapping things in and out of memory.

Thats all I have at the moment. I took me about 4 days to find all the information and I dug up a lot of crap while I was doing it :). Some additional pages you might want to look at:
HandSpring Developers site
Work on a port of linux to the Palm series
OnBoard C, a c compiler on your PalmOS device

You're probably reading this thinking "Why has he posted this here??" or "WTF is he talking about". Well I wanted to know what you think. Is it as impossible as you first thought? I am no hardcore ASM coder, I'm not even really a hardcore perl coder, I just want to be able to write scripts when I'm on the train/plane/in the car. Over the next few weeks I'm going to try out porting perl to my Palm, I'll report the results on my homenode. If anyone has any additional information that you think that I might find useful or wants to help me then reply or mail me

Incidently, this is my first postng to perlmonks and I'd just like to say mad props to vroom for a great site and to you guys here who help make it a good site

Thanks for your time and apologies for any spelling/grammer errors :)

The Evil But Fickle Dr Lambado

</body> </html>

Replies are listed 'Best First'.
Re: palm perl porting, problems?
by mvaline (Friar) on Jul 24, 2001 at 18:00 UTC
    Aside from the difficulty in porting the C to the Palm OS due to the kludged or complete abscence of STL (I really mean standard library--Sorry) support, the changes you would have to make to the actual design of Perl are rather significant. At best, you would end up with a "Perl-like" program.

    First, the Palm OS doesn't have STDIN, STDOUT or STDERR. Now, the MacPerl people overcame that rather creatively, but since the Palm OS doesn't have a filesystem (at least not in the traditional sense), not even the most basic functionality exists. What you would have to do, I suppose, is write some sort of complicated system wherein you created a large resource database and then wrote an interface to it that emulated traditional filesystem calls.

    In the end, I don't understand how useful this would be. If you need a certain Perl-like functionality in a program, you would be better off trying to simply implement that functionality in a traditional Palm application.

      Actually, PalmOS does have a file system, but it's more like Mac's old MFS file system, in which the directories are virtual. Think reading files on Macintosh.

      However, accessing a DOS formatted flash drive, either via compact flash or SMC, is availible.

      There is existing code to read Memopad files, "schlep'ed" files (normal files wrapped around Palm's pdb database format...) and PilotDOC format.

      But for a cheap (read: not free) scripting enviroment, you should look into PocketC The only downside is that it doesn't have Internet connectivity, but thankfully is extendable.


      If by a filesystem you mean a directory system for perl to live in. I don't know about the other stuff, but this just struck me....
      After looking at this page I had an idea. If there is a version of zlib for PalmOS and zip files can have filesystems (or at least directory structures) so why not have a PalmOS app that calls the zlib to dynamically unzip what you need, this would cut down on the physicaly space need for perl (but increasing the swapping needed in RAM, bite me).

      I have no idea at all how you would implement this, but it would be cool if it worked :)

      I know that Plucker, a perl app, uses zlib on the palm to load web pages downloaded from you PC.

      The Evil but Fickle Dr Lambado
      In the Kingdom of the Blind, the One Eyed Man is King

      I don't think that the C code for Perl uses the C++ STL.

      Aside from that, I can see cases where it might make sense to have Perl (in some form) available on the Palm. Your comment about "Perl-like" may be right on the money; for instance, imagine a byte-code interpreter that lacks string eval (and hence the compiler and its huge tables). This could work like a cross-compiler; you'd spit out bytecodes into a .PDB file, and there could be a minimal Perl VM in a .PRC that could interpret the bytecodes.

      As long as you don't use string eval (and this would rule out, for instance, having a Perl compiler or full-featured debugger that actually ran on the Palm), this might be a good way for Perl-fluent programmers to make Palm apps — when loaded with Palm-specific Perl modules so you can do something useful with the Palm databases, inter-process communication, and events.

      Much as I'd like to see a real language environment that I could program on the Palm (perhaps with an attached keyboard), having a quick way to knock off Palm apps would be a real win.

      Doesn't have a filesystem?

      Then how does it store the add-on programs, text files and graphics, and all the stuff the PDA app uses?

      It needs some way to organize and find it again.

        It only has "databases", which are accessed record by record (as opposed to the Unix byte-stream model). I suppose you could use one of these to emulate files, but it wouldn't interact with anything, and so would not be useful.

        To make a Palm language useful, you have to provide access to the databases (as records, not as bytes). And ideally, you'd have some GUI layer so that you could interact and respond to the many PalmOS events (like being put to sleep).

Re: palm perl porting, problems?
by bikeNomad (Priest) on Jul 24, 2001 at 19:31 UTC
    One big problem with porting anything Unix-ish to the Palm is its segmented memory architecture. Memory lives in segments that can only be up to 64K (it was, I believe, 32K in earlier versions of the PalmOS). Because of this, anything that has big tables (like the yacc-based parser in Perl) would have to be re-written to accomodate the chunked memory.

    Additionally, there are lots of Unix-isms in the Perl source code. Like assuming that you have files, for instance, or directories. Or, for that matter, that there are standard streams connected to a spawned program.

    I looked at porting Perl to the Windows/CE OS and found that the Unix-isms would have taken some working around. The current port of Perl to WinCE provides its own console so it can simulate file redirection (which doesn't exist on PocketPC architecture).

    You may be better off looking at one of the cross-compiler environments if you just want to write Palm apps (I'd recommend PocketSmalltalk, but that's just one of many).

Re: palm perl porting, problems?
by mrmick (Curate) on Jul 24, 2001 at 18:01 UTC
    Wow! A lot of research links here...

    I have been playing around with writing small programs for my Handspring visor Deluxe for a little while now with C. I have been somewhat successful with this but what I would really like to see is the ability to write a Perl program that can be compiled to a Palm executable. I haven't found any modules out there (CPAN) but I'm certain that there is someone clever enough to do this (or maybe already has done so).

    ....just my $.02 CA ....


      Why not embed perl in your c programs, I know it's cheating but wtf..... :))

      The Evil but Fickle Dr Lambado

      </body> </html>
Re: palm perl porting, problems?
by mattr (Curate) on Jul 24, 2001 at 18:41 UTC
    One question might be why, but I won't ask. If there was a Palm Perl I'd be happy.

    You might not be able to load large modules; my Clie with 8MB RAM crashes for example playing a movie if I have less than a 1MB free. So even if you can store Perl and all your files in the memory stick or whatever you have, you will have to be careful with your use of memory. You will need to build yourself a porting layer library that simulates a lot. Not so sure you can even do :: if that indicates a module in a folder since there are no folders in palmos. But I wondered myself, even with only a small understanding of perl innards I wouldn't say impossible.

    Possibly this would be doable to some degree if the folks with Palm Linux come out with the source code, maybe even before then.

Re: palm perl porting, problems?
by wardk (Deacon) on Jul 24, 2001 at 18:43 UTC

    dr lambado, interesting timing on you post...palm just announced it is moving from the dragonball processor to ARM

Re: palm perl porting, problems?
by Ri-Del (Friar) on Jul 24, 2001 at 22:04 UTC

    Personally, I too would love to see some form of Perl for the PalmOS. Yes we are limited by hardware constraints, but can one really expect a full fledged port of Perl just yet? I do believe that some form of simplified Perl can be done.

    I have found PocketC at OrbWorks to be a really useful tool, for me as a student. It's nice to be able to prototype ideas as I think of them in class. A couple semesters ago I prototyped the final project for my Intro to Computer Organization class in PocketC and ever since then I've been hoping to do a sort of PocketPerl. I tried last semester to do just that during my Programming Languages class, because we were supposed to write a simple compiler, which while essentially quite easy, when I tried to port it over to PalmOS, I discovered was much more difficult. I had hoped to eventually turn it into something similar to PocketC , but then came finals and there went free time. If I can help in some way Dr. Lambado, I'd love to, even if I am just an inexperienced initiate.

      <html> <body>

      I'm not really an experianced coder myself, if anything, you probably know more that me. I e-mailed the developers of the perl for palm project on sourceforge but I haven't got anything back yet. If I get anything back the I'll post it here or on my homenode. If not, I'm thinking of starting up a project of my own and I would (obviously) need some(a lot of) help. I'll post a seperate node asking for help if I get nothing.

      Btw, thanks all for the support/help everyone and the ++ing too! :)

      The Evil but Fickle Dr Lambado

      Any technology distinguishable from magic is insufficiently advanced.

      </body> </html>
Re: palm perl porting, problems?
by John M. Dlugosz (Monsignor) on Jul 24, 2001 at 19:41 UTC
    My friend at work just got one of those. He quickly ran out of space (8M), so he got a smart-card reader.

    It seems that the OS doesn't address that directly as available memory. Files and programs have to be copied over to the main machine before they can be used.

    Your Perl could be written to address its SV's etc. in this extended memory, even if it's not directly addressable. That is, you can do what it takes, in your code. I don't know what that means for performance. But Smart Media is, well, not known for its speed. CF is much better (lots more pins to connect with), but still slow (same as a 4X CD-ROM).

    A Type-II CF card (the thicker one), which is what my Windows CE based PDA takes (I looked for that because it matches what my digital cameras use, so I already have (large) CF cards on hand), are available up to a Gigabyte (IBM Microdrive) for $400. The CF is basically an IDE hard disc emulation, so the size limit is the same as a PC hard disk (128G, in case you were wondering).

    Nice job of research.


Re: palm perl porting, problems?
by elusion (Curate) on Jul 25, 2001 at 06:09 UTC
    You may also want to look at this /. article about porting linux to palm. It says there's a demo. May be worth checking out.


      <html> <body>

      Unfortunately the linux port is only available for actual Palm devices (read: ones made by 3com). There is no support for the Sony Clie or any HandSpring models. Which is fine if you have a Palm Vx but not so good if you have a HandSpring Visor Prism.

      The reson for this is that the HandSprings don't have their OS flashed into memory so the linux booter (I don't think it's lilo or grub, probably something a lot smaller) can actually boot the operating system. It would have been nice if it had worked though.

      By the way, I mailed Simon Cozens today and I'll see how far he is with the port (he said he would be a few weeks in May 2000 :)).

      The Evil but Fickle Dr Lambado
      Not only does Jesus save, but he makes nightly off-site backups.

      </body> </html>
Re: palm perl porting, problems?
by BrentDax (Hermit) on Jul 25, 2001 at 08:54 UTC
    Personally, I think the best approach would be to have a desktop application you run on a Perl script to turn it into an easily-parsable form, and then reimplement the parser in your Palm code to read that form and create the optrees from it. Yeesh.

    There are a lot of differences between Palm OS and traditional desktop OSes, for example the existence of a heirarchical file system. Some commands might need different syntax to do this, ie, open.

    One of the big plans in Perl 6 is that you'll be able to rip out the parser and replace it with something else, so a Palm port would be (relatively) easy to implement--just load up the interpreter (codenamed Parrot) with a bytecode loader, stick the bytecode into a database, and run Parrot on the bytecode database. You lose certain functionality, such as eval $string, but you also end up with a Perl that doesn't crash your Visor or fill up its memory.

    I wouldn't recommend the zlib technique--in order for Perl to be a glue language, it has to interact with other program's databases.

    Simon Cozens said a long time ago on perl5-porters that he was almost finished with a Palm port. Maybe you can contact him and ask about it.

    I'd be happy to help. I have a Visor Prism (mmm, color...) and an itsy bitsy teeny weeny bit of experience with both Palm OS programming and Perl internals. Lemmie know...

    --Brent Dax
    There is no sig.

Re: palm perl porting, problems?
by raptor (Sexton) on Jul 28, 2001 at 23:56 UTC
Re: palm perl porting, problems?
by dr_lambado (Hermit) on Jul 25, 2001 at 16:31 UTC
    <html> <body>

    After sleeping on this, I woke up an thought this:
    If it's going to be difficult (read: Damian Conway+Larry Wall+CowboyNeal needed) to do a full port to Palm OS, then what about a perl debugger? This wouldn't be too dificult, plus I would think that it would be a more effective use of time until perl6 comes out (anybody got an ETA on that?). This is, of course, only if the guys I have mailed above don't respond in a week or so.

    The reason I am not wanting to go straight ahead with a full-blown perl port is really becuase I don't have the technical ability/time to do things like this. Plus if someone already has a lot of the port done, I don't want to look like a fool :). Remember the first rule of programming: don't try to re-invent the wheel.

    The Evil but Fickle Dr Lambado
    Recursive: Adj. See Recursive.

      Er, Perl already has a debugger... perl -d (or something like that)

      --Brent Dax
      There is no sig.

        <html> <body>

        The problem we would have to get the built-in debugger to work, you would first have to port perl to Palm, therefore defeating the object of not porting perl to Palm

        By the way, still nothing from any of the mails I sent..... :(

        The Evil but Fickle Dr Lambado
        Perhaps we will have to evolve super-intelligent Khan-like coder clones in the future, using nanotech, Beowulf clusters, and in-dash Atari 2600 emulators.

Re: palm perl porting, problems?
by beretboy (Chaplain) on Jul 26, 2001 at 03:44 UTC
    A perl-like port for the palm would be awesome but if this is not possible there is an alternetive (albeit you have a wireless internet connection on your palm). You could use a telnet program and make your server at home do all the processing.oh well, just a thought.

    "Sanity is the playground of the unimaginative" -Unknown

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://99303]
Approved by root
[marto]: "Eugenie Scott, executive director of the National Center for Science Education, dubbed this approach the Gish gallop, describing it as "where the creationist is allowed to run on for 45 minutes or an hour, spewing forth torrents of error that the
[marto]: evolutionist hasn't a prayer of refuting in the format of a debate." She also criticized Gish for failing to answer objections raised by his opponents"
[erix]: one would hope evolutionists haven't any prayers anyway
[marto]: obviously someone could be religious, but not creationist
[erix]: "Nothing in Intelligent Design makes sense except in the light of Creationism" <-- I made that one up myself (free after Dobzhansky )
[erix]: yes. Deplorable marto, deplorable.
[marto]: the situation seemed similar to this one, majority of the contributrions are nonsense, doesn't address any questions ...
[marto]: meh, I've been called worse :P

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2017-07-28 15:43 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (431 votes). Check out past polls.