MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

question about inserting Perl Code into minivend



******    message to minivend-users from "Jospeh Junod" <jjunod@intermerce.com>     ******

I am trying to insert a perl code into Minivend but it is not working for
me.  The perl by itself works with no errors but when I place it into the
HTML coding it gives me nothing.  The output is not being printed into the
HTML code.  I think the [perl interpolate=1] might be my problem or when I
return my answer to the HTML by saying "return $result;".  The code is as
follows:

<TR>
	<TD ALIGN=right NOWRAP><FONT COLOR=Red><B>* Delivery Date</B></FONT></TD>
	<TD>
		<SELECT NAME="delivery_date">
		[perl interpolate=1]
			$numberofdays =  30;          # number of days out to present
			$cutoffhour	  =  11;          # cutoff time for orders

			$dayseconds	  = 24 * 60 * 60; # number of seconds in a day
			@days = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
			@months = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);

			$result = "<OPTION VALUE=''>Select delivery date\n";

			$day = scalar time;	# was $day=time;
			$day += $dayseconds if (localtime)[2] >= $cutoffhour;

			# initial start day is "tomorrow", so the first thing we do
			# in the loop is advance the day

			for (1..$numberofdays) {
			$day += $dayseconds;
			($mday, $mon, $year, $wday) = (localtime($day))[3..6];

			next if $wday < 2;	#> Skip Sundays & Mondays
			next if $mon == 6 && $mday == 4;	# skip July 4th

			$year -= 100 if $year > 100; # catch 2000+ years

			$value   = sprintf "%2.2d%2.2d%2.2d", ($mon + 1), $mday, $year;
			$text	 = "$days[$wday], $months[$mon] $mday";
			if ($wday == 6) {
			$value .= "Sat";
		 	$text  .= " (Extra Sat. delivery charge)";
			}

			$selected = ($value eq "[value delivery_date]") ? " SELECTED" : "";

			$result .=	"<OPTION VALUE=\"$value\"$selected>$text\n";
			} # end for
			return $result;
		[/perl]
		</SELECT>
	</TD>
</TR>

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: