Akopia Akopia Services

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

[mv] MV3.12 / Tag Log - Dynamic File Name not interpolated



******    message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com>     ******

Dear List,

	I'm trying to log some data to a file based on a scratch var, my first 
attempt was this:

[tag log logs/[value something].txt]
  	Stuff here
[/tag]

It seems that [value something] disappears and the catalog's error.log 
tells me:

ryan.baits.com exqSMXVa:ryan.baits.com - [03/April/2000:16:48:47 -0700] 
order /cgi-bin/order/process Could not open
 >  log file '>>logs/': Is a directory
 > to log this data:
 > .txt]

When I tried:

[tag interpolate=1 log logs/[value something].txt]
	Stuff here
[/tag]

My error.log tells me:

ryan.baits.com exqSMXVa:ryan.baits.com - [03/April/2000:16:52:32 -0700] 
order /cgi-bin/order/process Unknown tag argument 'interpolate=1 log 
logs/[value something'

Naturally, using a static file name works perfectly.  :-)

Since OPEN isn't allowed by SAFE in a generic [perl] tag, I went with a 
global sub in the minivend.cfg:

GlobalSub <<EOF
sub logstuff {
open(FILE, ">/var/lib/mvend/logs/[value something].txt") || return "I can't 
open: [value something].txt\n";
print FILE <<EOM;

       ORDER DATE: [calc]localtime[/calc]
     ORDER NUMBER: [value mv_order_number]
      Customer No: [value custno]

EOM
close (FILE);
EOF
}

and I call it with:

[perl sub interpolate=1]logstuff[/perl]

This gives me a file full of un-interpolated mv tags.  So, I tried this:

GlobalSub <<EOF
sub logstuff {
my($bigstring) = @_;
open(FILE, ">/var/lib/mvend/logs/[value something].txt") || return "I can't 
open: [value something].txt\n";
	print FILE $bigstring;
close(FILE);
}
EOF

And called this with:

[perl sub interpolate=1]logstuff ( q{
       ORDER DATE: [calc]localtime[/calc]
     ORDER NUMBER: [value mv_order_number]
      Customer No: [value custno]
}
)
[/perl]

Which returned exactly the same thing!  ;-)  Naturally, the method I use to 
determine the file name also returns the MiniVend tag (uninterpolated) but 
I'll worry about that later!

Can any Perl guru help me with getting this global sub to work?

Thanks,

-Ryan


Ryan Hertz                                              tel  800-645-BAIT
Webmaster                                               fax  520-645-2588
Advertising Director                            http://yamamoto.baits.com
Gary Yamamoto Custom Baits, Inc.                http://www.insideline.net

-
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: