Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

View Poll Results: how do you feel about perl jam?
mmmmmm it's delicious! 8 57.14%
uhhh, i'm not gay. (sorry, ladies) 6 42.86%
Voters: 14. You may not vote on this poll

Reply
 
Thread Tools Search this Thread
Old 08-27-2011, 01:02 AM   #1
fbdev
fbdev
fbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel is
 
Posts: 107
Karma: 70177
Join Date: Jul 2011
Device: kindle
perl for kindle

i'm just going to call a mulligan on this release and hope nobody notices. =]

source
Attached Files
File Type: gz perl.tar.gz (6.18 MB, 907 views)

Last edited by fbdev; 08-27-2011 at 02:30 AM.
fbdev is offline   Reply With Quote
Old 08-27-2011, 01:08 AM   #2
fbdev
fbdev
fbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel is
 
Posts: 107
Karma: 70177
Join Date: Jul 2011
Device: kindle
oh, right... i was so distracted by nonsense i forgot to write the manual.

# tar xvzf /tmp/perl.tar.gz -C /mnt/us/system
# mntroot rw
# ln -s /mnt/us/system/perl /opt/perl
# mntroot ro
# export PATH=$PATH:/opt/perl/bin
# echo 'hello, world!'|perl -ne 'print'

Last edited by fbdev; 08-27-2011 at 02:34 AM.
fbdev is offline   Reply With Quote
Old 08-27-2011, 02:42 AM   #3
fbdev
fbdev
fbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel isfbdev really knows where his or her towel is
 
Posts: 107
Karma: 70177
Join Date: Jul 2011
Device: kindle
posting and watching the weather channel
leads to
writing
with your head in the clouds.
fbdev is offline   Reply With Quote
Old 10-12-2011, 02:02 PM   #4
fink
Junior Member
fink began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: kindle dxg
Anyone knew how to use it?
fink is offline   Reply With Quote
Old 10-15-2011, 12:51 AM   #5
ryran
Connoisseur
ryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with others
 
Posts: 79
Karma: 2718
Join Date: Aug 2011
Device: Kindle 3G
If you don't know how to use it, trust me on this: You don't need it.
ryran is offline   Reply With Quote
Old 10-15-2011, 02:59 PM   #6
fink
Junior Member
fink began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: kindle dxg
maybe you are right. I am just learning perl in windows by activeperl. And I know little about linux. Maybe you are all experts in this field. I do not feel ashamed as a beginner.
fink is offline   Reply With Quote
Old 10-21-2011, 02:15 AM   #7
ryran
Connoisseur
ryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with othersryran plays well with others
 
Posts: 79
Karma: 2718
Join Date: Aug 2011
Device: Kindle 3G
Oh we're definitely not all experts. I'm certainly not. Hopefully my comment didn't come across as condescending. I know what perl is and how to use it, but I actually have no use for it on the Kindle. fbdev is still that man though.
ryran is offline   Reply With Quote
Old 01-26-2012, 06:59 PM   #8
thatworkshop
hub
thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.thatworkshop ought to be getting tired of karma fortunes by now.
 
thatworkshop's Avatar
 
Posts: 715
Karma: 2151032
Join Date: Jan 2012
Location: Iranian in Canada
Device: K3G, DXG, Kobo mini
Quote:
Originally Posted by fbdev View Post
i'm just going to call a mulligan on this release and hope nobody notices. =]

source
I'm trying to run vncserver on Kindle and needed perl! So thank you fbdev! awesome...
thatworkshop is offline   Reply With Quote
Old 02-16-2012, 09:19 PM   #9
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
OK, I've installed bozohttpd on my K3G with no errors, can load a page with localhost, using the command line bozohttpd -b -c /mnt/us/www/cgi-bin -X /mnt/us/www, but when I try to submit a form, it says that it can't download the file, which I'm assuming means that either CGI didn't initiate or I'm incorrectly using the Perl I installed, and it's trying to download the .cgi file rather than load it.

I don't really know much about bozohttpd, nor am I sure what to put in the shebang line of index.cgi, so the problem might lie there.

I've attached the files I'm using for this Perl program, which works with no problems on my computer.

I have tried both
Code:
#!/mnt/us/system/perl/bin/perl

and

#!/opt/perl/bin/perl
As I have correctly made a symlink as per this thread, but neither way changed anything. I'd be very happy if someone could help me.

F.Y.I. I was successfully able to print out "hello world" in the tutorial by fbdev, so I am sure that Perl is correctly installed.

UPDATE: I tried going to http://localhost/cgi-bin and it says the Kindle can't load the page, even though the cgi-bin shows up in the directory if I go to localhost with no index.html, so I don't know what's going on...
Attached Files
File Type: zip Perl Script.zip (703 Bytes, 472 views)

Last edited by sjheiss; 02-16-2012 at 09:33 PM.
sjheiss is offline   Reply With Quote
Old 02-16-2012, 09:23 PM   #10
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Are you sure that the CGI module is installed on the device?
Try running that script from the command line *on the Kinde*.
ixtab is offline   Reply With Quote
Old 02-16-2012, 09:48 PM   #11
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
Quote:
Originally Posted by ixtab View Post
Are you sure that the CGI module is installed on the device?
Try running that script from the command line *on the Kinde*.
OK, I think I can do that, so I'll report back in a bit.

In response to my other thread that you posted on, I ran ps aux and found that for some reason bozo started with "-c /mnt/us/www" and not "-c /mnt/us/www/cgi-bin" like I thought I did, so after I get my browser to crash and try killing it I'll see if I can fix that.

Last edited by sjheiss; 02-16-2012 at 09:51 PM.
sjheiss is offline   Reply With Quote
Old 02-16-2012, 09:54 PM   #12
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
To run the perl file, just execute "/path/to/index.cgi" on the device.
This will actually allow to check multiple things:

- whether permissions are set correctly (i.e., file is executable). For
all cgi-bin implementations I know, files must be executable (i.e. "chmod 755 /path/to/index.cgi"
- whether the shebang is correct
- whether the perl contents of the file can actually be correctly evaluated. I'm pretty sure that you'll get something like "CGI.pm not found" (or similar).
ixtab is offline   Reply With Quote
Old 02-16-2012, 10:17 PM   #13
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
OK, if I run the command you gave, gives me the error in the attached picture.

I checked ps aux and it shows bozohttpd as "/mnt/us/myts/bozohttpd -b -c /mnt/us/www/cgi-bin -X /mnt/us/www" so it looks like it's starting correctly, but perhaps not. Permissions are indeed 755.

Anyways, thanks a lot for the continued help!

(Also, tried running your command on my Kindle directly, with myts, and got the same exact error as the picture.)
Attached Thumbnails
Click image for larger version

Name:	Perl Error.png
Views:	592
Size:	94.1 KB
ID:	82653  

Last edited by sjheiss; 02-16-2012 at 10:22 PM.
sjheiss is offline   Reply With Quote
Old 02-16-2012, 10:26 PM   #14
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Well, before you even try to run things through httpd/cgi-bin, you should be sure that your file is actually working correctly. The web server does nothing but execute the script, just like you can from the command line.

Try running this simple script instead, first (adjust shebang accordingly):
Code:
#!/usr/bin/perl
use strict;
$|=1;
print "Content-Type: text/plain\n\n";
print "Environment variables:\n";
foreach (keys(%ENV)){
	print "\$ENV{'".$_."'} == ".$ENV{$_}."\n";
}
Once you get this to run on the command-line and through cgi-bin, you know your setup is working.
ixtab is offline   Reply With Quote
Old 02-16-2012, 10:59 PM   #15
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
MASS EDIT: Woohoo! I got your script working. It was extremely simple to fix. The lib files were in /opt/perl/lib/perl5/5.14.1/ where they should've been no "perl5" folder, so just /opt/perl/lib/5.14.1/

Is it possible to make a .bash_profile or .basrc file on the Kindle, so i don't have to export PATH every time?

Many thanks for the help, probably would've never realized it without you!

Last edited by sjheiss; 02-16-2012 at 11:23 PM.
sjheiss is offline   Reply With Quote
Reply

Tags
fbdev, kindle tools


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl and Regex Alexander Turcic Lounge 3 01-25-2011 07:48 PM
Any good Perl scripters out there? Goshzilla Workshop 28 04-09-2010 02:55 PM
perl for the DR800/DR1000? Mr. X iRex 1 03-16-2010 07:47 AM
Perl processing alexxxm Sony Reader 3 11-26-2007 06:13 AM
Any perl or python gurus? jbenny Workshop 0 11-23-2007 03:27 PM


All times are GMT -4. The time now is 12:10 AM.


MobileRead.com is a privately owned, operated and funded community.