Hello List,

My question is if this work safe ?

Here I have the way to use 2 modules and shares their methods cross
along, because
I don't want to split out the common part as another package, since
there are class properties
inside. If I split out something, I have to rebuild the object again in
the new package.

In Main, I call PackA to do something, which Pack A need PackB to do
something, however,
PackB need another method in PackA to do something also. Because the
{OuterClass} is
actually the exact reference in PackA, so I think that's okay, I think.

In real case, PackA is the user interface on drawing calendar ( daily,
weekly, monthly, yearly ),
where PackB is a Format feeder. The way I need PackB to call PackA again
is that I want to call
the *Monlty method 12 times so forming the *Yearly one.

Thanks for advise,
Mug

###############################################################
package PackB ;

sub Do_Something_Else {
# do something and return something
}

sub Do_Something {
my $class = shift;
my $data = $class -> {OuterClass} -> Func_In_A2 ;
$class -> Do_Something_Else ( $data ) ;
# do something and return something
}

sub Construct {
my $self = {};
$self -> {OuterClass} = shift;
return $self;
}

1;
__END__
#################################################################
package PackA;
use PackB;

sub Func_In_A2 {
# do something and return something
}

sub Func_In_A {
# do something and return something
}

sub MainFunc {
my $class = shift;
my $B_Func = PackB::Construct ;
return $B_Func -> Do_Something
}

sub Construct_A {
bless {};
}

1;
__END__
#################################################################

# MAIN
use PackA;

my $O = Constuct_A ;
print $O -> MainFunc ( "Argv" ) ;



Reply via email to