CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
need help on object serialization and writing to pipe

 



kieron
New User

Oct 6, 2013, 11:33 PM

Post #1 of 1 (1351 views)
need help on object serialization and writing to pipe Can't Post

Hi ,

Below is my code, please let me know how can I send the $guiobject object so as it remanis unchanged when I access it from server.pm . As you can see the object printed by two print messages from CommSystem and Server.pm are different. Below is my code :
#start.pl

Code
#!/usr/bin/perl  
use strict;
use warnings;


use CommSystem;
CommSystem::init();


## CommSystem.pm


Code
package CommSystem;   
use strict;
use warnings;
use Tk;
use Exporter;
use GUI;

our @ISA = qw (Exporter);
our @EXPORT = qw ($guiobj);
our $guiobj;

my $mw = MainWindow->new();
$guiobj = GUI->new();
MainLoop;
sub init {

print "Sent object $guiobj \n";

system ("perl proc.pl");

}

1;


# GUI.pm

Code
package GUI;  

use strict;
use warnings;

sub new {

my $class = shift;

my $self = {} ;

bless $self;

return $self;

}

1;


## proc.pl

Code
 
#!/usr/bin/perl

use strict;

use warnings;

use Server;

my $server = Server->new();

$server->initServer();


# Server.pm



Code
 
package Server;

use strict;

use warnings;

use CommSystem;

sub new {

my $class = shift;

my $self = { object => $guiobj };

bless $self;

return $self;

}


sub initServer
{

my $self= shift;

print "passed object ",

$self->{object}, "\n";

}

1;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives