Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
terrii
Posts: 13
Registered: ‎11-27-2012
My Device: Blackberry Bold 9900
Accepted Solution

How do I execute a Perl script and returns the value as string?

Hi, I'm trying to build an application using the Eclipse 2.0.0 with Blackberry SDK 7.1 Plug-in. Currently I'm testing it on simulator 9900 version 7.1.0.523. I need to use Perl language to acess the biological database and returns raw data as string without having to write a longer program using java.

In a stand alone Java SDK, I can use the line:  

 

Process p = Runtime.getRuntime().exec("perl script.pl")

 

but when I tried to use it on the IDE for a Blackberry project, the project won't compile. It says:

The method exec(String) is undefined for the type Runtime

 

Hopes someone can show me the correct syntex to use, but if no class is available, could anyone show me a sample for unified search process? The docs in blackberry dev is very complicated, I can't find any samples for it.

Thanks.

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I execute a Perl script and returns the value as string?

Welcome to the forums. 

 

I don't think you are going to find this easy to achieve.  I suspect you have an impression about what you can do on a BlackBerry that will not be matches by what the device is capable of doing..

 

Here are some questions that you need to answer:

a) Where is the database located

b) What sort of database is it? 

c) What is running the Perl script?

d) What platform would you be running on where your execution of a Perl script would work?  What level of Java, what OS etc....

Please use plain text.
Contributor
terrii
Posts: 13
Registered: ‎11-27-2012
My Device: Blackberry Bold 9900

Re: How do I execute a Perl script and returns the value as string?

Hi, thanks for the welcome and reply. Well actually, I knew it. Just want to confirm this because I had to make a choice whether do it in this platform or moving to other platform that is capable of running perl scripts. This is why, as a backup, I want to find a unified search sample so that I can do this manually. And here are the information that you need..

 

1.  Planning to use an online database which is the ncbi.nlm.nih.gov particularly the nucleotide database and also ability to save and search through a fasta format file located in the memory card.

2. Not sure what database it uses.

3. I think this is the major problem because I think, perl don't code into the binary. If the existing jvm can't understand perl, then I don't have anything to run it with.

4. If I understand the question correctly, so far windows can execute Perl script after installing the perl distribution and i believe android is also able to run perl scripts using scripting layer or perldroid. That is why i assume blackberry can do the same.

 

Sorry for my ignorance, as I'm really really new at this. If I can't use perl in blackberry, do you think the ExternalSearchProvider class from the unified search can help me with the task of retrieving from ncbi.nlm.nih.gov using the search engine?

Thank you for your expertise.

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I execute a Perl script and returns the value as string?

Sounds interesting.

 

So your idea was to download the data to the BlackBerry and then run queries directly.

 

While there are a number of other hurdles, the first one that you fall at is the platforms that support Perl.  Here is the list:

http://perldoc.perl.org/perlport.html#Supported-Platforms

 

BlackBerry Java OS is not included - in fact the only 'phone OS included is Symbian.  Interestingly it looks likely that PlayBook and BB10 are, because they are based on the QNX OS.

 

If we discount Perl as the query language, then you will have to provide another search option.  I think Unified Search is an option, but you will have some work to do to use this.  The first thing you need to do is to find out if in fact you can download the database to the BlackBerry.  The only database engine available on the Blackberry is SQL, so if the database you want can be exported as an SQL database, then there is a chance it would work.  I have had a look round the site and I can't tell what format the 'database' is in.  So I suggest that you investigate that next. 

 

Hope this helps. 

 

 

Please use plain text.
Contributor
terrii
Posts: 13
Registered: ‎11-27-2012
My Device: Blackberry Bold 9900

Re: How do I execute a Perl script and returns the value as string?

Yes, your reply really answers the problem. So this means I have to either change platforms, bb10 or try the unified search. I hope I can find a sample of the unified search. Its really hard to do it with just the notes on the dev doc.

I really need to do some reading first, and anyways.. Thanks.

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I execute a Perl script and returns the value as string?

Sorry I was trying to point out that even before you look at unified search, you need t find out if you can get the database on to the device.  That is the first hurdle.  Basically unless it is an SQL database, or can be converted to one easily, you are probably wasting your time with the on device option, including Unified Search.

 

So can you get this database onto a BB device?

Please use plain text.
Contributor
terrii
Posts: 13
Registered: ‎11-27-2012
My Device: Blackberry Bold 9900

Re: How do I execute a Perl script and returns the value as string?

Oh, sorry for getting so hopeful. :smileyhappy:

Actually I'm not so familiar with the unified search. I thought I can send a query to an external search engine and returns the result of the search back. What I'm not sure is the returned result format. If it returns the list and hyperlink, that it should be enough for me to continue as I can display the result and hopefully opens the hyperlink to read the text input as a string and stores the string in a text field or area. That is my plan, which depends solely on the result of the query sent to the external search engine because actually the database only stores raw data of simple long string as FASTA format. I just need to copy the string temporarily to start my analysis.

 

Do you think it can be done? Or do you have any other options for me? Thanks

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I execute a Perl script and returns the value as string?

And what is this 'external search engine'?

Please use plain text.
Contributor
terrii
Posts: 13
Registered: ‎11-27-2012
My Device: Blackberry Bold 9900

Re: How do I execute a Perl script and returns the value as string?

Oh, I mean the class under unified search which is the ExternalSearchProvider that suppose to be able to pass queries to other search engine.I read it on the blackberry dev doc under unified search, that was when I got the idea, incase perl wouldn't work on blackberry 7.1

So, any ideas? Or should I try blackberry 10 sdk beta?

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I execute a Perl script and returns the value as string?

As I understand, the point with Unified search is that you can add your data so that it gets searched automatically.  So you add the External Search Provider (it is external to the search providers already in use) and then unified search will search that database.  So I do not think Unified Search helps here.  You still have to create the glue that you are missing, i.e. you have to provide an application link from a query to the database. 

 

The way this sort of thing would normally be handled is to create a web service that queries the database and run this on some known Server.  Then the Blackberry would use http to access this web service.    There is a lot of work in this approach.

 

BB10 might help, as noted, the QNX OS does support Perl, but I have no idea if this has been ported to run on BB10. 

 

Can I ask why you are trying to do this?  How much time do you have to do this. 

Please use plain text.