Tripletail

 view release on metacpan or  search on metacpan

ext/Tripletail-HtmlFilter/HtmlFilter.pm  view on Meta::CPAN

    }
  }
}

1;

sub _new {
    my $class = shift;
    my $opts = { @_ };

	my $this = bless [] => $class;

	$this->[INTEREST]       = $opts->{interest};
	$this->[TRACK]          = $opts->{track};
	$this->[FILTER_TEXT]    = $opts->{filter_text};
	$this->[FILTER_COMMENT] = $opts->{filter_comment};
	
    $this->[CONTEXT]        = Tripletail::HtmlFilter::Context->_new;
    $this->[HTML]           = undef; # 文字列
    $this->[OUTPUT]         = []; # Tripletail::HtmlFilter::{Element,Text,Comment}

ext/Tripletail-HtmlFilter/HtmlFilter.pm  view on Meta::CPAN

use constant {
	IN      => 0,
	ADDED   => 1,
	DELETED => 2,
	CURRENT => 3,
};

sub _new {
    my $class = shift;

    my $this = bless [] => $class;
    $this->[IN] = [];
    $this->[ADDED] = [];
    $this->[DELETED] = undef;
    $this->[CURRENT] = undef; # Tripletail::HtmlFilter::{Element,Comment,Text}

    $this;
}

sub newElement {
    my $this = shift;

ext/Tripletail-HtmlFilter/HtmlFilter.pm  view on Meta::CPAN

our @ISA = qw(Tripletail::HtmlFilter::ElementBase);

sub _new {
    my $class = shift;
    my $name = shift; # undef可

    if (ref $name) {
		die __PACKAGE__."#_new, ARG[1] was bad Ref. [$name]\n";
    }

    my $this = bless [] => $class;
    $this->[NAME] = $name;
    $this->[ATTRS] = []; # [[key, val], [key, val], ...]
    $this->[ATTR_H] = {}; # key => [key, val] ($this->[ATTRS]の要素と共有)
    $this->[TAIL] = undef;

    $this;
}

sub name {
	# 注意: このメソッドは XS 側では使用されない。

ext/Tripletail-HtmlFilter/HtmlFilter.pm  view on Meta::CPAN

package Tripletail::HtmlFilter::Text;
use constant {
	STR => 0,
};
our @ISA = qw(Tripletail::HtmlFilter::ElementBase);

sub _new {
    my $class = shift;
    my $str = shift;

    my $this = bless [] => $class;
    $this->[STR] = $str;

    $this;
}

sub str {
    my $this = shift;
    if (@_) {
		$this->[STR] = shift;

lib/Tripletail/CSV.pm  view on Meta::CPAN

use IO::Handle ();
use IO::Scalar ();
use version 0.77;


1;

sub _new {
	my $class = shift;

	my $this = bless {} => $class;

	eval {
		require Text::CSV_XS;
	};
	if ($@) {
		die __PACKAGE__."#new: Text::CSV_XS is unavailable. (Text::CSV_XSが使用できません)\n";
	}

	my $opts = do {
		if (Text::CSV_XS->VERSION >= version->parse('1.02')) {

lib/Tripletail/CSV.pm  view on Meta::CPAN


package Tripletail::CSV::Parser;
use strict;
use warnings;

sub _new {
	my $class = shift;
	my $csv = shift;
	my $fh = shift;

	my $this = bless {} => $class;
	$this->{csv} = $csv;
	$this->{fh} = $fh;

	$this;
}

sub next {
	my $this = shift;

	if ($this->{fh}->eof) {

lib/Tripletail/CharConv.pm  view on Meta::CPAN

    }
    else {
        # 両方ともサポート外
        my $utf8 = Encode::find_encoding($from)->decode($str);
        return Encode::find_encoding($to)->encode($utf8);
    }
}

sub __new {
    my $class = shift;
    my $this  = bless {} => $class;

    return $this;
}


__END__

=encoding utf-8

=for stopwords

lib/Tripletail/DB.pm  view on Meta::CPAN

		\&__term,
	);

	undef;
}

sub _new {
	my $class = shift;
	my $group = shift;

	my $this = bless {} => $class;
	$this->{group}     = $group;
	$this->{namequery} = $TL->INI->get($group => 'namequery' => undef);
	$this->{autoreyry} = $TL->INI->get($group => 'autoretry' => undef);
	$this->{type}      = $TL->INI->get($group => 'type');

	$this->{bufsize} = undef; # 正の値でなければ無制限
	$this->{types_symtable} = \%Tripletail::DB::SQL_TYPES::;

	$this->{dbh} = {};    # {DBセット名 => Tripletail::DB::Dbh}
	$this->{dbname} = {}; # {DBコネクション名 => Tripletail::DB::Dbh}

lib/Tripletail/DB/Dbh.pm  view on Meta::CPAN

package Tripletail::DB::Dbh;
use strict;
use warnings;
use Hash::Util qw(lock_hash);

sub new {
    my $class   = shift;
    my $setname = shift;
    my $dbname  = shift;

    my $this = bless {} => $class;
    $this->{setname } = $setname;
    $this->{inigroup} = $dbname;
    $this->{dbh     } = undef; # DBI-dbh
    $this->{type    } = undef; # set on connect().

    $this;
}

sub getSetName {
    return shift->{setname};

lib/Tripletail/DB/Sth.pm  view on Meta::CPAN

use warnings;
use Tripletail;
use Scalar::Lazy;
my $STH_ID = 0;

sub new {
	my $class = shift;
	my $db = shift;
	my $dbh = shift;
	my $sth = shift;
	my $this = bless {} => $class;

	$this->{db_center} = $db; # Tripletail::DB
	$this->{dbh} = $dbh; # Tripletail::DB::DBH
	$this->{sth} = $sth; # native sth
	$this->{ret} = undef; # last return value
	$this->{id} = $STH_ID++;

	$this;
}

lib/Tripletail/Debug.pm  view on Meta::CPAN

		$_INSTANCE = $class->__new(@_);
	}

	$_INSTANCE;
}


sub __new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	$this->{group} = defined $group ? $group : 'Debug';
	$this->{enabled} = $TL->INI->get($this->{group} => enable_debug => undef);
	$this->{popup_type} = $TL->INI->get($this->{group} => 'popup_type', 'none');

	$this->{warn_logging} = $TL->INI->get($this->{group} => 'warn_logging', 1);
	$this->{warn_popup} = $TL->INI->get($this->{group} => 'warn_popup', 1);

	$this->{log_popup} = $TL->INI->get($this->{group} => 'log_popup', 1);

lib/Tripletail/Error.pm  view on Meta::CPAN

# $TL->newError($type, $msg);
# $TL->newError($type, $msg, $title);
#
sub _new {
	# スタックトレースを持った例外オブジェクトを生成する。
	# 返されたインスタンスは "" 演算子によって文字列化が可能である。
	my $class = shift;
	my $type = shift; # 'error' / 'warn' / 'file-update' / 'memory-leak'
	my $msg = shift; # $@
	my $title = shift; # 任意の文字列
	my $this = bless {} => $class;

	$this->{message} = $msg;
	$this->{type} = $type;
	$this->{title} = $title || "Error: $msg";
	$this->{frames} = []; # Tripletail::Error::Frame
	$this->{source} = {}; # ファイルパス => 中身
	$this->{show_trace} = undef;
	$this->{show_vars}  = undef;
	$this->{show_src}   = undef;
	$this->{suppress_internal} = 1;

lib/Tripletail/Error.pm  view on Meta::CPAN

			$i + 1, sprintf('%5d |  %s', $i + 1, $lines[$i]));
	}
}

package Tripletail::Error::Frame;
use strict;
use warnings;

sub new {
	my $class = shift;
	my $this = bless {} => $class;

	$this->{level}  = shift;
	$this->{fpath}  = shift;
	$this->{line}   = shift;
	$this->{func}   = shift;
	$this->{vars}         = {}; # '$foo' => 666
	$this->{vars_shallow} = {}; # '$doo' => 'ARRAY(0x81940f8)'
	$this;
}

lib/Tripletail/FileSentinel.pm  view on Meta::CPAN

	foreach ( @targets ) {
		$TL->log(__PACKAGE__, " autoWatch(): $_");
		$this->watch($_);
	}

	$this;
}

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	$this->{lastmod} = {}; # {file path => epoch}

	if(defined($0)) {
		$this->watch($0);
	}
	my $filename = $TL->INI->getFilePath;
	if(defined($filename)) {
		$this->watch($filename);
	}

lib/Tripletail/Filter.pm  view on Meta::CPAN

# -----------------------------------------------------------------------------
package Tripletail::Filter;
use strict;
use warnings;
use Tripletail;

1;

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	# 既にヘッダを出力したかどうか
	$this->{header_flushed} = undef;

	# 置換するヘッダ(setHeaderで設定されたもの)
	$this->{replacement} = {}; # {キー => 値}

	# 追加するヘッダ(addHeaderで設定されたもの)
	$this->{addition} = {}; # {キー => [値, ...]}

lib/Tripletail/InputFilter.pm  view on Meta::CPAN

# -----------------------------------------------------------------------------
package Tripletail::InputFilter;
use strict;
use warnings;
use Tripletail;

1;

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	$this;
}

sub _formFromPairs {
	# 戻り値: Tripletail::Form
	my $this = shift;
	my $pairs = shift;
	my $filename_h = shift;

lib/Tripletail/MemCached.pm  view on Meta::CPAN

# -----------------------------------------------------------------------------
package Tripletail::MemCached;
use Tripletail;
use strict;
use warnings;

1;

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	my @servers;

	$this->{servers} = $TL->INI->get('MemCached' => servers => undef);
	if(!defined($this->{servers})) {
		push(@servers,'localhost:11211');
	} else {
		foreach my $tmp (split(/\s+/, $this->{servers})) {
			push(@servers,split(/\s?,\s?/, $tmp));
		}

lib/Tripletail/MemorySentinel.pm  view on Meta::CPAN

}

sub __install {
	my $this = shift;

	$TL->setHook('postRequest', _HOOK_PRIORITY, sub { $this->__postRequest });
}

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	$this->{getmemfunc} = undef; # メモリ使用量を取得する為の関数。'NONE'なら存在しない。
	$this->{getmemfh} = undef;
	$this->{initial} = undef; # 最初のpostRequestの時点でのメモリ使用量
	$this->{permissible} = {}; # {key => size} 用途別のメモリ使用許容量

	$this->setPermissibleSize(_HEAP => 10 * 1024); # 10 MiB
	$this;
}

lib/Tripletail/Pager.pm  view on Meta::CPAN

use Tripletail;

1;

sub _new {
    my $class = shift;
    my $DB    = Tripletail::_isa($_[0], 'Tripletail::DB')
              ? shift
              : $TL->getDB(shift);

    my $this = bless {} => $class;

    $this->{db    } = $DB;
    $this->{dbtype} = $DB->getType;

	$this->{pagesize} = 30;
	$this->{current} = 1;
	$this->{maxlinks} = 10;
	$this->{formkey} = 'pageid';
	$this->{formparam} = undef;
	$this->{pagingtype} = 0;

lib/Tripletail/Sendmail/Esmtp.pm  view on Meta::CPAN

use base 'Tripletail::Sendmail';
use strict;
use warnings;
use Tripletail;

1;

sub _new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	$this->{group} = $group;
	$this->{dbgroup} = $TL->INI->get($group => 'dbgroup');

	$this->{resend} = $TL->INI->get($group => 'resend', 1);
	$this->{resendlimit} = $TL->INI->get($group => 'resendlimit', '24 hours');

	$this;
}

lib/Tripletail/Sendmail/MailQueue.pm  view on Meta::CPAN

use Tripletail::Sendmail::Smtp;
use Unicode::Japanese ();

our $QUEUE_ID_COUNT = 0;

1;

sub _new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	local($_);

    $this->{queuedir} = do {
        my $queuedir = $TL->INI->get($group => 'queuedir');
        $queuedir =~ s!/+$!!; # 末尾の / を消す
        $queuedir;
    };

	$this->{group} = $group;

lib/Tripletail/Sendmail/Sendmail.pm  view on Meta::CPAN

use base 'Tripletail::Sendmail';
use strict;
use warnings;
use Tripletail;

1;

sub _new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	$this->{group} = $group;
	$this->{log} = $TL->INI->get($group => 'logging');
	$this->{commandline} = $TL->INI->get($group => 'commandline', '/usr/sbin/sendmail -t -i');

	$this;
}

sub send {
	my $this = shift;

lib/Tripletail/Sendmail/Smtp.pm  view on Meta::CPAN

use warnings;
use Tripletail;
use IO::Socket::INET;
use base 'Tripletail::Sendmail';

1;

sub _new {
	my $class = shift;
	my $group = shift;
	my $this = bless {} => $class;

	$this->{group  } = $group;
	$this->{timeout} = $TL->INI->get($group => timeout => 300        );
	$this->{host   } = $TL->INI->get($group => host    => 'localhost');
	$this->{log    } = $TL->INI->get($group => logging => undef      );
	$this->{sock   } = undef;
	$this->{status } = undef;

	$this->{timeout_period} = $TL->parsePeriod($this->{timeout});

lib/Tripletail/TagCheck.pm  view on Meta::CPAN

		}
	}eg;

	$str;
}

package Tripletail::TagCheck::TagInfo;
sub new {
	my $class = shift;
	my $tag = shift;
	my $this = bless {} => $class;

	$this->{tag} = $tag;
	$this->{must_be_empty} = undef;
	$this->{allowed_attributes} = undef; # 属性名 => 1
	$this->{allowed_children} = undef; # 要素名 => 1
	$this->{is_text_allowed} = 1;
	$this->{tagbreak} = undef; # undefでなければtag breakをオーバーライド

	$this;
}

lib/Tripletail/Template.pm  view on Meta::CPAN


sub __rel2abs
{
	my $path = shift;
	my $base = shift;
	$_REL2ABS_CACHE{"$path\0$base"} ||= File::Spec::Functions::rel2abs($path, $base);
}

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	$this->{root} = Tripletail::Template::Node->_new(
        undef, undef, undef, $TL->INI->get(Template => allow_unexpanded_tags => 'false'));

	$this->{basepath} = $TL->INI->get_reloc('Template' => 'basepath', '.');
	if( !File::Spec::Functions::file_name_is_absolute($this->{basepath}) )
	{
		my $cwd = $TL::CWD || $TL->_cwd;
		$this->{basepath} = __rel2abs($this->{basepath}, $cwd);
	}

lib/Tripletail/Template/Node.pm  view on Meta::CPAN

# tmplvec の内容は浅く変化する。(つまり配列は変化しても配列の要素までは
# 変化しない。)

sub _new {
	my $class = shift;
	my $parent = shift; # Tripletail::Template::Node または undef (rootの場合)
	my $name = shift; # <!mark>の名前。rootならundef
	my $html = shift; # template html
	my $allow_unexpanded_tags = shift; # allow_unexpanded_tags

	my $this = bless {} => $class;

	$this->_reset;

	$this->{parent} = $parent;
	$this->{name} = defined($name) ? lc $name : undef; # rootの場合は使われることはない.
	$this->{allow_unexpanded_tags} = $allow_unexpanded_tags || 'false';

	if(defined $html) {
		$this->_setTemplate($html);
	}

lib/Tripletail/Value.pm  view on Meta::CPAN

my $DEFAULT_DATE_FORMAT = $YYYYMMDD;
my $DEFAULT_TIME_FORMAT = $HHMMSS;
my $DEFAULT_DATETIME_FORMAT = $YYYYMMDDHHMMSS;

1;

#---------------------------------- 一般

sub _new {
	my $class = shift;
	my $this = bless {} => $class;

	$this->{value} = undef;

	if(@_) {
		$this->set(@_);
	}

	$this;
}



( run in 0.384 second using v1.01-cache-2.11-cpan-65fba6d93b7 )