[ic] Get value(s) out of mv_searchspec

Russ Mann interchange-users@interchange.redhat.com
Thu Apr 11 13:44:00 2002


>
> So how can I get (or set a perl variable with) the values
> (or one of the values) of the mv_searchspec array??
>

Here's what I do to get values out of the mv_searchspec array:

[search-region] # Make sure it's within the search-region
[calc]
my @str = grep /\D/, @{$Values->{mv_searchspec}};  # grep to remove numbers
from the search string.
$main_category_1    =  @str[0]; # 1st spec
$media_type_1       =  @str[1]; # 2nd spec
$sub_category_1     =  @str[2]; # 3rd spec
$main_category_1    =~ s/\\//g; # modifying the var to remove slashes.
These are added by IC.
$media_type_1       =~ s/\\//g;
$sub_category_1     =~ s/\\//g;
$page_title         =  $main_category_1." - ".$sub_category_1;  # var that
is used in a [calc] later in the page.
$Scratch->{main_category} = $main_category_1;  # move var to scratch
$Scratch->{media_type} = $media_type_1;
return;
[/calc]

-Russell