in reply to Having trouble running query in ClearCase OLE interface

I don't understand this bit: $count = @CheckedOutFiles->Count();. If you are sure that Apply() returns a list of the checked out files in list context, then how about just $count = @CheckedOutFiles;? It is also possible that it returns an object, perhaps an iterator, in which case you may need
my ($CheckedOutFiles, $count); $CheckedOutFiles = $COQuery->Apply(); $count = $CheckedOutFiles->Count();
(None of this has been tested). HTH.

Replies are listed 'Best First'.
Re^2: Having trouble running query in ClearCase OLE interface
by Anonymous Monk on Nov 02, 2006 at 18:03 UTC
    I am trying to translate from a VBS program.
    Following is the applicable portion of that script.
    Dim objCC Set objCC = Wscript.CreateObject("ClearCase.Application") Dim COQuery Set COQuery = objCC.CreateCheckedOutFileQuery Dim CheckedOutFiles Set CheckedOutFiles = COQuery.Apply Dim strMsg strMsg = CheckedOutFiles.Count & " files are checked out: "
    This works well in VBS.
    The COQuery.Apply works like an SQL command in that it populates
    a table with a list of checked-out files. The count command returns
    a list of those checked-out files.
    The really unfortunate thing is that all of ClearCase's examples
    are in VBS. I would MUCH rather be using Perl.

      I would bet that COQuery->Apply returns an array, which you then assign to a standard perl array, @CheckedOutFiles.

      Perl arrays don't have a method called "Count".

      You probably want:

      print scalar @CheckedOutFiles . " files are checked out: "


      --chargrill
      s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
        That's an excellent idea.
        I'll give it a try.
      Did you try the $CheckedOutFiles idea above?