Anything happened to the libURL in 4.0?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Anything happened to the libURL in 4.0?

Post by hliljegren » Thu Nov 26, 2009 10:26 am

Hi all!

I'm having severe problems with libUrlMultipartFormData! Has this changed in version 4 in any way??? If I execute the following code in the message box

Code: Select all

libUrlMultipartFormData(theForm, "param1", "MyValue")
I get nothing in return (as it should be) but if I execute the following:

Code: Select all

libUrlMultipartFormData(theForm, "param1", "MyValue")
Put "Hello!"
I get the following message:
Message execution error:
Error description: Handler: can't find handler
As soon as I do anything *AFTER* the libUrlMultipartFormData my programs halts with the above error message.

I've tried to reinstall my revolution studio package but still have the same result. ANY IDEAS?????
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Anything happened to the libURL in 4.0?

Post by Janschenkel » Thu Nov 26, 2009 12:03 pm

libUrlMultipartFormData is a function, not a command - so if you try to use it as a command, the rev engine can't find it and throws the 'handler not found' error. So your script should read something like:

Code: Select all

get libUrlMultipartFormData(theForm, "param1", "MyValue")
HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Anything happened to the libURL in 4.0?

Post by SparkOut » Thu Nov 26, 2009 12:04 pm

This must be due to a little syntax tightening in the engine I think. I don't know if and when anything has changed, but libURLMultiPartFormData definitely still works - but it is (and has always been) a function not a command, so calling it as a command/handler is not the right way (although the example in the docs is not specific about this, to the point of being misleading!)
If you try:

Code: Select all

   if libUrlMultipartFormData(theForm, "param1", "MyValue") is not empty then
      answer it && "error"
   else
      Put "Hello!"
   end if
you should hopefully find that it works.

HTH
SparkOut

[edit]Nice one Jan, beat me to it. And the "get" version is cleaner too.

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Anything happened to the libURL in 4.0?

Post by hliljegren » Thu Nov 26, 2009 1:27 pm

Well maybe I reduced my code a little bit too much. If I use the

Code: Select all

if(...) then
  Answer it
end if
I always get the answer dialog but with no content
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Anything happened to the libURL in 4.0?

Post by Janschenkel » Thu Nov 26, 2009 6:16 pm

Yonly need to check the return value to see if something went wrong:

Code: Select all

get libUrlMultipartFormData(theForm, "param1", "MyValue")
if it is not empty then
  answer error it
else
  ## ... normal code
end if
Jan Schenkel.
Last edited by Janschenkel on Fri Nov 27, 2009 11:52 am, edited 1 time in total.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Anything happened to the libURL in 4.0?

Post by hliljegren » Thu Nov 26, 2009 10:24 pm

Here's my current finding:

Code: Select all

if libUrlMultipartFormData(theForm, "param1", "MyValue") is not empty then
    answer it error
end if
always gives me the answer dialog with no contents!

But

Code: Select all

get libUrlMultipartFormData(theForm, "param1", "MyValue")
if it is not empty then
   answer it error
end if
Works OK! The previous code worked fine for me in version 3.5 but doesn't work in 4.0. Even though this looks like a bug to me I've been into programming to long to rule out that this isn't caused by my own fault...

Actually the problem started yesterday and I installed 4.0 when it arrived, but I've been working on other parts of my application (which uses XMLRPC-calls instead) and not used the libUrl... function again until now.

But thanks Jan for giving me something that works at least!!
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

Post Reply