Register Guidelines E-Books Search Today's Posts Mark Forums Read

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 02-16-2012, 11:21 PM   #16
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
You're right. Using this shebang, your original script works:

Code:
#!/opt/perl/bin/perl -I/opt/perl/lib/perl5/5.14.1
ixtab is offline   Reply With Quote
Old 02-16-2012, 11:28 PM   #17
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
Your way works great, but I think it's easier just moving the files like I described in my last post. Unfortunately, I still can't get my browser to run .cgi scripts; it still wants to download them, even though CGI seems to be enabled. I'll play around the the bozohttpd parameters and scour the internet to see if I can find a fix. Strangely, if I create another directory it will open it just fine. Only any directory named cgi-bin seems to cause an error on the Kindle browser. This is only a problem because bozohttpd requires the CGI directory to contain a folder named "cgi-bin" - thus, it's a circular problem.

I'm glad to be making progress though.

Last edited by sjheiss; 02-16-2012 at 11:34 PM.
sjheiss is offline   Reply With Quote
Old 02-16-2012, 11:31 PM   #18
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, it's up to you if you move the files or tell the script from the shebang where it can find them

The latter method has the advantage that it works for everyone without needing to modify
the perl package. (Just in case you intend to distribute some scripts some day).

You don't need to set the PATH at all if you set the shebang correctly in the script.

Last edited by ixtab; 02-16-2012 at 11:33 PM.
ixtab is offline   Reply With Quote
Old 02-17-2012, 12:26 AM   #19
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
The latter method has the advantage that it works for everyone without needing to modify
the perl package. (Just in case you intend to distribute some scripts some day).

You don't need to set the PATH at all if you set the shebang correctly in the script.
Good point. I won't worry about that for now though, since according to this thread barely anybody has Perl on their Kindles. :P

I just tried accessing the cgi-bin directory on my Windows computer: blank page. Any other directory goes to the sub-directory. Any .cgi in cgi-bin = blank page. My best guess is that I'm using incorrect parameters, but there is little documentation for bozohttpd (and I'm a newb at this stuff).
sjheiss is offline   Reply With Quote
Old 02-17-2012, 12:46 AM   #20
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
Ah well, I just tried it, and it works correctly.

bozohttpd itself:
Code:
[root@kindle tmp]# find /mnt/us/www/
/mnt/us/www/
/mnt/us/www/cgi-bin
/mnt/us/www/cgi-bin/test.pl
/mnt/us/www/docroot
/mnt/us/www/docroot/index.html

[root@kindle tmp]# ./bozohttpd -s -X -f -b /mnt/us/www/docroot/ -c /mnt/us/www/cgi-bin/
started in daemon mode as `kindle' port `http' root `/mnt/us/www/docroot/'
got request ``GET /cgi-bin/test.pl HTTP/1.1'' from host localhost.localdomain to port 80
client request:
Code:
[root@kindle tmp]# wget -O out.html http://localhost/cgi-bin/test.pl
Connecting to localhost (127.0.0.1:80)
out.html             100% |*******************************************************************************************************************************************************************************************|   339  --:--:-- ETA
[root@kindle tmp]# cat out.html 
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Environment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>

</body>
The test.pl is the same file as your index.cgi (with the fixed shebang).

HTH

Last edited by ixtab; 02-17-2012 at 12:48 AM.
ixtab is offline   Reply With Quote
Old 02-17-2012, 01:10 AM   #21
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
Ah well, I just tried it, and it works correctly.

bozohttpd itself:
Code:
[root@kindle tmp]# find /mnt/us/www/
/mnt/us/www/
/mnt/us/www/cgi-bin
/mnt/us/www/cgi-bin/test.pl
/mnt/us/www/docroot
/mnt/us/www/docroot/index.html

[root@kindle tmp]# ./bozohttpd -s -X -f -b /mnt/us/www/docroot/ -c /mnt/us/www/cgi-bin/
started in daemon mode as `kindle' port `http' root `/mnt/us/www/docroot/'
got request ``GET /cgi-bin/test.pl HTTP/1.1'' from host localhost.localdomain to port 80
Well, I tried your command, and I still get the error of not being able to enter the cgi-bin directory. Does this not happen to you?

Although, now if I try my index program, instead of trying to download the index.cgi when you click the Submit button, it just says it can't load the page. As they say, sometimes progress is just getting a different error.

Also, when I try that command in WinSCP, it crashes the program, but works on my Kindle. It's about time I start using Linux a lot, I think.

Last edited by sjheiss; 02-17-2012 at 01:17 AM.
sjheiss is offline   Reply With Quote
Old 02-17-2012, 01:17 AM   #22
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
Carefully check the directory structure and bozohttpd arguments... The cgi-bin is NOT a subdirectory of the document root, but lies outside of it. There is also no directory listing for cgi-bin.

Both of these are on purpose, because cgi-bin commands are security-relevant. (Well, probably not so much for the Kindle, but for "real" webservers they certainly are).
ixtab is offline   Reply With Quote
Old 02-17-2012, 01:36 AM   #23
sjheiss
Connoisseur
sjheiss began at the beginning.
 
Posts: 58
Karma: 26
Join Date: Dec 2011
Device: K3G, KF2
Code:
/mnt/us/www$ find /mnt/us/www/
/mnt/us/www/
/mnt/us/www/docroot
/mnt/us/www/docroot/index.html
/mnt/us/www/cgi-bin
/mnt/us/www/cgi-bin/test.pl
/mnt/us/www/cgi-bin/index.cgi
According to my find I have the exact same structure as you do (with the addition of index.cgi). Maybe there's a difference I'm just not seeing - I do have clinical brain problems. :P

According to ps aux the args are as follows:
Code:
./bozohttpd -s -X -f -b /mnt/us/www/docroot/ -c /mnt/us/www/cgi-bin/
which is the same as yours.

I have no idea. Over this weekend I'll get my Linux set up and try it on there. Maybe it's something wrong with my Kindle - I have installed many hacks and things, maybe I should reset it and start afresh. I hate to pester you much, as you must be getting tired of trying to help me by now.

Last edited by sjheiss; 02-17-2012 at 01:43 AM.
sjheiss is offline   Reply With Quote
Old 02-17-2012, 01:42 AM   #24
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, I can't help you any further anyway now

It works for me, and I don't see a reason why the exact same setup would not be working for you if you invoke http://<kindle>/cgi-bin/test.pl. Note that the output is an empty (blank) page, so you should check the source code...
ixtab is offline   Reply With Quote
Old 02-17-2012, 01:47 AM   #25
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
Well, I can't help you any further anyway now

It works for me, and I don't see a reason why the exact same setup would not be working for you if you invoke http://<kindle>/cgi-bin/test.pl. Note that the output is an empty (blank) page, so you should check the source code...
Yep, if I try to go directly to the URL on my it just performs a Google search. I also got the output as a blank document, so no error logs there.

So, I'll get busy with doing what I described, hope for the best, and report back in due time.

Thanks a lot anyway, you still did help me quite a bit.
sjheiss is offline   Reply With Quote
Old 02-17-2012, 01:48 AM   #26
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
(off-topic)

Quote:
Originally Posted by sjheiss View Post
It's about time I start using Linux a lot, I think.
I'm exclusively using Linux both at work and at home (2 PCs, 2 laptops) since 5 years and I have never regretted getting rid of Windows. In fact, I'm having difficulties to find my way around on Windows by now. Almost everything just seems unlogical to me on that OS
ixtab is offline   Reply With Quote
Old 02-17-2012, 01:54 AM   #27
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
I'm exclusively using Linux both at work and at home (2 PCs, 2 laptops) since 5 years and I have never regretted getting rid of Windows. In fact, I'm having difficulties to find my way around on Windows by now. Almost everything just seems unlogical to me on that OS
Well I like to play games, although two of my top favorite games can be played on Linux, so it's feasible to make Linux my main OS.

I just realized you have a Touch and I have a 3G - could that difference be the problem? From what I've read the firmwares are hardly different, but I'm not qualified to be certain.
sjheiss is offline   Reply With Quote
Old 02-17-2012, 02:01 AM   #28
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
Nope, the device is totally unimportant here.

The only thing that comes into play is bozohttpd and perl, and we're both using the exact same binaries. So behavior is identical, and it must be a case of PEBKAC on your side
ixtab is offline   Reply With Quote
Old 02-17-2012, 05:53 AM   #29
JustAMan
Groupie
JustAMan doesn't litterJustAMan doesn't litter
 
JustAMan's Avatar
 
Posts: 153
Karma: 113
Join Date: Jan 2012
Location: Russia
Device: Kindle Touch
What about python guys?
Any chance python being compiled for Kindle?

Last edited by JustAMan; 02-17-2012 at 06:00 AM. Reason: fixing typos
JustAMan is offline   Reply With Quote
Old 02-17-2012, 08:18 AM   #30
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
I haven't tried but I found it here:

Quote:
Originally Posted by Matan View Post
This zip file contains python 2.7.2 for kindle.

It can be installed using launchpad's customupdates feature, or simply unzipped under /mnt/us. If you unzip in another location, you should edit the included file pythonenv.

To run python, source the file /mnt/us/python/pythonenv and run the binary /mnt/us/python/usr/bin/python.


The package actaully contains the Debian Wheezy packages python-minimal, python2.7-minimal, python2.7 and libssl1 (rebuilt to use older libc).

Last edited by PoP; 02-17-2012 at 12:52 PM. Reason: correct spelling
PoP is offline   Reply With Quote
Reply

Tags
fbdev, kindle tools

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:58 AM.


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