---
name: "HTML::Template::Compiled::Utils"
section: "3pm"
platform: "linux"
package: "libhtml-template-compiled-perl"
version: "1.003-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/HTML::Template::Compiled::Utils"
---

# HTML::Template::Compiled::Utils(3pm)

Utility functions for HTML::Template::Compiled

## NAME

HTML::Template::Compiled::Utils - Utility functions for HTML::Template::Compiled

## SYNOPSIS

```
 # import log() and stack()
 use HTML::Template::Compiled::Utils qw(:log);
 # import the escapign functions
 use HTML::Template::Compiled::Utils qw(:escape);
```

## DEBUGGING FUNCTIONS

### stack

```
    $self->stack;
```

For HTML::Template:Compiled developers, prints a stack trace to STDERR.

### md5

```
 md5($text)
```

If Digest::MD5 is installed, returns the md5\_base64 for `$text`, otherwise returns the empty string.

### log

```
 $self->log(@msg)
```

For HTML::Template::Compiled developers, print log from `@msg` to STDERR.

## ESCAPING FUNCTIONS

### escape\_html

```
  my $escaped_html = escape_html($raw_html);
```

HTML-escapes the input string (only &, ", single quotes, `"<"` and `""`\> and returns it;

### escape\_html\_all

```
  my $escaped_html = escape_html_all($raw_html);
```

HTML-escapes the input string (with HTML::Entities) and returns it;

### escape\_uri

```
  my $escaped_uri = escape_uri($raw_uri);
```

URI-escapes the input string and returns it;

### escape\_js

```
  my $escaped_js = escape_js($raw_js);
```

JavaScript-escapes the input string and returns it;

### escape\_ijson

```
  my $escaped_js = escape_ijson($raw_js);
```

JavaScript-escapes the input string except for the apostrophe and returns it, so it can be used within a JSON element.
