Created
May 2, 2010 15:27
-
-
Save stevan/387207 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Android; | |
my $a = Android->new(); | |
use Plack::Runner; | |
use Plack::Request; | |
my $runner = Plack::Runner->new; | |
$runner->parse_options(qw[ | |
--server HTTP::Server::PSGI | |
--port 8888 | |
]); | |
$runner->run(sub { | |
my $env = shift; | |
my $req = Plack::Request->new( $env ); | |
if ( my $phone_number = $req->param('phone_number') ) { | |
$a->callNumber( $phone_number ); | |
return [ | |
200, | |
[ 'Content-Type' => 'text/html' ], | |
[qq[ | |
<html> | |
<head> | |
<title>Plack On Droid</title> | |
</head> | |
<body> | |
<p>Calling $phone_number ...</p> | |
</body> | |
</html> | |
]] | |
]; | |
} | |
else { | |
return [ | |
200, | |
[ 'Content-Type' => 'text/html' ], | |
[q[ | |
<html> | |
<head> | |
<title>Plack On Droid</title> | |
</head> | |
<body> | |
<form> | |
Enter a phone number to call<br/> | |
<input type="text" name="phone_number" /> | |
<input type="submit" value="Go" /> | |
</form> | |
</body> | |
</html> | |
]] | |
]; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment