Plack on SL4A in Yokohama.pm #8

  • 2,861 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • I had to include if.pm (which should be core), and HTML::HTML5::Entities, modified to claim to be HTML::Entities into lib/perl5 to get this to work
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
2,861
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
1
Likes
5

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Plack on SL4A clouder
  • 2. 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
  • 3. Try installing the Plack
  • 4. 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
  • 5. Shell
  • 6. Interpriter installation•
  • 7. Perl
  • 8. It works!• Perl debugger
  • 9. Run script• hello_world.pl use Android; my $android = Android->new; $android->makeToast(“Hello, Android!”);
  • 10. hello_work.pl
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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;
  • 15. Transfer script• Android % adb push filer.pl /sdcard/sl4a/scripts/filer.pl
  • 16. Start server before run
  • 17. Server works!
  • 18. Demo
  • 19. Impressions• XS make•• SL4A Perl Perl