Apache-Wyrd
view release on metacpan or search on metacpan
my (%init, $init_ref, $unescape) = ();
$self->_error("Attempted recursion of $class") if ($data =~ /<$base_class\:\:$class[\s>]/);
#drop the nest identifier
$class =~ s/([^:]):([^:]+)$/$1/ && $self->_info("dropped the nest identifier $2");
#encode the escaped-out " and '
$params =~ s/\\'/<!apostrophe!>/g;
$params =~ s/\\"/<!quote!>/g;
#escape-out special characters when they are the only attribute
$params =~ s/\$/<!dollar!>/g;
$params =~ s/\@/<!at!>/g;
$params =~ s/\%/<!percent!>/g;
$params =~ s/\&/<!ampersand!>/g;
#nullify the blank attributes
$params =~ s/""/"<!null!>"/g;
$params =~ s/''/'<!null!>'/g;
#zerofy the numerical zero attributes
$params =~ s/"0"/"<!zero!>"/g;
$params =~ s/'0'/'<!zero!>'/g;
#Process Params:
do {
$match = 0;
}
}
} while $match;
foreach my $i (keys(%init)) {
$init{$i} =~ s/<!apostrophe!>/'/g;
$init{$i} =~ s/<!quote!>/"/g;
$init{$i} =~ s/<!null!>//g;
$init{$i} =~ s/<!zero!>/0/g;
$init{$i} =~ s/<!dollar!>/\$/g;
$init{$i} =~ s/<!at!>/\@/g;
$init{$i} =~ s/<!percent!>/\%/g;
$init{$i} =~ s/<!ampersand!>/\&/g;
}
#store the HTML of the wyrd
$init{'_as_html'} = $original;
$init{'_data'} = $data || '';
#spawn the new object
my ($wyrd, $err) = $self->_spawn($class, \%init);
Wyrd/Chart.pm view on Meta::CPAN
=over
=item zero
Replace undefined values with 0.
=item dollar_sign
Put a dollar sign to the left
=item percent_sign
Put a percent sign to the right
=item commify
Put numbers into (north american style) comma splits, i.e. 3,000,000 for 3E6
=back
=item Flags
=over
=item nochache
Always generate the graphic, instead of checking to see if it has changed
=item percent
Convert values to percentages of total
=item rotate
Pivot the table returned by the query to make X Y and vice-versa
=item value_labels
Add the value to the label, as in "Foobars (2), Widgets (23)"
Wyrd/Chart.pm view on Meta::CPAN
push @values, $value
}
}
if ($limit_reached) {
$truncate = 1;
push @labels, "Other";
push @values, $other;
@data = (\@labels, \@values);
}
}
if ($self->_flags->percent) {
foreach my $line (1 .. $#data) {
my $sum = 0;
map {$sum += $_} @{$data[$line]};
my $count = 0;
my $total = 0;
foreach my $item (@{$data[0]}) {
$data[$line][$count] = int((($data[1][$count]/$sum) * 100) + .5);
$count++;
}
}
}
if ($self->_flags->value_labels) {
$truncate ||= 1;
my $count = 0;
my $percent = '';
$percent = '%' if ($self->_flags->percent);
map {$data[0][$count] = $data[0][$count] . " ($_$percent)"; $count++} @{$data[1]};
}
} else {
if ($self->_flags->rotate) {
my @new = ();
my $size = scalar(@{$data[0]});
for (my $i = 0; $i < $size; $i++) {
my @outline = ();
foreach my $datum (@data) {
push @outline, $datum->[$i];
}
Wyrd/Chart.pm view on Meta::CPAN
}
}
}
sub _filter {
my ($self, $filter, $value) = @_;
if ($filter eq 'zero') {
return '0' unless $value;
} elsif ($filter eq 'dollar_sign') {
return '$' . $value;
} elsif ($filter eq 'percent_sign') {
return "$value%";
} elsif ($filter eq 'commify') {
1 while ($value =~ s/^([-+]?\d+)(\d{3})/$1,$2/);
return $value;
}else {
return $self->_special_filter($filter, $value);
}
}
=pod
Wyrd/Site/SearchResults.pm view on Meta::CPAN
Apache::Wyrd::Site::Pull
Apache::Wyrd::Interfaces::Dater
Apache::Wyrd::Interfaces::Setter
Apache::Wyrd
);
our $VERSION = '0.98';
# searchparam - name of parameter containing the search string, default 'searchstring'
# item - list item template
# failed - template of error message for failed search
# decimal - decimals of percentile
=pod
=head1 NAME
Apache::Wyrd::Site::SearchResults - Perform a word-search of Pages
=head1 SYNOPSIS
<BASENAME::SearchResults max="20">
Wyrd/Site/SearchResults.pm view on Meta::CPAN
Meaning the rank (1 = best) of the document as to relevance within the search set.
=item counter
The ordinal number of the item in the found set.
=item weighted_rank
Meaning the relative rank of the document in comparison with the others of the
found set (in percent, 100=best).
=item relevance
The generic, unweighted relevance score, based on a function of word-incidents
to document size (wordcount).
=back
To allow the individual items of the "search results" block to be related to
each other. Additionally, if a previous search result is given in the CGI
( run in 0.447 second using v1.01-cache-2.11-cpan-10c994e2082 )