Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Raspberry Pi and Perl

by marinersk (Priest)
on Apr 06, 2016 at 05:33 UTC ( #1159676=perlmeditation: print w/replies, xml ) Need Help??

I'm finally entering into the world of prototype robotics. The research has been fun, even fascinating at times, but I'm at a point where getting feedback from those whose opinions I respect seems appropriate.

I'm looking for general feedback from any Monks who have worked in that space on the values or detriments of using Perl on Raspberry Pi in this capacity.

For a variety of reasons, I'm leaning toward using as close as possible to stock builds. A good argument for a different Linux or a different Perl is welcome, of course.

Arguments for the Windows OS on Raspberry are also welcome, I suppose, but the argument will likely be challenged to pique my interest for long.

Replies are listed 'Best First'.
Re: Raspberry Pi and Perl (updated)
by haukex (Archbishop) on Apr 06, 2016 at 09:38 UTC

    Hi marinersk,

    TL;DR: In general, Perl works fine on the Raspberry Pi, it comes preinstalled with Raspbian.

    I've worked with Perl on the Raspberry Pi 1, 2, and I actually just fired up my first RPi 3 the other day, in all cases with Raspbian. It's a Debian variant so if you've used Debian or Ubuntu then everything at the command line level will be familiar to you; there is an additional configuration tool raspi-config that helps you configure a few things.

    As for performance, the Raspberry Pi 1 feels somewhat sluggish by modern standards. The commandline works fine, but compiling things or even just doing apt-get upgrade can take a while (and don't even think about browsing the web). On the other hand, because its video processor is good, streaming large video files works surprisingly well. So, if you're doing single-use tasks with it, or just running small background tasks, then once they're up and running they work just fine. I wrote a serial logging daemon in Perl, which I used to log streams from two RS232/USB adapters, and it worked perfectly fine.

    The Raspberry Pi 2 makes a huge difference in performance - the GUI becomes usable, and the overall speed makes things much smoother to use. I haven't yet noticed a huge performance difference between the RPi 2 and 3, but finally having WiFi on-board on the RPi 3 is great. I haven't yet had a chance to play with the RPi Zero, but its performance is probably not quite as good as the RPi 2 because it's only got a single-core 1GHz chip.

    Since you're getting packages from the Debian repositories, I was able to pull in all my dependencies via apt-get - because I was only working with the RPi 1 at the time, and compiling is a bit of a pain there, I didn't yet try to build my own Perl and install modules from CPAN directly, but again, since it's a pretty normal Debian, I'm not expecting big problems. And since the RPi 2 and 3 are much faster, I'll definitely try compiling Perl there. Update: Just built Perl v5.22.1 on the latest Raspbian on an RPi 3, it compiled and installed cleanly, and now I'm installing some CPAN modules on top of that and everything is good so far. So it looks like you should be able to use either Raspbian's Perl or one you've built yourself.

    As for Windows 10 on the RPi, be aware that it's not a full version of Windows 10 with a full GUI - it's an "Internet of Things" edition that apparently is mostly supposed to run background services etc. Here's a video about it:

    As for Raspberry Pi vs. others, there seems to be a small boom of such RPi-like "minicomputers" going on at the moment; you'll find lots of alternatives. AFAIK, two of the major goals of the RPi project was for it to be for educational and hobbyist use (people learning electronics etc.), and for it to be low-cost. That has led to it lacking some features that others offer, like for example enough USB ports on the v1 (I've almost always had to hook my RPi up to a powered USB hub), or a flexible power supply. So it really depends on what applications you want to use it for whether it's good enough for you, or if perhaps one of the more powerful (but generally more expensive) alternatives out there might be better for you. One advantage to the RPi is that they've got a good community going, so there's no lack of community support.

    Shameless plug warning! The serial logging daemon I mentioned, which is fairly general-purpose, along with instructions to install it on a Raspberry Pi, are available under the GPL3 here:

    Hope this helps,
    -- Hauke D

      I like to start a new Raspberry Pi install with apt-get install libdancer-perl libdist-zilla-perl. Even if I'm not going to use Dancer, it pulls in a whole lot of dependencies without some of the extra overhead of cpanm.

      HiPi was recently updated to work on the Zero and Pi 2/3.

      I wouldn't expect a huge gain on the Pi3 until there's a 64-bit version of the OS. Right now, it's just a small clockrate bump from the Pi2.

      "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

        cpanm overhead? lol what?
Re: Raspberry Pi and Perl
by marto (Cardinal) on Apr 06, 2016 at 06:12 UTC

    super search will find existing discussions on this topic, including Pi Zero. You likely want to use the v3 Pi, since it's more powerful than any of the others. An appropriate web search will find you a great deal of benchmarks of the various Pi devices, and comparisons to other single board computers which are on the market.

    You can tweak the stock Debian fork for better performance (referenced in the link above) Currently Raspbian only has 32 bit builds. Other OS are available.

    Given the number of competitors available it'd be wise to consider them.

Re: Raspberry Pi and Perl
by cavac (Vicar) on Apr 14, 2016 at 08:13 UTC

    I do a lot of projects using the Raspberry Pi and Perl. Most of the time, i use a Perl version i compile into my home directory (/home/cavac/bin/perl-versionnumber/...), as this avoids conflicts with the package managment.

    Generally, it works fine on the Pi 2 and Pi 3. I'm using a bunch of these in a cluster to do work on my mesh network code.

    Even running PostgreSQL and my Maplat Webserver (written in Perl) on a Raspberry Pi 2 is not a problem. For example, i run my home climate control on one of them (Link may or may not work when you try, this depends on the number of bugs in my DIY DynDNS implementation).

    Another RP2 based project runs at my office desk, a status board with 100 RGB LEDs, showing me the statuses of all production lines and my main servers.

    "For me, programming in Perl is like my cooking. The result may not always taste nice, but it's quick, painless and it get's food on the table."

      Nice work on the Mesh. I'm looking forward to delving into your code.

Re: Raspberry Pi and Perl
by stevieb (Canon) on Aug 03, 2016 at 16:53 UTC

    I just bought a couple Raspberry Pi 3 devices, along with an electronics kit to get me started that'll be arriving tomorrow.

    My goal will be to automate my entire hydroponic grow environment; temps, humidity, lights, EC/PPM, fans etc from a single device, with a single interface. Of course, it'll take some time, but I'm very excited to get started; it's been many years since I've dabbled with electronics/PLC type stuff.

    I've been doing some research, and I think I'll start playing with the lower-level Device::BCM2835 module initially to familiarize myself with things, and if I find that I'm beginning to write too many wrappers, I'll test out the HiPi API to see if it covers most of the things that I'll need to do.

    How's your project(s) going? Do you have any example code that you can share?

      No code yet; I'm still researching. As is usually the case in new territory, the more I learn, the more I find I need to learn.

      Also, now in the throes of buying an on-the-edge-of-my-budget house, all pennies are pinched by default until we're past the Raman Noodles stage.

      That said, the electronics kit looks wonderful; I'll be adding that to my startup materials. Thanks for the link.

      The other expenditure needed is Arduino step motor controls; this design needs to be mobile and is itself a mobile platform of moving parts.

      I'm also considering building a simulator test platform so the testing doesn't require constant portage to the bot -- but that is an entire project unto itself and may not represent the most expedient way to go about this.

      I'm thinking with the WiFi option on RPi3, a physical test environment might be the better way to go. I may have to revisit this decision as I start developing the self-defense module.

      So actual shareable code will be awhile.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1159676]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-09-23 04:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found