saravanakumar89:
When you see the error "Use of uninitialized value", it simply means that a variable has no value (i.e. is undef). So when a third party module spits out that error message it generally means something like:
- You didn't initialize a variable.
This is very common--run your program under the debugger and examine the variables at various points in the program to verify that they contain the values you expect.
- Object creation failed somehow.
For example, your line my $ctx = new SVN::Client(...) may have failed, and $ctx might have nothing in it. For some trivial functions it isn't important to check the value returned to you. But for complex functions, or functions that set up the primary conditions for your application, you'll want to add some code to check the return value to ensure that you don't proceed with garbage values.
- You passed an unexpected value to a routine, confusing it.
For this, you'll want to review the arguments of the call and compare to the documentation to see if you can find something unusual.
There are other conditions that can lead to this error as well--I just can't think of them off the top of my head. If you learn how to use the debugger, though, you'll be able to track these errors down, and you can often learn quite a bit faster: Rather than spending the time adding and removing print statements, you can tweak values and continue, letting you get through your code faster. Using the debugger can help you learn a lot more about the internals of a third-party module as well. While you can read the code, sometimes you'll run into a bit where it's difficult to interpret exactly what's happening. Using the debugger, you can see the before and after result and get a good bit more insight.
Update: Added "to a" to third bullet point, allowing the sentence to make sense...
...roboticus
When your only tool is a hammer, all problems look like your thumb.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.