[p4perl] Error/Warning management of perforce "files" command
Tony Smith
tony at perforce.com
Wed Aug 17 07:02:36 PDT 2005
Hi Cédric,
> I used the version 3.4804 of p4perl.
> I download it again recently to install it on another computer, and
> launch the scripts i wrote with an (it seems) older version of p4perl
> (but still labelized 3.4804).
>
> So my first question is to know if yes or no it exist different version
> of the same release ?
I've re-run every version of the installer I've produced since 3.4804 with
both Perl 5.6 and 5.8 and I can only find one 3.4804 build so I think the
answer to that question is no.
> I say that, because I used the following code to detect if some files
> exist under a label, and it does not work anymore.
>
> $p4->Run("files", $perforcePath."/...@".$perforceLabel) ;
> unless($p4->ErrorCount())
> {
> //synchronize to $perforceLabel
> }
> else
> {
> //synchronize an other path
> }
>
> My issue appear when files return an empty list... When calling the
> command in perforce directly it return :
> //my/path/... at MyLabel - no such file(s).
>
> It seems that previously it was recognized by p4perl as an Error, and
> now it is a Warning. So I have to change my code as follow:
>
> $p4->Run("files", $perforcePath."/...@".$perforceLabel) ;
> unless($p4->ErrorCount() || $p4->WarningCout())
> {
> //synchronize to $perforceLabel
> }
> else
> {
> //synchronize an other path
> }
>
>
> So i just want to know if my intuition are good or not. Because if I am
> wrong, it means that my system is wrong however it seemed to work.
No, it's something else. The behaviour you describe was introduced in a later
build. Here's the note from the Changes file:
3.4856 Wed Mar 15 2005
- Rework P4::Errors() and P4::Warnings() so that they return a list
rather than an array. Perl seems to like this more and it's easy
to assign the list to an array should you wish to do so.
Note that this may cause some backwards-compatibility issues.
So, I think you're running at least build 3.4856 and possibly later. You might
want to search for P4.pm and see if there are perhaps two versions installed.
I don't know why that would be, but it's worth checking...
Regards,
Tony
More information about the p4perl
mailing list