K_M_McMahon has asked for the wisdom of the Perl Monks concerning the following question:
I know this code example could be made much cleaner, I just threw this together to illustrate my problem, the actual scripts I am speaking of are much larger.#!/usr/bin/perl -w use strict; use Tk; use LWP::Simple; my($label); my $w=new MainWindow; my $root='http://www.billwfriend.com/outdoors/hiking/ricketts_glen'; my @pics=('DSC00005.JPG','DSC00006.JPG','DSC00007.JPG','DSC00008.JPG', +'DSC00009.JPG','DSC00011.JPG','DSC00012.JPG','DSC00014.JPG','DSC00072 +.JPG'); $w->title("TK Sample"); my $test=$w->Button(-text=> 'Test', -command => sub{&test})->pack(); my $quit=$w->Button(-text=> 'Quit', -command => sub{exit})->pack(); &MainLoop; sub test { $label=$w->Label(-text=>"Starting to get files.")->pack(); foreach my $file (@pics) { &get_url($file); } } sub get_url { my $file=shift; $label->configure(-text=>"Starting to get $file"); my $test=get("$root/$file"); open(TEST, ">$file") || die"can't open $file\n"; binmode TEST; # for MSDOS derivations. print TEST $test; close TEST; $label->configure(-text=>"Got $file."); }
my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK subroutine status
by zentara (Cardinal) on Feb 16, 2005 at 14:10 UTC | |
|
Re: TK subroutine status
by g0n (Priest) on Feb 16, 2005 at 12:15 UTC | |
by K_M_McMahon (Hermit) on Feb 16, 2005 at 13:03 UTC |