# perldoc > Authen::SASL::Perl

---
type: CommandReference
command: Authen::SASL::Perl
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `Authen::SASL->new(mechanism => 'CRAM-MD5 PLAIN ANONYMOUS', callback => { user => $user, pass => \&fetch_password })` — create a SASL client object with Perl implementation
- `$sasl->client_start($service, $host)` — initiate SASL authentication
- `$sasl->client_step($challenge)` — respond to a challenge
- `$sasl->mechanism` — get the negotiated mechanism name

## Name

`Authen::SASL::Perl` — Perl implementation of the SASL Authentication framework

## Synopsis

perl
use Authen::SASL qw(Perl);

$sasl = Authen::SASL->new(
  mechanism => 'CRAM-MD5 PLAIN ANONYMOUS',
  callback => {
    user => $user,
    pass => \&fetch_password
  }
);
## Options

### Client mechanisms

- **ANONYMOUS** — anonymous access (RFC 2245 / draft-ietf-sasl-anon-03). No authentication; no confidential information sent.
- **CRAM-MD5** — challenge-response (RFC 2195). No plaintext passwords. Susceptible to replay/dictionary attacks; prefer DIGEST-MD5.
- **DIGEST-MD5** — HTTP Digest Access Authentication as SASL (RFC 2831 / draft-ietf-sasl-rfc2831bis). Prevents chosen plaintext attacks; supports third-party authentication servers. Recommended over CRAM-MD5.
- **EXTERNAL** — external authentication (RFC 2222).
- **GSSAPI** — Generic Security Service API (Kerberos V5) (RFC 2222 / draft-ietf-sasl-gssapi).
- **LOGIN** — username + cleartext password (draft-murchison-sasl-login). No security layer; avoid without encryption.
- **PLAIN** — username + cleartext password (RFC 2595 / draft-ietf-sasl-plain). No security layer; avoid without encryption.

### Server mechanisms (only PLAIN, LOGIN, DIGEST-MD5 supported)

- **DIGEST-MD5** server options (`server_new` hashref):
  - `no_integrity` — disable integrity layer
  - `no_confidentiality` — disable confidentiality layer

## Examples

No examples provided in the original documentation.

## See Also

[Authen::SASL](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL/markdown), [Authen::SASL::Perl::ANONYMOUS](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3AANONYMOUS/markdown), [Authen::SASL::Perl::CRAM_MD5](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3ACRAMMD5/markdown), [Authen::SASL::Perl::DIGEST_MD5](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3ADIGESTMD5/markdown), [Authen::SASL::Perl::EXTERNAL](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3AEXTERNAL/markdown), [Authen::SASL::Perl::GSSAPI](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3AGSSAPI/markdown), [Authen::SASL::Perl::LOGIN](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3ALOGIN/markdown), [Authen::SASL::Perl::PLAIN](https://www.chedong.com/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl%3A%3APLAIN/markdown)