in reply to why this couldn't work?

Who defines CURLOPT_FOLLOWLOCATION?

See require, use, and import

When you use WWW::Curl::Easy;, it exports constants like CURLOPT_FOLLOWLOCATION

They are still accessible via WWW::Curl::CURLOPT_FOLLOWLOCATION or some such

FWIW, Re: why this couldn't work? is not an effective node title

Replies are listed 'Best First'.
Re^2: why this couldn't work?
by Anonymous Monk on Jul 01, 2011 at 17:02 UTC
    both WWW::Curl::Easy::CURLOPT_HEADER or WWW::Curl::CURLOPT_HEADER couldn't work. I'm not sure where they got defined, may be it's inside the xs library? Any ideas? (btw, sorry for the node title, didn't know that would be a problem)

      If it is defined in the XS library, it will be available just the same as if it were defined in Perl space. I'm not sure what exactly you tested, and whether you get errors now, and what errors you get when using strict. It seems that WWW::Curl::Easy does something fancy with AUTLOAD, so you might want to inspect %WWW::Curl:: for interesting constant names.

      A helpful node title would include "WWW::Curl", btw, and describe the problem, instead of asking a general question that could just as well apply to growing tomatoes on the moon.

      I tried both, came up with this:
      Bareword "WWW::Curl::CURLOPT_HEADER" not allowed while "strict subs" in use at t.cgi line 16.
      Bareword "WWW::Curl::Easy::CURLOPT_TIMEOUT" not allowed while "strict subs" in use at t.cgi line 17.

        You can fix that in one of two ways. Either use use (which is the simplest) or write instead WWW::Curl::CURLOPT_HEADER() and WWW::Curl::Easy::CURLOPT_TIMEOUT() to disambiguate them from barewords to function calls.

        Because use performs importing at compilation time, the parser knows that those functions are functions even without the parentheses. If you can't import those functions at compilation time, you'll have to disambiguate yourself or disable strict subs. (Don't disable strict subs.)