On Jun 25, 2008, at 2:30 PM, Laker Netman wrote:
> ----- Original Message ----
>> From: Ryan Schmidt <subversion-2008b_at_ryandesign.com>
>> To: Laker Netman <laker_netman_at_yahoo.com>
>> Cc: users_at_subversion.tigris.org
>> Sent: Wednesday, June 25, 2008 12:56:38 PM
>> Subject: Re: Newline in return value from propget, is it a bug?
>>
>> On Jun 25, 2008, at 10:30 AM, Laker Netman wrote:
>>
>>> I'm running Subversion 1.4.6 and checked the bug tracker under
>>> "propget", but didn't find anything relevent. I am having an issue
>>> where testing a value being returned by propget in a post-commit
>>> perl script always fails. The example below explains what is
>>> happening.
>>>
>>> Here is my test script:
>>> my $repos = $ARGV[0];
>>> my $wcLoc = $ARGV[1];
>>> $wcType = `svn propget wcType svn://repoServer/$repos/$wcLoc`;
>>> my $updateType = $wcType eq "support" ? "" : $wcLoc eq
>>> "branches" ? "alpha" : "beta";
>>> print "WC type=\"$wcType\" and WC location=\"$wcLoc\" therefore
>>> updateType=\"$updateType\"\n";
>>>
Snip ...
> Yeah, I can understand from a formatting standpoint it helps, but
> personally, I would consider it a bug. IMHO, and based on good
> programming practices related to any function result, the return
> value from propget should not be adulterated in any way.
>
> I'll work around it for now, but I think I'll submit a bug report
> and see what happens.
>
Given that you are capturing output from a command-line tool this
seems perfectly normal. In these cases, I would just add the
following line after you've run your backticks command:
chomp($wcType);
It removes the '/n' if it exists, otherwise it leaves the string
alone. I use this any time I need to execute a command with backticks.
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-06-25 21:12:21 CEST