Cac::Util - Various utitity functions for Cache


Cac documentation Contained in the Cac distribution.

Index


Code Index:

NAME

Top

Cac::Util - Various utitity functions for Cache

SYNOPSIS

Top

  use Cac::Util;




DESCRIPTION

Top

This module contains various utility functions.

FUNCTIONS

Top

The following functions (which are exported) exist:

compileMAC $name, @lines
 Compiles Routine $name.

 Actually, this function is a good example on Cache-Perl
 programming, so it's included here for reference:

 sub compileMAC($@) {
     my ($rtn, @lines) = @_;
     my $size = length join "", @lines;
     unshift @lines, scalar @lines;
     Gset  "rMAC", $rtn, 0, CacEval '$h';
     GsetA "rMAC", $rtn, 0, \@lines;
     GsetH "rMAC", $rtn, 0, { LANG =>  "", SIZE => $size };
     Do 'COMPILE', '%RCOMPIL', $rtn, 'MAC';
     die "Routine compilation failed for '$rtn'" unless defined Gget "rOBJ", $rtn;
 }




EXPORTS

Top

 none.

BUGS

Top

 Arround version 0.22 I stopped counting.

SEE ALSO

Top

Cac, Cac::ObjectScript, Cac::Global, Cac::Routine, Cac::Bind.

AUTHOR

Top

 Stefan Traby <stefan@hello-penguin.com>
 http://hello-penguin.com


Cac documentation Contained in the Cac distribution.
package Cac::Util;

use 5.006;
use strict;
use warnings;
use bytes;
  
require Exporter;
use AutoLoader qw(AUTOLOAD);

our @ISA = qw(Exporter);
our @EXPORT_OK = qw( &compileMAC );
our @EXPORT = @EXPORT_OK;
our $VERSION = 1.83;

use Cac::Routine;
use Cac::Global;
use Cac "CacEval";

sub compileMAC($@) {
   my ($rtn, @lines) = @_;
   my $size = length join "", @lines;
   unshift @lines, scalar @lines;
   Gset  "rMAC", $rtn, 0, CacEval '$h';
   GsetA "rMAC", $rtn, 0, \@lines;
   GsetH "rMAC", $rtn, 0, { LANG => "", SIZE => $size };
   Do 'COMPILE', '%RCOMPIL', $rtn, 'MAC';
   die "Routine compilation failed for '$rtn'" unless defined Gget "rOBJ", $rtn;
}

1;
__END__