Help with a script

Posted on 2006-05-30
Last Modified: 2008-03-10
I have not used Perl in a long while and need to debug a small script.
use Sybase::CTlib;
use FileHandle;
use Net::FTP;
use Net::FTP::Common;

$year = $year - 0 + 1900;
$mon = $mon - 0 + 1;
$delim = "|";
$dbname = "SDAPS";
$dbh = new Sybase::CTlib $DBUSER, $DBPWD, $DBSERVER;

$dbh->ct_execute("select convert(varchar,max(entrydate),112) as rundate from $dbname..fxrates");
while($dbh->ct_results($restype) == CS_SUCCEED) {
   next unless $dbh->ct_fetchable($restype);
   while(@dat = $dbh->ct_fetch) { $rundate=$dat[0];}      

Now from my limited memory, this sets up a connection to a Sybase database and retrieves a date into a variable $rundate. How can I check if the connection is established? What is a syntax for a message box?
Question by:leonstryker
    LVL 8

    Expert Comment

    this line:

    $dbh = new Sybase::CTlib $DBUSER, $DBPWD, $DBSERVER;

    might be better written as:

    $dbh = Sybase::CTlib->new( $DBUSER, $DBPWD, $DBSERVER)

    I'm not familiar with the module but you can always read the docs online if you don't have a local copy to read:;

    There is a section called "general information" that discusses error handling.

    I don't know what you mean by: "what is a syntax for a message box?".
    LVL 29

    Author Comment

    >I don't know what you mean by: "what is a syntax for a message box?".

    Hmm, I am running this on NT with WSH so I was hoping to bring up a message box with the value of a variable, just to see its contents.
    LVL 39

    Accepted Solution

    To see the value of a variable, i usually use print.  This way, you can redirect STDOUT, and have file showing everything: > output.txt

    But, if you want a message box:
    put this at the top:
        use Win32;

    Then use this to display a message box

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Title # Comments Views Activity
    Perl Interpretation Help 6 98
    Learning to program 1 86
    Perl Tutorial 6 121
    Question about @INC variable in perl 1 45
    On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now