Perl manipulators use Perl to efficiently manipulate source records as part of Forge data processing. If you prefer to use Perl instead of Java, you can create a Perl manipulator to add, remove, and reformat properties, join record sources, and other such tasks.

Here is the code that appears in the Expressions editor of the record manipulator; it represents a Perl manipulator:

<EXPRESSION LABEL="" NAME="PERL" TYPE="VOID" URL="">
<EXPRBODY>
<![CDATA[#extract fields from date:
		my @dates = get_props_by_name("Message Date");
		
		foreach $date (@dates) {
			my $value = $date->value();
			$value =~ /(\w{3}) (\w{3}) (\d\d) (\d\d):(\d\d):\d\d (\d{4})/;
			add_props(new Zinc::PropVal("Message Date (Weekday)", $1));
			add_props(new Zinc::PropVal("Message Date (Month)", $2));
			add_props(new Zinc::PropVal("Message Date (Day)", $3));
			add_props(new Zinc::PropVal("Message Time (Hour)", $4));
			add_props(new Zinc::PropVal("Message Time (Minute)", $5));
			add_props(new Zinc::PropVal("Message Date (Year)", $6));
		}

		remove_props("Message Date");
	
		#extract information about sender from X-Yahoo-ProfData:
		my @senderInfos = get_props_by_name("X-Yahoo-ProfData");
				foreach $senderInfo (@senderInfos) {
			my $value = $senderInfo->value();
			
			if($value =~ /(\d*)\/(\w)\/(.*)/) {
				add_props(new Zinc::PropVal("Sender Age", $1));
				add_props(new Zinc::PropVal("Sender Location", $3));
	
				my $sex;
				if($2 eq "M") {
					$sex = "male";
				}else{
					$sex = "female";
				}
				add_props(new Zinc::PropVal("Sender Gender", $sex));
			}
		}
				#copy subject to "P_Name", the default display key :
			my @subjects = get_props_by_name("Subject");
		
		foreach $subject (@subjects) {
			add_props(new Zinc::PropVal("P_Name", $subject->value()));
		}]]>
</EXPRBODY>
</EXPRESSION>

Copyright © Legal Notices