<?xml version="1.0" encoding="windows-1252"?>
<node id="18371" title="finddata.pl with comments" created="2000-06-15 19:18:10" updated="2005-08-13 15:09:26">
<type id="1748">
sourcecode</type>
<author id="15497">
Hydro</author>
<data>
<field name="doctext">
&lt;code&gt;
use Win32::GUI;
use Win32::Internet;
require Win32::Sound;
require Mail::Sender;

($DOShwnd, $DOShinstance) = GUI::GetPerlWindow();

my $screen_width = Win32::GUI::GetSystemMetrics(0);   # get screen width
my $screen_height = Win32::GUI::GetSystemMetrics(1);  # get screen height
my $minwidth = 600;
my $minheight = 240;


if (@ARGV[0] eq "-t") {   # read command line parameters
   $test = 1;             # if a '-t' is used then we are testing
}
else {
   GUI::CloseWindow($DOShwnd);   # if not testing then 
   GUI::Hide($DOShwnd);          # hide DOS window
}

my $dbv_icon = new Win32::GUI::Icon("gator.ico");   # replace default camel icon with my own

my $dbv_class = new Win32::GUI::Class(   # set up a class to use my icon throughout the program
	   -name =&gt; "DatabaseViewer Class",
	   -icon =&gt; $dbv_icon,
);

my $DataMenu = new Win32::GUI::Menu(   # define a menu with File, Search, and Tools headings
    "&amp;File" =&gt; "File",
    "   &gt;   Retrieve &amp;Data" =&gt; "GetData",
    "   &gt;   -" =&gt; 0,
    "   &gt;   E&amp;xit" =&gt; "FileExit",
    "&amp;Search" =&gt; "Search",
    "   &gt;   Find &amp;Name" =&gt; "FindName",
    "   &gt;   Find &amp;Building" =&gt; "FindBuilding",
    "   &gt;   Find &amp;Adapter" =&gt; "FindAdapter",
    "&amp;Tools" =&gt; "Tools",
    "   &gt;   Report &amp;Problem" =&gt; "ReportProblem",
);

$DataWindow = new Win32::GUI::Window(   # define main window
	-name   =&gt; "DataWindow",
	-top    =&gt; ($screen_height - $minheight)/2,   # center on screen vertically
	-left   =&gt; ($screen_width - $minwidth)/2,     # center on screen horizontally
	-width  =&gt; $minwidth,
	-height =&gt; $minheight,
	-title  =&gt; "GatorNet Database Information",
	-menu   =&gt; $DataMenu,
	-class  =&gt; $dbv_class,
);

$Status = $DataWindow-&gt;AddStatusBar(   # add a status bar to the window
	-name   =&gt; "Status",
	-text   =&gt; "GatorNet Database : Ready",
);

$DataTab = $DataWindow-&gt;AddTabStrip(   # add a tabstrip to the window
	-left   =&gt; 10,   
	-top    =&gt; 10, 
	-width  =&gt; $DataWindow-&gt;ScaleWidth - 105, 
	-height =&gt; 175,
	-name   =&gt; "DataTab",
);

# these are the titles that go on the tabs
$DataTab-&gt;InsertItem(-text =&gt; "Name");
$DataTab-&gt;InsertItem(-text =&gt; "Building");
$DataTab-&gt;InsertItem(-text =&gt; "Adapter");

$DataWindow-&gt;AddLabel(   # add a label (this will be used for the first tab)
	-name   =&gt; "FN_Label",
	-text   =&gt; "First Name: ",
	-top    =&gt; 55,
	-left   =&gt; 25,
);

$FirstName = $DataWindow-&gt;AddTextfield(   # add a textfield to go with the first label
	-top    =&gt; 52,
	-left   =&gt; 90,
	-width   =&gt; 115,
	-height  =&gt; 23,
	-tabstop =&gt; 1,
);

$DataWindow-&gt;AddLabel(   # add another label (this will be used for the first tab)
	-name   =&gt; "LN_Label",
	-text   =&gt; "Last Name: ",
	-top    =&gt; 85,
	-left   =&gt; 25,
);

$LastName = $DataWindow-&gt;AddTextfield(   # add a textfield to go with the second label
	-top    =&gt; 82,
	-left   =&gt; 90,
	-width   =&gt; 115,
	-height  =&gt; 23,
	-tabstop =&gt; 1,
);

$DataWindow-&gt;AddLabel(   # add another label (this will be used for the second tab)
	-name   =&gt; "Bld_Label",
	-text   =&gt; "Building: ",
	-top    =&gt; 55,
	-left   =&gt; 25,
);

$Building = $DataWindow-&gt;AddCombobox(   # add a combobox (dropdown style) to go with the third label
	-name   =&gt; "Dropdown",
	-top    =&gt; 52,
	-left   =&gt; 90,
	-width   =&gt; 125,
	-height  =&gt; 110,
	-tabstop =&gt; 1,
	-style =&gt; WS_VISIBLE | 3 | WS_VSCROLL | WS_TABSTOP,
);

# add the following items to the combobox dropdown list
$Building-&gt;InsertItem("Baldwin");
$Building-&gt;InsertItem("Brooks");
$Building-&gt;InsertItem("Caflish");
$Building-&gt;InsertItem("College Court");
$Building-&gt;InsertItem("Crawford");
$Building-&gt;InsertItem("Edwards");
$Building-&gt;InsertItem("PKP");
$Building-&gt;InsertItem("Ravine");
$Building-&gt;InsertItem("Schultz");
$Building-&gt;InsertItem("South Highland");
$Building-&gt;InsertItem("Walker");
$Building-&gt;InsertItem("Walker Annex");

$DataWindow-&gt;AddLabel(   # add another label (this one will be used on the third and final tab)
	-name   =&gt; "Adapt_Label",
	-text   =&gt; "Adapter: ",
	-top    =&gt; 55,
	-left   =&gt; 25,
);

$Adapter = $DataWindow-&gt;AddTextfield(   # add a textfield for the final label
	-top    =&gt; 52,
	-left   =&gt; 90,
	-width   =&gt; 115,
	-height  =&gt; 23,
	-tabstop =&gt; 1,
);

$FindNow = $DataWindow-&gt;AddButton(   # add a button to the main window
	-name   =&gt; "FindNow",
	-text   =&gt; "F&amp;ind Now",
	-top    =&gt; 30,
	-left   =&gt; $DataWindow-&gt;ScaleWidth - 83,
	-width  =&gt; 71,
	-height =&gt; 25,
);

$Stop = $DataWindow-&gt;AddButton(   # add another button to the main window
	-name   =&gt; "Stop",
	-text   =&gt; "Sto&amp;p",
	-top    =&gt; 60,
	-left   =&gt; $DataWindow-&gt;ScaleWidth - 83,
	-width  =&gt; 71,
	-height =&gt; 25,
);

$NewSearch = $DataWindow-&gt;AddButton(   # add a final button for the main window)
	-name   =&gt; "NewSearch",
	-text   =&gt; "Ne&amp;w Search",
	-top    =&gt; 90,
	-left   =&gt; $DataWindow-&gt;ScaleWidth - 83,
	-width  =&gt; 71,
	-height =&gt; 25,
);

$DataView = new Win32::GUI::ListView($DataWindow,   # add a listview to the main window
	-name   =&gt; "DataView",
	-top    =&gt; $DataWindow-&gt;ScaleHeight,
	-left   =&gt; 0,
	-width  =&gt; $DataWindow-&gt;ScaleWidth,
	-height =&gt; $DataWindow-&gt;ScaleHeight - 213,
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index =&gt; 0,
	-width  =&gt; 95,
	-text   =&gt; "First Name",
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index  =&gt; 1,
	-subitem=&gt; 1,   # this is a subitem
	-width  =&gt; 95,
	-text   =&gt; "Last Name",
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index  =&gt; 2,
	-subitem=&gt; 1,   # this is a subitem
	-width  =&gt; 100,
	-text   =&gt; "Building",
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index  =&gt; 3,
	-subitem=&gt; 1,   # this is a subitem
	-width  =&gt; 55,
	-text   =&gt; "Room",
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index  =&gt; 4,
	-subitem=&gt; 1,   # this is a subitem
	-width  =&gt; 114,
	-text   =&gt; "Adapter Address",
);

# define the columns for the listview
$DataView-&gt;InsertColumn(
	-index  =&gt; 5,
	-subitem=&gt; 1,   # this is a subitem
	-width  =&gt; 117,
	-text   =&gt; "IP Address",
);

$Report = new Win32::GUI::Window(   # define a new window for reporting errors
	-name   =&gt; "Report",
	-top    =&gt; 100,
	-left   =&gt; 100,
	-width  =&gt; $minwidth - 50,
	-height =&gt; $minheight + 100,
	-title  =&gt; "Report Problem",
	-class  =&gt; $dbv_class,
);

$Report-&gt;AddLabel(   # add a label to the Report window
	-name   =&gt; "YN_Label",
	-text   =&gt; "Your Name: ",
	-top    =&gt; 5,
	-left   =&gt; 5,
);

$YourName = $Report-&gt;AddTextfield(   # add a textfield for the Report window label
	-name   =&gt; "YourName",
	-top    =&gt; 2,
	-left   =&gt; 70,
	-width  =&gt; 300,
	-height =&gt; 23,
	-tabstop=&gt; 1,
);

$ReportMessage = $Report-&gt;AddRichEdit(   # add a RichEdit box to the Report window
	-name    =&gt; "Text",
	-text    =&gt; $text,
	-left    =&gt; 2, 
	-top     =&gt; 27,
	-width   =&gt; $Report-&gt;ScaleWidth - 5, 
	-height  =&gt; $Report-&gt;ScaleHeight - 65,
	-style   =&gt; WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
	-exstyle =&gt; WS_EX_CLIENTEDGE,
);

$Send = $Report-&gt;AddButton(   # add a button to the Report window
	-name   =&gt; "Send",
	-text   =&gt; "&amp;Send",
	-top    =&gt; $Report-&gt;ScaleHeight - 30,
	-left   =&gt; ($Report-&gt;ScaleWidth - 71)/2,
	-width  =&gt; 71,
	-height =&gt; 25,
);


$DataView-&gt;Hide();   # do not show the listview box initially
$Status-&gt;Hide();     # do not show the status bar initially
$Building-&gt;Select(-1);   # initially set the dropdown box to no selection
$Stop-&gt;Disable();   # disable the Stop button until data is being searched for
$NewSearch-&gt;Disable();   # disable the New Search button until data has been retrieved
$DataTab-&gt;Select(0);   # initially set the first tab as the selected tab
&amp;DataTab_Click;   # perform a 'click' on the tab
$resized = 0;   # tells us the window has not been resized yet

$DataWindow-&gt;Show();   # show the main window
Win32::GUI::Dialog();  # allow for interaction

sub GetData_Click {   # this checks to see if the menu File, Retrieve Data has been clicked
   $FindNow-&gt;Enable();   # enable the Find Now button
   $NewSearch-&gt;Enable(); # enable the New Search button
   if ($test != 1) {   # if not in a testing phase
      # the following will connect to an FTP server named "server" and will log on using "userid" and "password"
      # then change to the directory where data is stored, set to ASCII mode, retrieve the file "filename"
      # and close the connection to the FTP server
      $connect = new Win32::Internet();
      $connect-&gt;FTP($FTP, "server", "userid", "password");
      $FTP-&gt;Cd("directory");
      $FTP-&gt;Ascii();
      $FTP-&gt;Get("filename");
      ($FTPErrNumb, $FTPErrText) = $FTP-&gt;Error();
      $FTP-&gt;Close();
   }
   $dataretrieved = 1;   # okay, we have retrieved data
}

sub FileExit_Click {   # this checks to see if the menu File, Exit has been clicked
   exit(0);
}

sub FindName_Click {    # this checks to see if the menu Search, Find Name has been clicked
   $DataTab-&gt;Select(0); # select the tab and perform a "click" on it
   &amp;DataTab_Click;
}

sub FindBuilding_Click {   # this checks to see if the menu Search, Find Building has been clicked
   $DataTab-&gt;Select(1);    # select the tab and perform a "click" on it
   &amp;DataTab_Click;
}

sub FindAdapter_Click {   # this checks to see if the menu Search, Find Adapter has been clicked
   $DataTab-&gt;Select(2);   # select the tab and perform a "click" on it
   &amp;DataTab_Click;
}

sub ReportProblem_Click {   # this checks to see if the menu Tools, Report Problem has been clicked
   $Send-&gt;Disable();  # disable the Send button
   $Report-&gt;Show();   # show the Report window
   $Report-&gt;BringToFront();   # bring the report window to the front
   $ReportMessage-&gt;Text("");  # empty out the RichEdit field
   $YourName-&gt;Text("");   # empty out the sender's name
}

# the following sub will check to see iff the main window has been resized and if it has
# it will move buttons and resize the status bar and tab strip accordingly
sub DataWindow_Resize {
   $DataView-&gt;Resize($DataWindow-&gt;ScaleWidth, $DataWindow-&gt;ScaleHeight - 213);
   $Status-&gt;Resize($DataWindow-&gt;ScaleWidth, $Status-&gt;Height);
   $Status-&gt;Move(0, $DataWindow-&gt;ScaleHeight-$Status-&gt;Height);
   $DataTab-&gt;Resize($DataWindow-&gt;ScaleWidth - 105, 175);
   $FindNow-&gt;Move($DataWindow-&gt;ScaleWidth - 83, 30);
   $Stop-&gt;Move($DataWindow-&gt;ScaleWidth - 83, 60);
   $NewSearch-&gt;Move($DataWindow-&gt;ScaleWidth - 83, 90);
}

# the following sub will check to see iff the Report window has been resized and if it has
# it will move the button and resize the RichEdit field accordingly
sub Report_Resize {
   $ReportMessage-&gt;Resize($Report-&gt;ScaleWidth - 5, $Report-&gt;ScaleHeight - 65);
   $Send-&gt;Move(($Report-&gt;ScaleWidth - 71)/2, $Report-&gt;ScaleHeight - 30);
}

sub DataTab_Click {  # check to see what tab has been clicked
   # if the first tab is clicked, hide the irrelavant labels and textfields
   # and show the relevant ones
   if ($DataTab-&gt;SelectedItem == 0) {
      $DataWindow-&gt;Bld_Label-&gt;Hide();
      $Building-&gt;Hide();
      $DataWindow-&gt;Adapt_Label-&gt;Hide();
      $Adapter-&gt;Hide();
      $DataWindow-&gt;FN_Label-&gt;Show();
      $FirstName-&gt;Show();
      $DataWindow-&gt;LN_Label-&gt;Show();
      $LastName-&gt;Show();
      $FirstName-&gt;SetFocus();
   }
   # if the second tab is clicked, hide the irrelavant labels and textfields
   # and show the relevant ones
   if ($DataTab-&gt;SelectedItem == 1) {
      $DataWindow-&gt;FN_Label-&gt;Hide();
      $FirstName-&gt;Hide();
      $DataWindow-&gt;LN_Label-&gt;Hide();
      $LastName-&gt;Hide();
      $DataWindow-&gt;Adapt_Label-&gt;Hide();
      $Adapter-&gt;Hide();
      $DataWindow-&gt;Bld_Label-&gt;Show();
      $Building-&gt;Show();
      $Building-&gt;SetFocus();
   }
   # if the third tab is clicked, hide the irrelavant labels and textfields
   # and show the relevant ones
   if ($DataTab-&gt;SelectedItem == 2) {
      $DataWindow-&gt;FN_Label-&gt;Hide();
      $FirstName-&gt;Hide();
      $DataWindow-&gt;LN_Label-&gt;Hide();
      $LastName-&gt;Hide();
      $DataWindow-&gt;Bld_Label-&gt;Hide();
      $Building-&gt;Hide();
      $DataWindow-&gt;Adapt_Label-&gt;Show();
      $Adapter-&gt;Show();
      $Adapter-&gt;SetFocus();
   }
}

# has the 'x' button in the top right hand corner of the main window been clicked?
sub DataWindow_Terminate { 
   return -1;   # exit the program
}

# this doesn't work and I don't know why but it checks to see if the Stop button has
# been clicked and set a variable telling us it has, and then disable the Stop button
sub Stop_Click {
   $Stop-&gt;Disable();
   $breakloop = 1;
   return;
}

# this checks to see if the Find Now button has been clicked
sub FindNow_Click {
   my ($index,$fname,$lname,$build,$room,$adap,$ip);
   $lastcolumn = "";
   if ($dataretrieved == 1) {   # if data has been retrieved go ahead
      if ($resized == 0) {
	 $DataWindow-&gt;Resize($minwidth, $minheight + 118);
      }
      $DataView-&gt;View(1);   # sets the dataview box to detail view
      $DataView-&gt;Clear();   # clear it
      $DataView-&gt;Show();    # show it
      $Status-&gt;Show();      # show the status bar
      $Stop-&gt;Enable();      # allow user to push the Stop button
      $index = 0;
      %data = "";

      open (DATABASE, "database.txt");   # open the database containg the information
      
      while (&lt;DATABASE&gt;) {   # do this until end of file is reached
	 chomp;
	 ($id,$fname,$lname,$build,$room,$adap,$ip) = split(/,/);   # read in data and separate data 
	 
	 if ($breakloop == 1) {   # if Stop button is clciked break out of loop (but it doesn't work)
	    last;
	 }

         # determine which tab we are on and compare according to that
	 if ((($DataTab-&gt;SelectedItem == 0) &amp;&amp; (lc(substr($fname,0,length($FirstName-&gt;Text))) eq lc($FirstName-&gt;Text)) &amp;&amp; (lc(substr($lname,0,length($LastName-&gt;Text))) eq lc($LastName-&gt;Text))) 
	    || (($DataTab-&gt;SelectedItem == 1) &amp;&amp; (lc($build) eq lc($Building-&gt;Text)))
	    || (($DataTab-&gt;SelectedItem == 2) &amp;&amp; (lc(substr($adap,0,length($Adapter-&gt;Text))) eq lc($Adapter-&gt;Text)))) {
	       
               # store data so we can sort it later
	       my @temp = split/,/,$_;
	       s/^\d{1,3},//;
	       $data{$temp[0]} = $_; 
               
               # display the data in the listview box, as a detailed view
	       $DataView-&gt;InsertItem(-item =&gt; $index, -text =&gt; "$fname");
	       $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 1, -text =&gt; "$lname");
	       $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 2, -text =&gt; "$build");
	       $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 3, -text =&gt; "$room");
	       $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 4, -text =&gt; "$adap");
	       $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 5, -text =&gt; "$ip");
	       ++$index;
	 }
	 $DataView-&gt;Update();   # update the view (for smoothness)
         # if a record matches what we are looking for, tell us in the staus bar
	 $Status-&gt;Text("$index record(s) found");
      }
   close DATABASE;   # close the database
   $Stop-&gt;Disable(); # disable the Stop button
   $resized = 1;   # main window has been resized (because listview has been added)
   }
   # if data has not been retrieved, tell us in a Message Box
   else {
      Win32::Sound::Play("SystemDefault", SND_ASYNC);
      Win32::GUI::MessageBox(0,"You must retrieve the data from the network\r\nfirst.  Goto File, Retrieve Data.","Error: No Data Loaded",64);
   }
}

# if New Search button has been clicked, clear all data, set main window to default
sub NewSearch_Click {
   $FirstName-&gt;Text("");
   $LastName-&gt;Text("");
   $Building-&gt;Text("");
   $Building-&gt;Select(-1);
   $Adapter-&gt;Text("");
   $DataWindow-&gt;Resize($minwidth, $minheight);
   $DataView-&gt;Hide();
   $DataView-&gt;Clear();
   $Status-&gt;Hide();
   $resized = 0;
}

# if dropdown box is changed assign value to appropriate string
sub Dropdown_Change {
    $Building-&gt;Text($Building-&gt;GetString($Building-&gt;SelectedItem));
}

# sort data based on column clicked
sub DataView_ColumnClick {
   my $column = shift;
   # if you 'toggle" click on a column switch from ascending to descending order
   if ($lastcolumn == $column) {
      $sortorder = 1 - $sortorder;
   }
   # otherwise sort on ascending order
   else {
      $sortorder = 0;
   }
   my %sortcol = &amp;NewList($column, %data);
   &amp;SortListItem(\%data,\%sortcol);
   $lastcolumn = $column;
}

sub SortListItem {
  my ($data,$sortcol) = @_;
  my $check;
  my %data = %$data;
  my %sortcol = %$sortcol;

  $check = "$_" foreach (values %sortcol);

  $DataView-&gt;Clear();   # clear out the dataview for redisplaying sorted data
  $index = 0;
  if ($sortorder == 0) {   # ascending order
     foreach (sort { uc($sortcol{$a}) cmp uc($sortcol{$b}) } keys %sortcol)  {
	my @newdata = split/,/,$data{$_};
	($fname,$lname,$build,$room,$adap,$ip) = @newdata;
	if ($fname ne "") {   # display sorted data
	   $DataView-&gt;InsertItem(-item =&gt; $index, -text =&gt; "$fname");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 1, -text =&gt; "$lname");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 2, -text =&gt; "$build");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 3, -text =&gt; "$room");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 4, -text =&gt; "$adap");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 5, -text =&gt; "$ip");
	   $DataView-&gt;Update();
	   ++$index;
	}
     }
  }
  else {   # descending order
     foreach (sort { uc($sortcol{$b}) cmp uc($sortcol{$a}) } keys %sortcol)  {
	my @newdata = split/,/,$data{$_};
	($fname,$lname,$build,$room,$adap,$ip) = @newdata;
	if ($fname ne "") {   # display sorted data
	   $DataView-&gt;InsertItem(-item =&gt; $index, -text =&gt; "$fname");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 1, -text =&gt; "$lname");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 2, -text =&gt; "$build");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 3, -text =&gt; "$room");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 4, -text =&gt; "$adap");
	   $DataView-&gt;SetItem(-item =&gt; $index, -subitem =&gt; 5, -text =&gt; "$ip");
	   $DataView-&gt;Update();
	   ++$index;
	}
     }
  }
}


sub NewList  {
   ## This creates another hash to use only for sorting purposes.
   my ($column,%sortcol) = @_;
   my $sortthis;
																									  
   foreach (keys %sortcol) {
      my @info = split /,/, $sortcol{$_};
      $sortthis = $info[$column];
      $sortcol{$_} = "$sortthis";
   }
   return(%sortcol);
}

# has the 'x' button in the top right hand corner of the Report window been clicked?
sub Report_Terminate {
   $ReportMessage-&gt;Text("");   # clear out the richEdit field
   $YourName-&gt;Text("");   # clear the sender's name
   $Report-&gt;Hide();   # hide the Report window
   return;
}

sub YourName_Change {
   if ($YourName-&gt;Text() ne "") {
      $Send-&gt;Enable();   # enable the Send button if sender has entered their name
   }
   else {
      $Send-&gt;Disable();  # if the sender didn't enter their name disbale Send button
   }
}

sub Send_Click {   # if Send button has been clicked
   # if no message has been entered, inform the user
   if ($ReportMessage-&gt;Text() eq "") {
      Win32::Sound::Play("SystemDefault", SND_ASYNC);
      Win32::GUI::MessageBox(0,"Message can not be left blank. Please\r\nenter a message and try again.",64);
   }
   # otherwise send message and name of sender
   else {
      $name = $YourName-&gt;Text;   # name of sender
      $message = $ReportMessage-&gt;Text;   # message to be sent
      # if we aren't testing
      if ($test != 1) {
         # $name = sender's name, $smtp = outgoing mail sever
	 ref ($sender = new Mail::Sender ({ from =&gt; $name, smtp =&gt; "mailserver"}));
         # $ recipient = receiver
	 $sender-&gt;OpenMultipart({to =&gt; "recipient", subject =&gt; "Problem in Database"});
	 $sender-&gt;Body;
	 $sender-&gt;Send($message);
	 $sender-&gt;Send(&lt;&lt;'*END*');

*END*
	 $sender-&gt;SendLine("\n$name");
	 $sender-&gt;Close;
      }
      $Report-&gt;Hide();   # hide the Report window
   }
}
&lt;/code&gt;</field>
<field name="codedescription">
This is a Perl script that makes use of the Win32:GUI module. Hopefully this will be a good example of the many features that can be used in GUI.  This is the updated version of my finddata.pl program with comments added. I still haven't got the Stop button to work or been able to read the data based on an item of data that is clicked.  You will need a data file named "datafile.txt" in the same directory and must run the program with a -t parameter like:
&lt;p&gt;perl finddata.pl -t&lt;/p&gt;
The datafile needs to be in the format:
&lt;p&gt;id,firstname,lastname,building,room,adapteraddress,ipaddress&lt;/p&gt;
I would appreciate any insight.</field>
<field name="codecategory">
Win32::GUI</field>
<field name="codeauthor">
Jonathan Southwick, jsouthwi@allegheny.edu, Technical and Network Services, Allegheny College, Meadville, PA  16335</field>
</data>
</node>
