saravanakumar89 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, My aim to checkout folder from svn. I viewed many forms some of them i can't understand because i am new to perl.Please help me to fix the error. Please find the below error and my program.
Use of uninitialized value in subroutine entry at /usr/lib/perl5/vendo +r_perl/5.8.8/i386-linux-thread-multi/SVN/Client.pm line 927. Use of uninitialized value in concatenation (.) or string at /usr/lib/ +perl5/vendor_perl/5.8.8/i386-linux-thread-multi/SVN/Core.pm line 584. Bogus revision information given: at test3.pl line 22
#!/usr/bin/perl use SVN::Client; my $ctx = new SVN::Client( auth => [ SVN::Client::get_simple_provider(), SVN::Client::get_simple_prompt_provider( sub { my $cred = shift; my $user = "username"; my $pass = "password"; $cred->username($user); $cred->password($pass); }, 2 ), SVN::Client::get_username_provider() ] ); my $url = "svn://svn.test.net/test/test2"; my $path = "/test/"; my $revision = "WORKING"; $ctx->checkout($url, $path, $revision, $recursive) or die "error: $! " +;

Replies are listed 'Best First'.
Re: SVN:Client Check out error
by roboticus (Chancellor) on Jul 25, 2012 at 11:26 UTC

    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.

Re: SVN:Client Check out error
by prashantktyagi (Scribe) on Jul 25, 2012 at 10:01 UTC
Re: SVN:Client Check out error
by saravanakumar89 (Initiate) on Jul 26, 2012 at 13:23 UTC
    Hi Roboticus, I tried with debugger option. But not succeeded, Please don't mistake me. Can you please sample code, so that i can change my script. Sorry don't mistake me again. Thanks in advance. Regards, E.Saravana Kumar