Plack on SL4A in Yokohama.pm #8
Upcoming SlideShare
Loading in...5
×
 

Plack on SL4A in Yokohama.pm #8

on

  • 2,946 views

 

Statistics

Views

Total Views
2,946
Views on SlideShare
2,914
Embed Views
32

Actions

Likes
3
Downloads
3
Comments
0

5 Embeds 32

http://us-w1.rockmelt.com 17
http://paper.li 7
http://a0.twimg.com 5
http://leapf.org 2
http://tweetedtimes.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Plack on SL4A in Yokohama.pm #8 Plack on SL4A in Yokohama.pm #8 Presentation Transcript

  • Plack on SL4A clouder
  • Whats SL4A?• Scripting Layer for Android• Python, Perl, JRuby, Lua, BeanShell, JavaScript, Tcl, and shell are currently supported• Access to UI, Camera, Sensors on Android• Shibuya.pm #14 http://d.hatena.ne.jp/naoya/20100930/1285868397• http://advent.perl.kr/2010-12-21.html
  • Try installing the Plack
  • SL4A installation• Android SDK apk http://code.google.com/p/android-scripting/ % adb install sl4a_r4.apk 2546 KB/s (858471 bytes in 0.329s) pkg: /data/local/tmp/sl4a_r4.apk Success
  • Shell
  • Interpriter installation•
  • Perl
  • It works!• Perl debugger
  • Run script• hello_world.pl use Android; my $android = Android->new; $android->makeToast(“Hello, Android!”);
  • hello_work.pl
  • Directory structure• @INC /data/data/com.googlecode.perlforandroid/files/perl/ site_perl/5.10.0/arm-eabi-linux /sdcard/com.googlecode.perlforandroid/extras/perl/ site_perl/5.10.0 /data/data/com.googlecode.perlforandroid/files/perl/5.10.0/ arm-eabi-linux /data/data/com.googlecode.perlforandroid/files/perl/5.10.0 /sdcard/com.googlecode.perlforandroid/extras/perl/site_perl .• /sdcard/sl4a/scripts
  • Plack installation• Android SD PC Plack DST=/mnt/sdcard/sl4a/scripts cpanm -l $DST/perl5 --reinstall -qfn CGI CGI::Util HTTP::Date Time::Local URI::Escape Plack::Builder Plack::App::Directory HTTP::Server::Simple::CGI HTTP::Server::Simple::PSGI HTTP::Message HTTP::Body Hash::MultiValue
  • Plack installation(con’t)mkdir -p $DST/lib/perl5/File/Speccp `perldoc -l File::Spec::Unix` $DST/lib/perl5/File/Speccp `perldoc -l integer` $DST/lib/perl5cp `perldoc -l parent` $DST/lib/perl5cp `perldoc -l DirHandle` $DST/lib/perl5cp `perldoc -l FileHandle` $DST/lib/perl5
  • Script using Plack use strict; use lib /sdcard/sl4a/scripts/perl5/lib/perl5; use Android; use Plack::Builder; use Plack::App::Directory; use HTTP::Server::Simple::PSGI;• my $droid Plack = Android->new; my $app = builder { mount "/" => Plack::App::Directory->new(root => /sdcard); }; my $server = HTTP::Server::Simple::PSGI->new(8080); $server->app($app); $server->run;
  • Transfer script• Android % adb push filer.pl /sdcard/sl4a/scripts/filer.pl
  • Start server before run
  • Server works!
  • Demo
  • Impressions• XS make•• SL4A Perl Perl