Hi all, I'm new in perl. I just want to read a file on svn repository.

The doc (SVN::Client) says :

$ctx->cat(\*FILEHANDLE, $target, $revision, $pool); Outputs the content of the file identified by $target and $revision to the FILEHANDLE. FILEHANDLE is a reference to a filehandle.

When I put \*STDOUT it works. But I want to put the content of the $target to an array. I searched few hours on internet to find any example without success :(. With this code I have this error message : Bareword "FILE" not allowed while "strict subs" in use at script.pl line 16. Execution of script.pl aborted due to compilation errors.

#!/usr/bin/perl use 5.014; use strict; use warnings; use SVN::Client; my $ctx = new SVN::Client( auth => [SVN::Client::get_simple_provider(), SVN::Client::get_simple_prompt_provider(\&simple_prompt,2), SVN::Client::get_username_provider()] ); $ctx->cat(FILE, 'http://127.0.0.1/file.txt','HEAD'); my @text = <FILE>; sub simple_prompt { my $cred = shift; my $realm = shift; my $default_username = shift; my $may_save = shift; my $pool = shift; print "Enter authentication info for realm: $realm\n"; print "Username: "; my $username = <>; chomp($username); $cred->username($username); print "Password: "; my $password = <>; chomp($password); $cred->password($password); }
Thanks a lot!

In reply to Use SVN::Client to "cat" a file on svn by fouinix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.