Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How to pass variable in the LWP module

by 1nickt (Canon)
on Jun 30, 2015 at 11:59 UTC ( [id://1132608]=note: print w/replies, xml ) Need Help??


in reply to How to pass variable in the LWP module

Hello Bhushan,

  1. "Learn about strings and interpolating double quotes."
  2. Don't continue until you have completed #1.
  3. "Build your string outside the call to ->content()."
  4. Don't continue until you have completed #3.
  5. Use Data::Dumper to see what is in the variables. It may not be what you think. Like:
    use strict; use warnings; use Data::Dumper; use feature qw/ say /; my $string; # your code here to build a complex string say Dumper( $string );
  6. Don't continue until you have completed #5.

In general, it looks like you are rushing too much to try to make your scripts accomplish your ultimate goal, without learning the steps necessary to get there. I suggest that you try to learn some basics about Perl programming before trying to do relatively complex tasks like speaking JSON to a remote server. Have you worked through any Perl tutorials?

There are no shortcuts to becoming an effective programmer. You might be able to find out how to do what you want with a question on PerlMonks or Stack Exchange, but if you don't understand what it is that you are doing and why it works, you will not be able to fix it when it breaks or extend it when $boss wants a new feature.

The requirements of your ($boss, $job) might mean that you just have to get It working Now ... we've all been there. But then you have to spend many many hours practicing the basic techniques in an environment that is _not_ your live project, in order to really learn what is going on.

One effective technique is to get a script or a piece of code that works, from here or from somewhere else, then "reverse engineer" it to see how it works. Start commenting out lines and reducing the complexity of the code, all the way down so it simply compiles, with no function. Then start adding the lines back in one by one, not advancing until you understand. Reduce the data to the simplest it can be (eg just one element in an array) ... just make the simplest script you can. Gradually you can build the complexity back in.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1132608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-23 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found