How can Tk be affecting another unrelated module? 
Author Message
 How can Tk be affecting another unrelated module?

Ok, I've tracked down this problem as far as I can.  Time to ask for help.

First the background:

Running with Perl v5.004_04 with Tk v402.003.  I'm trying to use the Perl5
wrappers around the pilot-link library (a library that lets me communicate
with a Palm Pilot).

I'm using a program on the Pilot called JackFlash that lets me move files
to and from Flash memory.  Without Tk, the pilot-link Perl5 wrappers work
fine giving me a list of databases in RAM on the Pilot.  When the Perl program
uses Tk, I suddenly get a "Modification of a read-only variable" in the
pilot-link Perl5 wrapper when it hits the first database I moved into Flash.

The *exact* line in the Tk package causing this problem is line 38 in
Submethods.pm, which looks like this:


Comment this line out, and the problem doesn't occur.  I've never seen "shift"
used like this, so I'm not sure what it's doing.

I can post a small program that demonstrates this problem.  I can't understand
why this line should be affecting another package like it does.  No other
modules being used do this.

To add a bit more, changing the line shown above to:


doesn't change anything, but:


does.  Using eval with the quotes (instead of curly braces) also makes the
problem go away.

Anybody possibly have any clue on this one?

--

Disclaimer: Any/All views expressed
here have been proved to be my own.   [ http://www.*-*-*.com/ ~adam/]



Fri, 26 Jul 2002 03:00:00 GMT  
 How can Tk be affecting another unrelated module?

Quote:

> Ok, I've tracked down this problem as far as I can.  Time to ask for help.
> First the background:
> Running with Perl v5.004_04 with Tk v402.003.  I'm trying to use the Perl5

Yes, pls post a small sample.

Your Perl and Tk are very old, BTW, you should try the latest versions ...



Sat, 27 Jul 2002 03:00:00 GMT  
 How can Tk be affecting another unrelated module?


Quote:

> Yes, pls post a small sample.

> Your Perl and Tk are very old, BTW, you should try the latest versions ...

I know they are old.  I've been hesitant fearing there might be problems with
PilotManager and so I've haven't upgraded yet.

Below is a small example.  Uncomment line 6 (Direct Tk...) to have it run with
problems.

The actual error message I get is:

        Modification of a read-only value attempted at ./test.pl line 36.

----Start-of-Example
#!/packages/bin/perl

use PDA::Pilot;

require Tk::Submethods;
Direct Tk::Submethods ('image' => [qw(delete width height type)]);

&hotsync;

sub hotsync {
  my ($port);
  my ($socket);
  my ($dlp);

  $port = "/dev/pilot";

  $socket = PDA::Pilot::openPort($port);

  print "Now press the HotSync button\n";

  $dlp = PDA::Pilot::accept($socket);

  &ListDBs($dlp);

  undef $dlp; # Close connection

Quote:
}

sub ListDBs {

  my ($dbnum) = 0;
  my ($stop) = 0;
  my ($dbinfo);

  while (!$stop) {
    $dbinfo = $dlp->getDBInfo($dbnum, 1, 0);
    print "Database #$dbnum, Name = <$$dbinfo{'name'}>\n";

    $dbnum = $$dbinfo{'index'} + 1;

    $stop = !defined($$dbinfo{'more'});
  }

Quote:
}

----End-of-Example
--

Disclaimer: Any/All views expressed
here have been proved to be my own.   [http://www.csh.rit.edu/~adam/]



Sat, 27 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Changing One Array Changes Unrelated Arrays -- Why?

2. parsing canned response

3. question about canned perl script

4. Passing open file descriptor to an unrelated process

5. Troubles with a Canned script

6. canned reply script

7. canned reply??

8. canned replies

9. find.pl - unrelated question

10. What module am I missing?

11. buliding a module, am i being stupid ?

12. Installing modules::I guess I am just an idiot

 

 
Powered by phpBB® Forum Software