Hehe, thanks for the time you spent to look over things like that. I know that you have better things to do than teaching me how to code in perl. And I think that this mailing list isn't the right place to do so. As you might have guessed I'm not the most experienced programmer on earth. At the beginning I wrote this program for my own needs. To be honest, I wrote it for exactly one specific website. But a few people asked me if they could get a copy when I'm done. That was the reason for me to create a user-friendly GUI. Now it's time for me to read some books I think. ;)
Just for the sake of completeness: I'm using Windows XP Professional SP2 with all the latest windows updates. 'perl -v' output: This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 50 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com Built Jan 23 2007 15:57:46 Robert May wrote: > > I have no idea what might be causing that. I can't immediately see > how Win32::GUI could be at fault, but I am never surprised. > > I , personally, wouldn't use back-ticks to launch my browser with a > page. It's the wrong construct (it's designed to capture the stdout > of a program into a perl variable), and relies on your windows box > having particular registry entries - it certainly doesn't work for em > here. > > I tried using > system "start temp.html"; > instead, and I see the delay you're taking about. I can get rid of > the delay by doing > undef $main; > before making the system call (my code below). I'm afraid that I > don't have time to look into this further right now. (but can you post > back with the output of 'perl -v' and which windows OS you're using, > and I'll try to look at it another time. > > As an aside, if you want to extract links from HTML pages, you'd do > well to look HTML::LinkExtor, which is a full HTML parser designed to > do just this - you'll find that using regexes is not going to give you > the results you ant in the long term (for example you code won't work > if a link is split across more than one line). The docs for > HTML::LinkExtor have a nice example that shows how you can cope with > large files without having to use the intermediate temporary file that > you are using. > > Regards, > Rob. > > #!perl -w > #use strict; > #use warnings; > > use LWP::UserAgent; > use Win32::GUI(); > > # Creation of the LWP Useragent with the Firefox Cookie file > my $ua = LWP::UserAgent->new; > > # Creation of the GUI > my $main = Win32::GUI::Window->new( > -title => 'Link Filter', > -size => [295, 161], > -maximizebox => 0, > -resizable => 0, > ); > > $main->AddLabel( > -pos => [4,4], > -size => [100,17], > -text => 'Bitte URL eingeben:', > ); > > $main->AddTextfield( > -name => 'tfURL', > -pos => [4,20], > -size => [281, 77], > -multiline => 1, > ); > > $main->AddButton( > -name => 'btGet', > -pos => [5, 100], > -size => [279,33], > -text => 'Get Them!', > ); > > $main->Center(); > $main->Show(); > Win32::GUI::Dialog(); > $main->Hide(); > > sub btGet_Click { > return -1; > } > > my $url = $main->tfURL->Text(); > undef $main; # comment out this line to see the delay > > # Get the content of the Website and save it into a temporary HTML file > $ua->get($url, ':content_file' => 'temp.html'); > > system "start temp.html";