Código
#!usr/bin/perl #Mysql Manager 0.6 #Version Tk #Coded By Doddy H #Modules #ppm install http://www.bribes.org/perl/ppm/Scalar-List-Utils.ppd #ppm install http://www.bribes.org/perl/ppm/Storable.ppd #ppm install http://www.bribes.org/perl/ppm/DBI.ppd #ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd use Tk; use Tk::ROText; use Tk::PNG; use DBI; if ( $^O eq 'MSWin32' ) { use Win32::Console; Win32::Console::Free(); } my $color_fondo = "black"; my $color_texto = "orange"; my $nave = MainWindow->new( -background => $color_fondo, -foreground => $color_texto ); $nave->title("Mysql Manager 0.6 || Coded By Doddy H"); $nave->geometry("210x160+20+20"); $nave->resizable( 0, 0 ); $nave->Label( -text => "Host : ", -font => "Impact1", -background => $color_fondo, -foreground => $color_texto my $host = $nave->Entry( -width => 22, -text => "localhost", -background => $color_fondo, -foreground => $color_texto $nave->Label( -text => "User : ", -font => "Impact1", -background => $color_fondo, -foreground => $color_texto my $user = $nave->Entry( -width => 22, -text => "root", -background => $color_fondo, -foreground => $color_texto $nave->Label( -text => "Pass : ", -font => "Impact1", -background => $color_fondo, -foreground => $color_texto my $pass = $nave->Entry( -width => 22, -background => $color_fondo, -foreground => $color_texto $nave->Button( -text => "Connect", -width => 13, -command => \&now, -background => $color_fondo, -foreground => $color_texto, -activebackground => "orange" MainLoop; sub now { my $host = $host->get; my $user = $user->get; my $pass = $pass->get; $info = "dbi:mysql::" . $host . ":3306"; if ( my $enter = DBI->connect( $info, $user, $pass, { PrintError => 0 } ) ) { $nave->destroy; my $man = MainWindow->new( -background => $color_fondo, -foreground => $color_texto ); $man->title("Mysql Manager 0.6 || Coded By Doddy H"); $man->geometry("650x320+20+20"); $man->resizable( 0, 0 ); $man->Label( -text => "Query : ", -font => "Impact1", -background => $color_fondo, -foreground => $color_texto my $ac = $man->Entry( -width => 60, -background => $color_fondo, -foreground => $color_texto $man->Button( -width => 8, -text => "Execute", -command => \&tes, -background => $color_fondo, -foreground => $color_texto, -activebackground => "orange" my $out = $man->Scrolled( "ROText", -width => 74, -height => 15, -background => $color_fondo, -foreground => $color_texto $man->bind( "<Key-Return>" => sub { &tes } ); sub tes { my $ac = $ac->get; $re = $enter->prepare($ac); $re->execute(); my $total = $re->rows(); my @columnas = @{ $re->{NAME} }; if ( $total eq "-1" ) { $out->insert( "end", "\n[-] Query Error\n" ); next; } else { $out->insert( "end", "\n[+] Result of the query\n" ); if ( $total eq 0 ) { $out->insert( "end", "\n[+] Not rows returned\n\n" ); } else { $out->insert( "end", "\n[+] Rows returned : " . $total . "\n\n" ); for (@columnas) { $out->insert( "end", $_ . "\t" ); } $out->insert( "end", "\n\n" ); while ( @row = $re->fetchrow_array ) { for (@row) { $out->insert( "end", $_ . "\t" ); } $out->insert( "end", "\n" ); } } } } } else { $man->Dialog( -title => "Error", -buttons => ["OK"], -text => "Error", -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto )->Show(); } } # ¿ The End ?