open program

This is a discussion on open program within the Perl forums in Programming Languages category; I am trying to open Internet explorer from within Perl.I have used the following code: #!/usr/bin/perl;open(MYFILE,"C:\Program Files\Internet Explorer.exe"); Any help would be appreciated. Paul...

Go Back   Application Development Forum > Programming Languages > Perl

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-08-2008, 03:19 AM
Adams Paul
Guest
 
Default open program


I am trying to open Internet explorer from within Perl.I have used the following code:



#!/usr/bin/perl;open(MYFILE,"C:\Program Files\Internet Explorer.exe");
Any help would be appreciated.
Paul


Reply With Quote
  #2  
Old 09-08-2008, 03:29 AM
Jeff Pang
Guest
 
Default Re: open program

2008/9/8 Adams Paul <adams787@msn.com>:
>
> I am trying to open Internet explorer from within Perl.I have used the following code:
>
>
>
> #!/usr/bin/perl;open(MYFILE,"C:\Program Files\Internet Explorer.exe");


If you call an external program in Perl, shouldn't use "open".
Instead you could say "system (external_program)" if this is under Unix.

For your purpose, if you just want to open the web pages, you could
have many choices rather than trying to open an IE. see these modules:

WWW::Mechanize
LWP::UserAgent
etc.
Reply With Quote
  #3  
Old 09-08-2008, 04:01 AM
Jeff Pang
Guest
 
Default Re: open program

2008/9/8 Jeff Pang <Jeffrey@aolchina.com>:
> 2008/9/8 Adams Paul <adams787@msn.com>:
>> #!/usr/bin/perl;open(MYFILE,"C:\Program Files\Internet Explorer.exe");

>
> If you call an external program in Perl, shouldn't use "open".


adjust: I mean shouldn't use open directly like this way.
but you could open a pipe for an external command, like:

open HD, "ls -l|" or die $!;
while(<HD>) {
print;
}
close HD;

this is the same as: system("ls -l");
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:33 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.