A_Banknote has asked for the wisdom of the Perl Monks concerning the following question:

this problem has made me puzzled for a long time. I am scripting a simple scaner, but it got some unknown mistakes
##################################################### my @report; Scan::ScanAll(\@addr, \@port, \@report); #bugs here "bug1"; printf "Report ref is : @report \n"; #"tag1" to see if script can +run here Report::TxtReport(@report); system("gedit report.txt"); ######################################################
Scan::ScanAll is a function that scan the address and ports in @addr and @port and return a unformated report to @report; When I send only one address to @addr and scanned, script can run to "tag1" place. But when I send more than an address to @addr , the script can not run to "tag1" and things after it, it seems to jump that section. There are other "printf" in Scan::ScanAll that shows me the Scan::ScanAll function runs well all the time. It seems that the bug flies out before "tag1" and after "bug1". Could anyone tell me why?
this is the output when run only one address ###################################################### 192.168.1.3 Create one thread for 192.168.1.3 192.168.1.3 135/tcp 139/tcp 445/tcp Finish ScanAll sub, Get Out of Scan.pm ARRAY(0x867f1cc) Report ref is : ARRAY(0x867f1cc) ###here get out of ###Scan::ScanAl +l, and I printed the @report, code can go on Get in Html Report.pm 192.168.1.3 135/tcp msrpc 135 tcp Microsoft RPC services 139/tcp 445/tcp A Session finished Scaning! excting ###debug msg show finish ### here I called firefox to read the report in html, in ### common, finish all the scan should print as upon GLib-GObject-WARNING **: instance with invalid (NULL) class pointer. GLib-GObject-CRITICAL **: file gsignal.c: line 2122 (g_signal_emit_val +ist): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed. GLib-GObject-WARNING **: instance with invalid (NULL) class pointer. GLib-GObject-CRITICAL **: file gsignal.c: line 1765 (g_signal_handlers +_destroy): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed. ###################################################### this is the output when run >1 addresses ###################################################### 10.0.144.90 192.168.1.2 192.168.1.3 Create one thread for 10.0.144.90 Create one thread for 192.168.1.2 Create one thread for 192.168.1.3 10.0.144.90 192.168.1.2 192.168.1.3 135/tcp 139/tcp 445/tcp Finish ScanAll sub, Get Out of Scan.pm ARRAY(0x8661c8c) ARRAY(0x8661d88) ARRAY(0x8661dac) ###here get out of Scan::ScanAll, the refs are printed in ###Scan::Sca +nALL as a debugs msg, it shows me, in ###Scan::ScanALL, @result is ok + yet, it can not run on when ###return from Scan::ScanAll. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `g +pointer' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 2122 (g_signal_emit_vali +st): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during globa +l destruction. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `g +pointer' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 1765 (g_signal_handlers_ +destroy): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during +global destruction. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `< +invalid>' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 2122 (g_signal_emit_vali +st): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during globa +l destruction. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `< +invalid>' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 1765 (g_signal_handlers_ +destroy): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during +global destruction. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `< +unknown>' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 2122 (g_signal_emit_vali +st): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during globa +l destruction. Lib-GObject-WARNING **: instance of invalid non-instantiatable type `< +unknown>' during global destruction. Lib-GObject-CRITICAL **: file gsignal.c: line 1765 (g_signal_handlers_ +destroy): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during +global destruction.
I've got a poor english so I dont know if I made it clear. thx all the same

Replies are listed 'Best First'.
Re: how does my code get lost?
by Zaxo (Archbishop) on Jul 03, 2004 at 07:04 UTC

    It's hard to know just what's going wrong, but the error messages read like you're trying to use Glib.pm (part of the Gtk2-Perl package) on a Windows system. It's hard to be more specific, since a CPAN search with the command 'i /Scan/' turns up nothing that looks like what you are using.

    Some more information about Scan.pm and your build of glib and gtk for Windows would be helpful in resolving this.

    After Compline,
    Zaxo

      Scan.pm is built up by myself, so it may also causes some mistakes.
      ehh. all my work is under a gentoo linux, and I'm using gtk2-perl as a gui toolkit. maybe wrong goes on Gtk2-perl but i don't know where. Need I paste the Scan.pm ? it's just a bit long