Difference: TWikiNetDotPm (1 vs. 6)

Revision 62015-11-29 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

ObjectMethod finish ()

Break circular references.

ObjectMethod *registerExternalHTTPHandler (\&fn)

See TWikiFuncDotPm#RegisterExternalHTTPHandler

ObjectMethod *getExternalResource ($url,\@headers,\%params) -> $response

See TWikiFuncDotPm#GetExternalResource

ObjectMethod *postExternalResource ($url,$content,\@headers,\%params) -> $response

See TWikiFuncDotPm#PostExternalResource

ObjectMethod setMailHandler (\&fn)

  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.

Changed:
<
<

ObjectMethod sendEmail ($text,$retries) -> $error

>
>

ObjectMethod sendEmail ($text,$tries) -> $error

 
  • $text - text of the mail, including MIME headers
Changed:
<
<
  • $retries - number of times to retry the send (default 1)
>
>
  • $tries - number of times to try the send (default 1)
  Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

Revision 52013-10-14 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

ObjectMethod finish ()

Break circular references.

Changed:
<
<

@hea"> getExternalResource( $url, @headers ) -> $response

>
>

ObjectMethod *registerExternalHTTPHandler (\&fn)

 
Changed:
<
<
Get whatever is at the other end of a URL (using an HTTP GET request). Will
>
>
See TWikiFuncDotPm#RegisterExternalHTTPHandler
Deleted:
<
<
only work for encrypted protocols such as https if the LWP CPAN module is installed.
 
Deleted:
<
<
Note that the $url may have an optional user and password, as specified by the relevant RFC. Any proxy set in configure is honored.
 
Deleted:
<
<
Optional headers may be supplied of form 'name1', 'value1', 'name2', 'value2'. Do not add a User-Agent header, it will be added.
 
Changed:
<
<
The $response is an object that is known to implement the following subset of
>
>

ObjectMethod *getExternalResource ($url,\@headers,\%params) -> $response

Deleted:
<
<
the methods of LWP::Response. It may in fact be an LWP::Response object, but it may also not be if LWP is not available, so callers may only assume the following subset of methods is available:
code()
message()
header($field)
content()
is_error()
is_redirect()
 
Changed:
<
<
Note that if LWP is not available, this function:
>
>
See TWikiFuncDotPm#GetExternalResource
Deleted:
<
<
  1. can only really be trusted for HTTP/1.0 urls. If HTTP/1.1 or another protocol is required, you are strongly recommended to require LWP.
  2. Will not parse multipart content
 
Deleted:
<
<
In the event of the server returning an error, then is_error() will return true, code() will return a valid HTTP status code as specified in RFC 2616 and RFC 2518, and message() will return the message that was received from the server. In the event of a client-side error (e.g. an unparseable URL) then is_error() will return true and message() will return an explanatory message. code() will return 400 (BAD REQUEST).
 
Deleted:
<
<
Note: Callers can easily check the availability of other HTTP::Response methods as follows:
 
Changed:
<
<
>
>

ObjectMethod *postExternalResource ($url,$content,\@headers,\%params) -> $response

Deleted:
<
<
my $response = TWiki::Func::getExternalResource($url); if (!$response->is_error() && $response->isa('HTTP::Response')) { $text = $response->content(); # ... other methods of HTTP::Response may be called } else { # ... only the methods listed above may be called }
 
Added:
>
>
See TWikiFuncDotPm#PostExternalResource
 
Deleted:
<
<

setMailHandler( \&fn )

 
Added:
>
>

ObjectMethod setMailHandler (\&fn)

 
  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.
Added:
>
>
 

ObjectMethod sendEmail ($text,$retries) -> $error

  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

Revision 42012-10-07 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

ObjectMethod finish ()

Break circular references.

Changed:
<
<

getExternalResource( $url ) -> $response

>
>

@hea"> getExternalResource( $url, @headers ) -> $response

  Get whatever is at the other end of a URL (using an HTTP GET request). Will only work for encrypted protocols such as https if the LWP CPAN module is installed.

Note that the $url may have an optional user and password, as specified by

Changed:
<
<
the relevant RFC. Any proxy set in configure is honoured.
>
>
the relevant RFC. Any proxy set in configure is honored.
 
Added:
>
>
Optional headers may be supplied of form 'name1', 'value1', 'name2', 'value2'. Do not add a User-Agent header, it will be added.
 The $response is an object that is known to implement the following subset of the methods of LWP::Response. It may in fact be an LWP::Response object, but it may also not be if LWP is not available, so callers may only assume the following subset of methods is available:
code()
message()
header($field)
content()
is_error()
is_redirect()

Note that if LWP is not available, this function:

  1. can only really be trusted for HTTP/1.0 urls. If HTTP/1.1 or another protocol is required, you are strongly recommended to require LWP.
  2. Will not parse multipart content

In the event of the server returning an error, then is_error() will return true, code() will return a valid HTTP status code as specified in RFC 2616 and RFC 2518, and message() will return the message that was received from the server. In the event of a client-side error (e.g. an unparseable URL) then is_error() will return true and message() will return an explanatory message. code() will return 400 (BAD REQUEST).

Note: Callers can easily check the availability of other HTTP::Response methods as follows:

my $response = TWiki::Func::getExternalResource($url);
if (!$response->is_error() && $response->isa('HTTP::Response')) {
Changed:
<
<
... other methods of HTTP::Response may be called
>
>
$text = $response->content();
Added:
>
>
# ... other methods of HTTP::Response may be called
 } else {
Changed:
<
<
... only the methods listed above may be called
>
>
# ... only the methods listed above may be called
 }

setMailHandler( \&fn )

  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.

ObjectMethod sendEmail ($text,$retries) -> $error

  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

Revision 32008-01-22 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

Changed:
<
<

ObjectMethod getUrl ($protocol,$host,$port,$url,$user,$pass) -> $text

>
>

ObjectMethod finish ()

Added:
>
>
Break circular references.
 
Deleted:
<
<
Get the text at the other end of a URL
 
Added:
>
>

getExternalResource( $url ) -> $response

Get whatever is at the other end of a URL (using an HTTP GET request). Will only work for encrypted protocols such as https if the LWP CPAN module is installed.

Note that the $url may have an optional user and password, as specified by the relevant RFC. Any proxy set in configure is honoured.

The $response is an object that is known to implement the following subset of the methods of LWP::Response. It may in fact be an LWP::Response object, but it may also not be if LWP is not available, so callers may only assume the following subset of methods is available:

code()
message()
header($field)
content()
is_error()
is_redirect()

Note that if LWP is not available, this function:

  1. can only really be trusted for HTTP/1.0 urls. If HTTP/1.1 or another protocol is required, you are strongly recommended to require LWP.
  2. Will not parse multipart content

In the event of the server returning an error, then is_error() will return true, code() will return a valid HTTP status code as specified in RFC 2616 and RFC 2518, and message() will return the message that was received from the server. In the event of a client-side error (e.g. an unparseable URL) then is_error() will return true and message() will return an explanatory message. code() will return 400 (BAD REQUEST).

Note: Callers can easily check the availability of other HTTP::Response methods as follows:

my $response = TWiki::Func::getExternalResource($url);
if (!$response->is_error() && $response->isa('HTTP::Response')) {
    ... other methods of HTTP::Response may be called
} else {
    ... only the methods listed above may be called
}
 

setMailHandler( \&fn )

  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.

ObjectMethod sendEmail ($text,$retries) -> $error

  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

Revision 22007-01-16 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

Changed:
<
<

ObjectMethod getUrl ($host,$port,$url,$user,$pass,$header) -> $text

>
>

ObjectMethod getUrl ($protocol,$host,$port,$url,$user,$pass) -> $text

  Get the text at the other end of a URL

setMailHandler( \&fn )

Added:
>
>
 
  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.

ObjectMethod sendEmail ($text,$retries) -> $error

Added:
>
>
 
  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

Revision 12006-02-01 - TWikiContributor

 

Package =TWiki::Net

Object that brokers access to network resources.

ObjectMethod getUrl ($host,$port,$url,$user,$pass,$header) -> $text

Get the text at the other end of a URL

setMailHandler( \&fn )

  • \&fn - reference to a function($) (see _sendEmailBySendmail for proto)
Install a handler function to take over mail sending from the default SMTP or sendmail methods. This is provided mainly for tests that need to be told when a mail is sent, without actually sending it. It may also be useful in the event that someone needs to plug in an alternative mail handling method.

ObjectMethod sendEmail ($text,$retries) -> $error

  • $text - text of the mail, including MIME headers
  • $retries - number of times to retry the send (default 1)

Send an email specified as MIME format content. Date: ...\nFrom: ...\nTo: ...\nCC: ...\nSubject: ...\n\nMailBody...

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiNetDotPm.