---
name: "Badger::Codec::YAML"
section: "3pm"
platform: "linux"
package: "libbadger-perl"
version: "0.16-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Badger::Codec::YAML"
---

# Badger::Codec::YAML(3pm)

encode/decode data using YAML

## NAME

Badger::Codec::YAML - encode/decode data using YAML

## SYNOPSIS

```
    use Badger::Codec::YAML;
    my $codec   = Badger::Codec::YAML->new();
    my $encoded = $codec->encode("Hello World");
    my $decoded = $codec->decode($encoded);
```

## DESCRIPTION

This module implements a subclass of Badger::Codec which uses the YAML module to encode and decode data to and from YAML.

## METHODS

### encode($data)

Encodes `$data` to YAML.

```
    $encoded = Badger::Codec::YAML->encode($data);
```

### decode($data)

Decodes `$data` from YAML.

```
    $decoded = Badger::Codec::YAML->decode($encoded);
```

### encoder()

This method returns a reference to the real subroutine that's doing all the encoding work, i.e. the `"Dump()"` subroutine in YAML.

### decoder()

This method returns a reference to the real subroutine that's doing all the decoding work, i.e. the `"Load()"` subroutine in YAML.

## AUTHOR

Andy Wardley \<http://wardley.org/\>

## COPYRIGHT

Copyright (C) 2005-2009 Andy Wardley. All rights reserved.

## SEE ALSO

Badger::Codecs, Badger::Codec, YAML
