Perl


48 posts   Page 1 of 2   1, 2
by BillStephenson » Mon May 21, 2012 6:00 pm
I'm still waiting for my raspi but I did get a chance to download the VirtualBox and official Debian image and play with perl a bit on that.

The VirtualBox and disk image started fast and runs great on my Mac Mini, but it doesn't connect to the network so I wasn't able to install any modules using CPAN .

First thing I did was use "LeafPad" and "Geany" to create a few simple perl scripts and ran them from the terminal, so I have sort of gotten my feet wet. :D

When I get my raspi I want to try installing gd-libgd and the GD.pm perl modules for graphics, then get a web server running. I'll also try and install the perl "Catalyst Web Framework", but I'm not sure how much, if any, of this I'll be able to accomplish without some help.

Whatever I learn I will share here. I'm excited as a kid with a new bicycle about what I can do with Perl on a Raspberry Pi, and a little bewildered as to why the Perl community seems to be lagging with getting involved.

Hopefully we'll see a few perl hackers show up soon and start sharing some code!
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by Gibble » Tue May 22, 2012 7:48 pm
Hiya, I'm interested in anything on the Perl front. I have been struggling with CPAN though and out of memory errors, which has made me put doing anything on hold just for the moment.
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by BillStephenson » Wed May 23, 2012 4:26 am
What have you tried installing?

Is it possible to preinstall modules before making the disc image?
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by Gibble » Thu May 24, 2012 9:51 pm
Hi Bill, it was basically anything, things like File::Which, whilst trying to resolve some dependencies. I may have a play with the Pi startup memory allocation when I get chance, see if that makes any difference.
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by Gibble » Fri May 25, 2012 9:27 am
Just adding for the record, I'm trying a suggestion to use cpanminus. Looks good so far...

Check their page for instructions, but if it helps, these are the bits I did.

sudo apt-get install curl
curl -L http://cpanmin.us | perl - --sudo App::cpanminus

sudo cpanm -i <module I wanted)
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by BillStephenson » Fri May 25, 2012 4:02 pm
I just installed perlbrew and cpanminus on my Mac Mini and it's worked great. Yesterday I installed "Dancer.pm" (http://perldancer.org/) on the Mac and went through the intro and tutorial. Like Catalyst, it's got a built-in web server, and I think it might work fine for my purposes.

After reviewing several web app frameworks I think I like Dancer the best for several reasons. Catalyst is great, and I'll want to keep looking at it, but Dancer is lighter and I think I can integrate it better with my own personal way of doing things. Plus, I think it'd be easier to get newbies up to snuff with Dancer. The docs and examples are good and it's a great starting point for learning perl because you can build some cool apps while learning some "best practices" at the same time.

Once you've hit a wall with Dancer it looks to me like transitioning to Catalyst would be easy as "pi" ;)

If you get a chance to take a crack at installing Dancer please let me know how it goes. If that install goes smooth I'll be wringing my hands to get my raspi.
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by Gibble » Fri May 25, 2012 6:45 pm
It installed fine (ie no errors anyway), via cpanm, took about 90 mins or so. I haven't tested any of it though.
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by BillStephenson » Tue May 29, 2012 5:09 pm
Thanks Gibble!!!

90 minutes huh? I really don't recall how long it took on my Mac. Once installed, testing the web server is pretty easy though. The site (http://perldancer.org/) has a "Quick Start" guide and it only take a couple shell commands to run a helper script and start the server.

If you test it, and it works, you may want to announce that in another part of the forums. I've seen several announcements about getting Apache up and running, and while Dancer's server may not be in that league, I think it's still worth noting, and it can't but help spark some more interest in using Perl on the Pi.
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by Gibble » Wed May 30, 2012 12:03 pm
Hi,

I've just tested it as far as getting a "Hello World" displayed remotely from the Pi to my desktop PC in a web browser, so looks to be working ok.
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by BillStephenson » Thu May 31, 2012 2:56 am
Thank you! That's very encouraging...

I think by default Dancer uses "HTTP::Server::Simple", so I played with it yesterday for awhile. That's pretty cool all by itself. I'll have to play with it some more.
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by dch26 » Fri Jun 29, 2012 4:36 pm
Hi all,

just another Perl hacker here - just got my pi and joined the forum.

just posted to the graphics->opengles with this:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=68&t=9752

which, actually, you kind folk may be more capable of helping me with rather than the specifically graphics interested people over there.

very keen to make perl one of the languages of choice for the pi - so we need to get opengl going. and keep our perl posts "noticed" in the forum!!

any responses much appreciated.

also - if you need help with perl (opengl, pi specific or otherwise) - just drop me a line.

keen to be involved with any/all perl projects :)

cheers
dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by malcolmf » Sun Jul 01, 2012 7:51 am
Well, just count me in as another Perl user - hacker is way above my pay grade.

Had some issues with cpan and cpanp (kept saying it couldn't unpack the .tar.gz files for modules) but installing modules by hand works OK. Installed Tk, and to my delight found that the Distributed Proofreaders post-proofing tool, guiguts.pl works nicely on a Pi (once you remove the awkward DOS line ending from the first line of the script -- /usr/bin/perl^M is not a valid program!).

Currently fiddling about learning how to use Tk, putting a GUI interface on simple scripts. It's fun, but development would probably go faster if I actually had a specific end goal!
Posts: 11
Joined: Tue Jun 19, 2012 2:20 pm
by Htbaa » Mon Jul 02, 2012 10:04 am
May I suggest to install Perl modules with the -n|--no-test flag for cpanm? Yes, you won't be running the tests for the modules before you install them, but with the limited CPU power and memory of the Raspberry Pi it's going to take a long time to get all the tests run.

Thanks to automated testing (http://www.cpantesters.org) a lot of modules have been tested on several platforms. Maybe not the Raspberry Pi, and perhaps not even ARM, but most Perl modules are written in plain Perl anyway. So if you check out a module there and it has good PASS results it's likely the module will work fine on your Raspberry Pi.

That said, if you're running into issues that don't happen on other platforms it's worth looking into. These days I don't run the test suites of modules I install. The test suite of my software should test correct functionality of my software. If something strange shows up there it's usually not that hard to pin point the root of the problem.

Installing Catalyst on a modern system without tests already takes quite some time. Haven't tried Dancer. There's also Mojolicious which is just 1 tarball you can install. Very nice webframework.
http://blog.htbaa.com
Posts: 2
Joined: Mon Jul 02, 2012 9:55 am
Location: Netherlands
by harwoodr » Mon Jul 02, 2012 2:26 pm
I agree with dch26 we need a strong perl presence , and a strong supportive perl comunity.
I am very much into perl and also would like it elevated to the language of choice on pi, to do it we need to get a host of projects going that incorporate opengl , sound, media streaming and the like.
Lets kick some idea's around and collaborate on something swish in perl for pi
Posts: 3
Joined: Sat Jun 02, 2012 6:20 am
by Joe Schmoe » Mon Jul 02, 2012 2:33 pm
harwoodr wrote:I agree with dch26 we need a strong perl presence , and a strong supportive perl comunity.
I am very much into perl and also would like it elevated to the language of choice on pi, to do it we need to get a host of projects going that incorporate opengl , sound, media streaming and the like.
Lets kick some idea's around and collaborate on something swish in perl for pi


If we did that, we'd have to rename the device. Maybe Blueberry Pell?
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2269
Joined: Sun Jan 15, 2012 1:11 pm
by jamesh » Mon Jul 02, 2012 2:42 pm
harwoodr wrote:I agree with dch26 we need a strong perl presence , and a strong supportive perl comunity.
I am very much into perl and also would like it elevated to the language of choice on pi, to do it we need to get a host of projects going that incorporate opengl , sound, media streaming and the like.
Lets kick some idea's around and collaborate on something swish in perl for pi


You might be stretching to get it as the language of choice - I've done a bit of Perl - the syntax is 'challenging' and I don't think suitable for teaching beginners. My opinion. Your's may differ!
Raspberry Pi Engineer
Raspberry Pi Engineer
Posts: 10590
Joined: Sat Jul 30, 2011 7:41 pm
by dch26 » Mon Jul 02, 2012 6:32 pm
clearly we all have a language of choice!
mine IS perl.

for me, & people like me - we need to make the perl implementation on the Pi as complete as possible.

opengl is something i am very interested in and it is available on the Pi for C, Python & ruby.

i have now started work on the C shared library wrappers for perl.
i have completed "bcm_host" & am working my way through "egl".

i will update my progress on this forum - either in this post, or my other one over in graphics-programming/opengles
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=68&t=9752

anyone that wants to help -please get in touch. i may need it!

cheers,
dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by BillStephenson » Tue Jul 03, 2012 7:06 pm
Wow, I haven't checked-in in awhile, it's sure nice to see others here jumping into the fray :D

I got to order my RPi today, so I'm sitting on pin&needles now. Hopefully it will be here in just a few days.

I've got some of my own software I want to try and get up and running first, and some I want to build for use just on the RPi. Among other things, I want to try and get libgd and GD.pm running on it. I've never used openGL, but I'm sure willing to learn about it, and help with whatever I can to get it up and running.

I registered "RaspberryPerl.com" a month or two ago. I'll be putting a couple simple perl apps up there for beginners to download and play with soon. I'll put an address book and a notepad there for starters. I've already commented the code fairly well, but I'll expand on those and try to explain each line of code for perl beginners. It's my hope that others might put some scripts, examples, and lessons up there too, and that perhaps it may become a place to gather and share info on using Perl on the RaspberryPi.

For the record, I have no intention of running any ads, or monetizing that site, or promoting myself with it, in any way. I do intend to provide a place where people can feel free to ask questions and discuss ideas without being told they are "off topic" and chased away, which I've seen happen far to often on some of the perl mailing lists.

I'm no Perl expert, far from it, but I've found that I can do quite a bit with perl and can be productive with it. Personally, I think the bad rep perl has gotten for being obfuscated is more of a misunderstanding of the language and the attitude of the larger culture that grew around the language. Too many users were persnickety and prided themselves on condensing readable code into the shortest one-liner that was always unreadable. It still happens. I learned to ignore that crowd entirely by embracing the perl mantra, "there's more than one way to do it".

Perl code was designed to be, and can be, very human readable. Even large and complex perl applications can be written to be easily readable and editable, and in my humble opinion, they always should be.

So using perl on a RaspberryPi can and should be a viable and thriving option for those who want to learn how to program. It'd be a shame to make the same mistakes the Perl community made back in the 1990s when they chased away those who were trying so hard to learn perl. The RaspberryPi gives us a chance to do it better this time. I look at it like it's a fresh start, and we're all in a position to help with that.
Posts: 49
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
by dch26 » Wed Jul 04, 2012 3:53 pm
announcement!!

i have ACCELERATED 3D OPENGL ES 1.x running on the Pi using PERL

enabled by a whole series of perl module shared library wrappers that i have written over the last few days.

LOTS of tidying up to do, more functions to include, making more efficient, etc

but i can confirm, that i have on the screen in front of me rotating very smoothly at a resolution of 1920 x 1200 an object!!!

its not ready for distributing yet......(and i wouldnt know how to!) but i'd thought i'd announce it.

very pleased with myself :)

cheers
dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by Gibble » Wed Jul 04, 2012 4:04 pm
Congrats, will be very interested to see some bits of it.
Posts: 56
Joined: Wed May 09, 2012 9:52 am
by dch26 » Thu Jul 05, 2012 2:52 pm
now have keyboard input to control movements.

also.......multiple viewports (aka split screen) so i can see my object rotate from the front & above at the same time......dont know why really......it was just an artifact of doing the code which controls the GL window position & size - while maintaining the aspect ratios.

obviously we dont have GLu and GLut support routines available on the pi, so i am having to write my own fake ones as i go (gluperspective, glulookat, etc)

textures up next.....watch this space
(and.....because i dont have a digital camera.... :o i need to find out how to take a screenshot of the pi so that i can post some piccies on here to maintain interest/ask for help!)

cheers
dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by davesedar » Thu Jul 05, 2012 3:24 pm
dch26 wrote:(and.....because i dont have a digital camera.... :o i need to find out how to take a screenshot of the pi so that i can post some piccies on here to maintain interest/ask for help!)

cheers
dch


This appears to be an answer:
http://www.raspberrypiforums.com/forum/ ... spberry-Pi
good luck
Posts: 31
Joined: Mon Mar 05, 2012 3:41 pm
by dch26 » Thu Jul 05, 2012 4:21 pm
thx davesedar,

however, "scrot" only works in X as far as i can tell.

X isnt 3d accelerated - so we're not playing in there just now :)

need a screenshot of display 0 - which is the one physically connected to the device, and not an SSH session or whatever

ta

dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by dch26 » Sun Jul 08, 2012 1:38 pm
Ok, good news!
I have written the perl code to grab screenshots.
It works, but its slow (because it uses the glReadPixels function)

But its perfect for grabbing images to show you guys on the forum

I will post some later.....

dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK
by dch26 » Mon Jul 09, 2012 8:26 am
hi

screenshot evidence!
you will notice that i have got texturing working too :)

screener.jpg
perl pi opengl textured screenshot
screener.jpg (18.43 KiB) Viewed 3324 times


screenshot is captured in targa (.tga) format.
(converted to jpg for forum upload)

textures are loading from .raw files right now, but
i will load them from .tga next

dch
Posts: 23
Joined: Fri Jun 29, 2012 3:32 pm
Location: UK