Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3614568
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:15:54+00:00 2026-05-18T22:15:54+00:00

I have a ClearQuest API script written in Perl. If I do this: #print

  • 0

I have a ClearQuest API script written in Perl. If I do this:

#print qq(DEBUG: Buildsheet ID is "$buildsheetId"\n);
$cq->SetNameValue("ParentBuildSheetID", $buildsheetId);

#
# Now Create the Record Type and Fill in the Fields
#
my $record;
eval { $record = $cq->BuildEntity(TASK_RECORD_TYPE); };
if ($@) {
    croak qq(Error when attempting to create record type ")
    . TASK_RECORD_TYPE . qq("\n$@\n);
}
if (not $record) {
    die qq(Cannot create entity ") . TASK_RECORD_TYPE . qq("\n);
}

I get the following error:

ST(2) does not contain a string. at D:/Program Files/Rational/Common/lib/perl5/site_perl/5.8.6/CQPerlExt.pm line 43.

I traced this error message (THX CQ for not mentioning where in MY script where the error occurred) to this line:

$cq->SetNameValue("ParentBuildSheetID", $buildsheetId);

Hmmm… Maybe I didn’t set $buildsheetId. Let me check by printing out the DEBUG statement preceding where I set it:

print qq(DEBUG: Buildsheet ID is "$buildsheetId"\n);
$cq->SetNameValue("ParentBuildSheetID", $buildsheetId);

#
# Now Create the Record Type and Fill in the Fields
#
my $record;
eval { $record = $cq->BuildEntity(TASK_RECORD_TYPE); };
if ($@) {
    croak qq(Error when attempting to create record type ")
    . TASK_RECORD_TYPE . qq("\n$@\n);
}
if (not $record) {
    die qq(Cannot create entity ") . TASK_RECORD_TYPE . qq("\n);
}

(NOTE: Same code as above, but with previous print debugging statement enabled.)

Now it works!

Why does it work by merely printing out the value? This isn’t the only place where I have this issue:

print qq(DEBUG: \$buildsheetId = "$buildsheetId"\n);
my $record = $cq->GetEntity(BSHEET_RECORD_TYPE, $buildsheetId);

Again, GetEntity fails unless I print out the variable $buildsheetId.

Why does it matter if I print out the Perl value of a variable before I do a ClearQuest API call?


UPDATE

Here’s the entire output of my script:

H:\>addTask.cqpl -user WeintraubH -pass Cape01may -buildsheet 5618 -task cm  
DEBUG: Buildsheet ID is "5618"
Subroutine NoteEntryInit redefined at (eval 1) line 850.
Subroutine SetLog redefined at (eval 1) line 1084.
DEBUG: $buildsheetId = "5618"

Note that my script is only 559 lines long, so the Subroutine errors aren’t from my program. However, the two DEBUG: lines are. One is before creating the BuildEntity method and another before a GetEntity method. I’ll have to trace down where those Subroutine redefined lines are coming from. I take it they’re some sort of VB CQ hook running.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:15:55+00:00Added an answer on May 18, 2026 at 10:15 pm

    See if doing this helps (remove the debug print):

    $cq->SetNameValue("ParentBuildSheetID", $buildsheetId . "");
    

    or

    $cq->SetNameValue("ParentBuildSheetID", "$buildsheetId");
    

    If it works, your problem was that somehow, your API checks if a value is an int or a string (I’m assuming that ClearQuest innards are in C, not pure Perl, so there’s a difference in terms of how your value was created – see http://www.sdsc.edu/~moreland/courses/IntroPerl/docs/manual/pod/perlguts.html#Working_with_SVs ).

    By either quoting the variable or appending an empty string, you convert it into an expected string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.