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: Advanced:
Can't locate object method "" via package ""

 



Knoxy
New User

May 9, 2002, 6:52 AM

Post #1 of 6 (2754 views)
Can't locate object method "" via package "" Can't Post

Hi I badly need help with this problem.

I get the following error when I try to call a method on a perl module I wrote. I have attached both the module and the calling script.

thanks in advance

Paul
Attachments: MerchantAPI.pm (8.75 KB)
  client.pl (0.37 KB)


fashimpaur
User / Moderator

May 9, 2002, 7:44 AM

Post #2 of 6 (2753 views)
Re: [Knoxy] Can't locate object method "" via package "" [In reply to] Can't Post

Knoxy,

Well, your problem is extremely simple to fix. The problem is that
you did not recognize the MerchantAPI "is an" Exporter. Because you
said:

use MerchantAPI;

you do not need to dereference the methods that it exports. Thus:

MerchantAPI->init();

should be just:

init();

The exported methods are:

init
sendRequest
create_order_html
create_order_intershop_html
create_order_wml install_password
cancel_order ship_order
get_order_status
get_order_details
create_refund
is_merchant_enabled
disable_merchant
check_wait_ship
kill_daemon

Any calls for these methods do not need to be dereferenced using the
schema: MerchantAPI->method.

This is all I have looked at at first blush. Reply to this post if there are other
problems you encounter.

HTH,

Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


Knoxy
New User

May 9, 2002, 8:10 AM

Post #3 of 6 (2751 views)
Re: [fashimpaur] Can't locate object method "" via package "" [In reply to] Can't Post

Hi Dennis,

thanks for the quick reply, but I have tried this and it still does not work. When I remove the reference to MerchantAPI and just call the init() method as is I get the following.

Undefined subroutine &main::init called at client.pl line 11.

I am working on an NT4 platform at the minute and was wondering if this would have any effect on it.

thanks again

Paul


fashimpaur
User / Moderator

May 9, 2002, 9:19 AM

Post #4 of 6 (2746 views)
Re: [Knoxy] Can't locate object method "" via package "" [In reply to] Can't Post

Knoxy,

I think I found some of the other errors.

Line 1 of MerchantAPI.pm reads:

package MechantAPI;

It should be:

package MerchantAPI;

Line 13 of client.pl reads:

my @totOrder = create_order_html($pspId,$merchantID,orderNo,$amount,$currency);

It should read:

my @totOrder = create_order_html($pspId,$merchantID,$orderNo,$amount,$currency);

Then, you should be okay. Still do no dereferencing of the MerchantAPI
methods. They are now really imported because of the fix to the
package call in the .pm file.


Let me know if you have any other problems.

Good Luck,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


Paul
Enthusiast

May 10, 2002, 2:12 AM

Post #5 of 6 (2741 views)
Re: [Knoxy] Can't locate object method "" via package "" [In reply to] Can't Post

Hi,

You should probably remove @EXPORT and do as you did with Package->method() .....@EXPORT can pollute the namespace and can be problematic. If anything use @EXPORT_OK


yapp
User

May 16, 2002, 4:13 AM

Post #6 of 6 (2723 views)
Re: [fashimpaur] Can't locate object method "" via package "" [In reply to] Can't Post

Just to let you all know: with "use strict" or "use strict 'subs';" Perl doesn't allow barewords... You need to be clear what you mean, so this error is trapped at compile time.

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool

 
 


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

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