That's not nearly enough context to even make a guess at the problem. There's
no mention of what the first method is or its signature. What you've got there
either won' t compile or will infinitely recurse (since in both cases Method2
calls itself). There's also the question of how $MySQL_Statement gets set (is
that a global? package variable?).
Calling another method in a module is extremely easy and could look like this:
package TheModule;
sub method1() {
my ($sql_statement) = @_;
# do SQL stuff
}
sub method2() {
my ($sql_statement) = @_;
my $result = method1($sql_statement);
}
It might look different depending on why you want to have method2.
At 02:59 PM 8/15/2005, Jose Guevarra wrote:
>Hi,
>
> I have a module that contains a method for doing mysql queries. I've been
>trying to create another method(subroutine) inside the same module that
>calls on the first method to do mysql queries. It doesn't seem to be
>working. Is there a special way of doing this (if possible?)
>
>basically I'm doing this
>
>
>sub Method2()
>{
>
>my $ref = MODULENAME->Method2($MySQL_Statement);
>
>}
>
>I've also tried....
>
>sub Method2()
>{
>
>my $ref = &Method2($MySQL_Statement);
>
>}
>
>
>
>
>Thanks,
>
>-Jose
>
>_______________________________________________
>ActivePerl mailing list
>[email protected]
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs