Hi all, I have a script that I want to have as a standalone application, but when built with PDK 6, the script compiles but doesn't work. The script relies on Tk::DropSite, and the line that seems to be the problem is -droptypes => ($^O eq 'MSWin32' ? 'Win32' : 'KDE', 'XDND', 'Sun'). If that line of code is in, then no widget window is displayed, if OUT then the widget comes up but the functionality is lost. Can anyone tell me whether I should be able to compile this code? Here's the script:
use Tk; use Tk::DropSite; use Net::FTP; use Net::SMTP; use strict; use vars qw($top $drop); $top = MainWindow->new(); $top -> title('cor-techs.net Drop Zone'); $top -> Label(-text => "Cor-Techs.net Drop Zone:")->pack; $top -> geometry('600x250'); $drop = $top->Scrolled('Listbox', -scrollbars => "osoe", )->pack; $drop-> configure(-width=>500); my $quit = $top-> Button(-text => 'Quit', -command => \&quit)->pack(); $quit-> configure(-width=>10); $quit-> configure(-background=>'red',-foreground=>'white'); # Tell Tk that $drop should accept drops. $drop-> DropSite (-dropcommand => [\&accept_drop, $drop], -droptypes => ($^O eq 'MSWin32' ? 'Win32' : ['KDE', 'XDND', 'Sun']) ); MainLoop; sub accept_drop { my($widget, $selection) = @_; use vars qw( $filename %files $cleanedName); $filename = $widget->SelectionGet(-selection => $selection, 'STRING'); if (defined $filename) { $widget->insert(0, "Transferred: ".$filename); $cleanedName = ftpIt($filename); sendmail($cleanedName); } } sub ftpIt { my $ftpdFile = $_[0]; my($directory, $filename) = $ftpdFile =~ m/(.*\\)(.*)$/; my $urlFriendly = $filename; $urlFriendly =~ s/[^a-zA-Z0-9_\.-]/_/ig; ## COMMENT OUT THE FTP PART - not the source of the error # my $ftp = Net::FTP -> new("www.cor-techs.net") or die "Can't conn +ect\n"; # $ftp -> login("ftplogin", "passwd") or die "Couldn't login\n"; # $ftp -> binary() or die "Couldn't send as binary\n"; # $ftp -> cwd("/c:/websites/cortechs/downloads") or die "Couldn't c +hange dir\n"; # $ftp -> put($ftpdFile) or die "Couldn't transfer file\n"; # $ftp -> rename ( $filename , $urlFriendly ) or die "Couldn't rena +me file\n"; # $ftp -> quit() or warn "Couldn't quit. Oh well.\n"; return ($urlFriendly); } sub sendmail { my $filename = $_[0]; # Connect to the server ann\@cor-techs.net; my $smtp = Net::SMTP -> new("mail.cor-techs.net"); die "Couldn't connect to server" unless $smtp; my $MailFrom = "ann\@cor-techs.net"; my $MailTo = "ann\@cor-techs.net"; my $message = "A file has been uploaded:\n\n"; $message = $message."http://www.cor-techs.net/downloads/$filename\ +n\n"; $message = $message."Login Info\n****************************\n"; $message = $message."Username: username\n"; $message = $message."Password: password\n"; # $smtp-> mail( $MailFrom ); # $smtp-> to( $MailTo ); # Start the mail # $smtp->data(); # Send the header. # $smtp->datasend("To: ann\@cor-techs.net"); # $smtp->datasend("From: ann\@cor-techs.net\n"); # $smtp->datasend("Subject: File Upload Info\n"); # $smtp->datasend("\n"); # Send the message # $smtp->datasend($message); # Send the termination string # $smtp->dataend(); # $smtp->quit(); } sub quit { exit; }

In reply to Building standalone application with Perl Dev Kit 6 fails, but script works by gammaX500

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.