finally got back around to it this evening >:D
but still no drag and drop joy for me :(

here is what i am trying to do:
use diagnostics; use warnings; use Wx; use Wx::Event qw(EVT_BUTTON); use Wx::Event qw(EVT_DROP_FILES); use File::Slurp; use Digest::MD5; use File::Path; ###################################################################### +######### my $app = Wx::SimpleApp->new; my $frame = Wx::Frame->new( undef, -1, 'test tool', wxDefaultPosition, Wx::Size->new(700,400), wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP ); $frame->DragAcceptFiles(1); EVT_DROP_FILES( $frame, \&extract ); ###################################################################### +######### my $noteBook = Wx::Notebook->new($frame, -1, wxDefaultPosition +, wxDefaultSize); my $window1 = Wx::Panel->new($noteBook, wxID_ANY); my $window2 = Wx::Panel->new($noteBook, wxID_ANY); my $window3 = Wx::Panel->new($noteBook, wxID_ANY); $noteBook->AddPage($window1, "First", 1, 0); $noteBook->AddPage($window2, "Second", 0, 1); $noteBook->AddPage($window3, "Third", 0, 2); $frame->Show(1); $app->SetTopWindow($frame); $app->MainLoop; ###################################################################### +######### sub extract { $_= shift; print "@_\n"; #<------- prints: "Wx::DropFilesEvent=SCALAR(0x3131024) +" #please read below the code for the question pertaining + to this. open (my $data, '<', "@_") or die "cannot open $data $!"; my $fileLocation = ''; my $fileSize = ''; my $fileName = ''; my $chunk = ''; seek ( $data, 0x04, 0 ); read ( $data, my $count, 0x04 ); $count =~ s/(.)/sprintf("%02x",ord($1))/egs; my $entryCount = hex($count); print "\nEntry count in file is: $entryCount\n\n"; seek ( $data, 0x00, 0 ); seek( $data, 0x10, 0 ) or die "cannot seek $data $!"; for (my $i=1; $i <= $entryCount; $i++) { read( $data, $fileLocation, 0x08 ); read( $data, $fileSize, 0x08 ); read( $data, $fileName, 0x20 ); $fileLocation =~ s/(.)/sprintf("%02x",ord($1))/egs; $fileSize =~ s/(.)/sprintf("%02x",ord($1))/egs; $fileName =~ s/\0+$//; open( my $extractedData, '>', "extracted/$fileName" ) or die "Cann +ot open $fileName $!"; sysseek( $data, hex($fileLocation), 0 ); sysread( $data, $chunk, hex($fileSize) ); syswrite( $extractedData, $chunk ); close( $extractedData ); } my $dirname = "extracted/"; my @md5s = read_file("md5"); my $md5s = join( '', @md5s ); my $filesize = ''; open( my $buf, '<', "extracted/sdk_version" ) or die "cannot open $buf + $!"; seek( $buf, 0x00, 0 ); read( $buf, my $sdk, 0x03 ); foreach my $file (<$dirname/*>) { next if -d $file; open( my $FILE, $file ); binmode($FILE); $filesize = -s $FILE; $file =~ s{.*/}{}; my $md5 = Digest::MD5->new->addfile($FILE)->hexdigest; if ( $md5s =~ $md5 ) { print "$md5 Match! $sdk $file $filesize\n"; } else { print "WARNING !\n"; } } }
The problem i am having is what you said in your earlier post anonomous monk, it does print what you said, but i cannot for the life of me figure out why it is not working. i get "Use of uninitialized value $data", or "trying to seek closed filehandle" and its because its not associating the dropped file with anything and thus not even opening the file.

Ive tried to assign it a variable as you can see in open statement, but that does not work for some reason, and its because it does not have the filepath or filename of the file, instead $data has "Wx::DropFilesEvent=SCALAR(0x3131024)" inside of it and that ofcourse is not going to work and is why it is giving me these errors.

I also have a very hard time understanding wxperl and wxwidgets in general especially when it comes to certain functions/events, tho i did get buttons figured out sort of. I have gotten very busy recently and havent really had time to delve into it like i should, but i have searched the modules inside of WX but everything in there is like ancient egyptian hieroglyphics. if you could school me at what i am doing wrong, and maybe show me an example i would greatly appreciate it. This is just a small personal project i am working on and it will help me finish certain tasks quicker if i could get this working :)

p.s. This is just one revision, ive tried abunch of different things to no avail and always end up with the same error as no such file or directory, or use of uninitialized value.

In reply to Re^3: WxPerl and drag and dropping files by james28909
in thread WxPerl and drag and dropping files by james28909

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.