login about faq

When I run this Perl code, I get a runtime usage error on the line that calls get_LastErrorText.

      my $success = $mailman->SendEmail($email);
      unless($success) {
          print "Error: " . $mailman->get_LastSmtpStatus() . "\n";
          print "Error: " . $mailman->get_LastErrorText() . "\n";

I'm not reading something right in terms of getting LastErrorText?

asked Oct 10 '12 at 11:16

chilkat's gravatar image

chilkat ♦♦

The Chilkat classes / objects have a convention for string properties in the API's for C++, Perl, Java, Python, PHP, Ruby, etc. (but not for .NET, ActiveX, and Objective-C)

For the getter, there are two forms:

1) The form that returns a string. In this form, the property is represented as a function where the first letter is lowercase, and it return a string (or "const char *" in C++). For example:

    print $mailman->lastErrorText() . "\n";

2) The 2nd form is where the result is returned in a CkString object that is passed as the argument to the get_<prop_name> method. The CkString is an output-only arg, meaning that whatever contents it may have held will be discarded and replaced with the value of the string property. For example:

$mailman = new chilkat::CkMailMan();
$errTxt = new chilkat::CkString();
. . .
print $errTxt->getString() . "\n";

The error in the code snippet above is that you are trying to use the 2nd form to return a string. The correction is to replace "get_LastErrorText" with "lastErrorText".


answered Oct 10 '12 at 11:27

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 10 '12 at 11:16

Seen: 922 times

Last updated: Oct 10 '12 at 11:27

powered by OSQA