Version Tk de un programa para buscar patrones en cualquier directorio.
Una imagen
(http://doddyhackman.webcindario.com/images/findertext.jpg)
El codigo
#!usr/bin/perl
#Finder Text 0.2
#Version Tk
#Coded By Doddy H
use Tk;
my $color_fondo = "black";
my $color_texto = "green";
#if ($^O eq 'MSWin32') {
#use Win32::Console;
#Win32::Console::Free();
#}
my $vent =
MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
$vent->title("Finder Text 0.2 (C) Doddy Hackman 2012");
$vent->geometry("395x440+20+20");
$vent->resizable( 0, 0 );
$vent->Label(
-text => "Directory : ",
-font => "Impact1",
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 20, -y => 20 ); my $dir = $vent->Entry(
-width => 40,
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 100, -y => 23 );
$vent->Label(
-text => "String : ",
-font => "Impact1",
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 20, -y => 50 ); my $string = $vent->Entry(
-width => 30,
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 80, -y => 53 );
$vent->Button(
-text => "Find",
-command => \&now,
-width => 11,
-background => $color_fondo,
-foreground => $color_texto,
-activebackground => $color_texto
)->place( -x
=> 271, -y => 53 );
$vent->Label(
-text => "Files Found",
-font => "Impact",
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 150, -y => 100 ); my $listas = $vent->Listbox(
-width => 50,
-height => 15,
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 45, -y => 150 );
$vent->Label(
-text => "Status : ",
-font => "Impact1",
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 70, -y => 390 ); my $tatus = $vent->Entry(
-width => 30,
-background => $color_fondo,
-foreground => $color_texto
)->place( -x
=> 130, -y => 393 );
$listas->bind( "<Double-1>", [ \&loader ] );
MainLoop;
sub loader {
$listasx = $listas->curselection();
for my $id (@$listasx) {
my $linkar = $listas->get($id);
}
}
sub now {
$listas->delete( "0.0", "end" );
goodbye( $dir->get, $string->get );
$tatus->configure( -text => " " );
}
sub verificar {
my ( $file, $text ) = @_;
my $numero_linea = 0;
my @words = <FILE>;
for my $linea (@words) {
$numero_linea++;
if ( $linea =~ /$text/ ) {
$listas->insert( "end", $file );
}
}
}
sub goodbye {
for (@archivos) {
next if $_ eq "." or $_ eq "..";
my $fichero = $_[0] . "/" . $_;
if ( -f $fichero ) {
$vent->update;
$tatus->configure( -text => $fichero );
verificar( $fichero, $_[1] );
}
if ( -d $fichero ) {
&goodbye( $fichero, $_[1] );
}
}
}
#The End ?
Esta bien, como siempre en tu linea.
Saludos ;D