Hi,
I have two script one in perl and one in expect.I am creating multiple thread through perl.In a single thread i am creating a new process where i exec my expect scripts.But after running the perl file , i get an error message

Can't locate object method "join" via package "threads=SCALAR(0x81e2d5 +0)0" (perh aps you forgot to load "threads=SCALAR(0x81e2d50)0"?) at ./thread1 lin +e 15. A thread exited while 2 other threads were still running. panic: MUTEX_DESTROY.

The two files are attached.Please help me. thanks in advanced

#!/usr/bin/perl -w use threads; ######### Main Starts here ######### for($i=0;$i<10;$i++) { $th.=$i; $th = threads->new(\&sub2,$i); } for($i=0;$i<10;$i++) { $th.=$i; $result = $th->join; $result = $th->eval; $th->detach; } ##### Subroutine 2 defined for thread creation ##### sub sub2 :locked { my @para = @_; my $t = $_[0]; my $temp="test"; my $user=$temp.$t; if (!defined($pid = fork)) { die "Cannot fork\n"; } elsif ($pid == 0 ) { exec("./sshex $user"); } else { waitpid($pid,0); } } #!/usr/bin/expect set ip "164.99.152.91" set user [ lindex $argv 0 ] set at "@" set pass "novell" set mac "$user$at" set path /home/$user/$user set sec [clock seconds] set realm "testRealm" set timeout 20 #spawn "/bin/sh" set file [ open $path w+ ] spawn ssh $user$at$ip sleep 1 puts $file "$sec" expect { "$user$at$ip's password:" { send "$pass\r" expect "$mac" { send "kinit $user$at$realm\r" expect "$user$at$realm's Password:" send "novell\r" sleep 1 expect "$mac" send "ldapsearch -Y GSSAPI -h 164.99.155.248 -b \" +\" -s base\r" sleep 5 expect "$mac" } } "Permission denied" { puts :Error in password" } } set sec1 [clock seconds] puts $file "$sec1"

In reply to regarding perl thread by Anonymous Monk

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.