问题描述
我要运行Android上的一个简单的Perl脚本。我使用的这使得它可能包括在一个APK Perl的跨preTER(基于 )。该项目配备了一个 hello.pl
脚本,它显示了一个敬酒。好吧,一切工作至今,所以我加了一些线文件创建 - 现在整个 hello.pl
脚本如下:
I want to run a simple Perl script on Android. I am using perl-android-apk which makes it possible to include the Perl interpreter in one APK (based on SL4A). The project comes with a hello.pl
script, which shows a toast. Alright, everything working so far, so I added some lines for file creation - now whole hello.pl
script looks like:
use Android;
my $a = Android->new();
$a->makeToast("Hello, Android!");
open(TEXT,">newtext.txt") || $a->makeToast("I died.");
print TEXT "Check out our text file!";
close(TEXT);
$a->makeToast("Bye, Android!");
当我运行在Android上显示两个敬酒整个事情(你好..和再见。),但我无法找到文件 newtext.txt中
的任何地方。我在做什么错了?
When I run the whole thing on Android both toasts are shown ("Hello.." and "Bye..") but I can't find the file newtext.txt
anywhere. What am I doing wrong?
推荐答案
请问您的Android清单有这个?
Does your Android manifest have this?
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
此外,您可能无法写入到该位置。这里其他的答案表明,你需要获得外部存储目录:
Also, you might not be able to write to that location. Other answers here indicate that you need to get the external storage directory:
Environment.getExternalStorageDirectory();
也许你可以调用Java和它传递给你的Perl脚本作为参数?
Maybe you could call that in Java and pass it to your perl script as an argument?
这篇关于不能(用perl-Android的APK)在Android上使用Perl脚本创建的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!