Hi All,
I am using Perl and Perl/Tk to develop a small software installer. I will be
starting one perl script from another. The calling program has the User
interface with TK, and one of the widgets is a progressbar. This bar must
get updated based on the value of a variable. Now, in the program that is
called I need to update this variable, but the caller must have the value as
well, since the widget makes a refrence to it. I thought the best solution
was to use IPC::Shareable and tie the required variables. So I downloaded
the module from CPAN and installed it on Sun-Solaris.
All installation and test went through fine. But, when I use it I get an
error as follows:
IPC::Shareable::SharedMem: shmget: No such file or directory
at /tfti/home/vchavan/ims/generic/IPC/Shareable.pm line 566
Tk::Error: Could not create shared memory segment: No such file or
directoryIPC::Shareable::SharedMem: shmget: No such file or directory
All modiles like Storeable, SharedMem etc are present in the required
directoy (as was done by make install)
I am not sure if the way I have used tie is correct. For your reference I am
pasting a part of my code here:
Calling program:
sub instAppliedPatches {
my $self = shift(@_);
$self->resetStatusMsg();
use IPC::Shareable;
my $glue = 'data';
tie ($main::nPercentage, 'IPC::Shareable', "glue") ;
do 'test.pl';
}
NOTE that $main::nPercentage is the variable that has to be shared by the
program test.pl. This variable is present in a global space. And is directly
being used by the ProgressBar widget in the UI.
Called Program :
#!/usr/local/bin/perl -w
print "***** In abc *****";
use IPC::Sharable;
tie ($nPer, 'IPC::Shareable', 'data') or die "Failed to tie in child
process"
for (my $i=0; $i<100; $i++)
{
sleep 1;
$nPer = $i;
print "$nPer";
}
NOTE: Here $nPer is the varible that gets updated.
Do let me know what the problem could be.
Regards,
Vidyut