view release on metacpan or search on metacpan
lib/Mail/Decency/Core/SessionItem/ContentFilter.pm view on Meta::CPAN
has verify_ttl => ( is => 'rw', isa => 'Int', predicate => 'has_verify_ttl' );
=head2 update_store
Write store YAML file
=cut
sub update_store {
my ( $self ) = @_;
open my $fh, '>', $self->store
or die "Cannot open store file ". $self->store. " for write: $!";
my %create = ();
$create{ from } = $self->from if $self->from;
$create{ to } = $self->to if $self->to;
print $fh YAML::Dump( {
file => $self->file,
size => $self->file_size,
%create
lib/Mail/Decency/Core/SessionItem/ContentFilter.pm view on Meta::CPAN
close $fh;
}
=head2 update_from_policy_cache
Update session from cached policy session
=cut
sub update_from_policy_cache {
my ( $self, $hash_ref ) = @_;
# update spam score
$self->spam_score( $self->spam_score + $hash_ref->{ spam_score } )
if $hash_ref->{ spam_score };
# update spam details
push @{ $self->spam_details }, @{ $hash_ref->{ spam_details } }
if $hash_ref->{ spam_details };
lib/Mail/Decency/Core/SessionItem/ContentFilter.pm view on Meta::CPAN
return;
}
=head2 update_from_cache
Update session from cached session
=cut
sub update_from_cache {
my ( $self, $hash_ref ) = @_;
$self->update_from_policy_cache( $hash_ref );
$self->virus( join( "; ", $self->virus, $hash_ref->{ virus } ) )
if $hash_ref->{ virus };
foreach my $id( qw/ next_id prev_id / ) {
$self->$id( $hash_ref->{ $id } )
if ! $self->$id && $hash_ref->{ $id };
lib/Mail/Decency/Core/SessionItem/Policy.pm view on Meta::CPAN
message => $self->message,
};
}
=head2 update_from_cache
Updates current session from cached session
=cut
sub update_from_cache {
my ( $self, $hash_ref ) = @_;
$self->spam_score( $self->spam_score + $hash_ref->{ spam_score } )
if $hash_ref->{ spam_score };
push @{ $self->spam_details }, @{ $hash_ref->{ spam_details } }
if $hash_ref->{ spam_details };
push @{ $self->spam_details }, @{ $hash_ref->{ message } }
if $hash_ref->{ message };
lib/Mail/Decency/Core/Stats.pm view on Meta::CPAN
}
};
=head1 METHODS
=head2 update_stats
=cut
sub update_stats {
my ( $self, $module, $type, $weight_diff, $runtime ) = @_;
print Dumper [ $type => $weight_diff, $runtime ];
my $now = DateTime->now( time_zone => $self->stats_time_zone );
my @intervals = map {
my $iv = $now->clone->truncate( to => $_ );
[ $_, $iv->epoch ];
} grep {
/^(hour|day|week|month|year)$/
lib/Mail/Decency/Helper/Database.pm view on Meta::CPAN
=cut
=head2 update_data
Transforms flat (scalar) values into { data => $value } hashrefs
=cut
sub update_data {
my ( $self, $data ) = @_;
return $data if ref( $data );
return { data => $data };
}
=head2 parse_data $data_ref
Transforms hashref values in an array context from { value => $value } to ( $value )
In array-context, it will return the content of the "data" field, if any
lib/Mail/Decency/Helper/Database.pm view on Meta::CPAN
}
=head2 update_query $query_ref
Update method for search query. Can be overwritten/extended in derived modules.
=cut
sub update_query {
my ( $self, $query_ref ) = @_;
return $query_ref if ref( $query_ref );
return { key => $query_ref };
}
=head2 do_lock
Locks via flock file
lib/Mail/Decency/Helper/Database/DBD.pm view on Meta::CPAN
=head2 update_data
Update input data for write
Transforms any complex "data" key into YAML
=cut
sub update_data {
my ( $self, $data_ref ) = @_;
$data_ref = $self->next::method( $data_ref );
if ( defined $data_ref->{ data } && ref( $data_ref->{ data } ) ) {
$data_ref->{ data } = YAML::Dump( $data_ref->{ data } );
}
return wantarray ? ( $data_ref->{ data } ) : $data_ref;
}
=head2 parse_data
lib/Mail/Decency/Helper/Database/MongoDB.pm view on Meta::CPAN
}
return 1;
}
=head2 update_query
=cut
sub update_query {
my ( $self, $ref ) = @_;
$ref = $self->next::method( $ref );
my %op_match = (
'>' => '$gt',
'<' => '$lt',
'>=' => '$gte',
'<=' => '$lte',
'!=' => '$ne',
);
lib/Mail/Decency/Policy/Greylist.pm view on Meta::CPAN
}
}
=head2 update_pass
Add counters to pass databases
=cut
sub update_pass {
my ( $self, $attrs_ref ) = @_;
my $pass = 0;
# use host and domain whitelisting only if we don't care for hosting
# or the score of the mail looks like hame
# remark: in context with SPF beforehand we will not add sender
# domains or hosts to the whitelist if the look somewhat bogus
if ( ! $self->scoring_aware || $self->session_data->spam_score >= 0 ) {