[ic] reading a session

Mathias Picker mathiasp@venus.virtual-earth.de
Tue, 29 Aug 2000 16:52:01 +0200 (CEST)


On 28 Aug, Mike Heins wrote:
> Quoting Mathias Picker (mathiasp@venus.virtual-earth.de):
>> How do I read a session, given the sessionname
> 
> You don't. Next question? 8-)
> 
> Seriously, you don't want to do this. If you are going to save a session and
> do something specific with it, do it explicitly to a file, i.e.:
> 
> 	my $sess_string = $Tag->uneval( { ref => $Session } );
> 	$Tag->writefile("tmp/$Session->{id}.save", $sess_string);

Thanks for the info, however, inserting this into minivend.cfg
leads to: 

Sorry, there was an error in processing this form action. 
Please report the error or try again later. 
(Can't use string ("") as a subroutine ref while "strict refs" in use at
/usr/local/minivend/lib/Vend/Parse.pm line 797. )

the $Tag->writefile is actually triggering the error, if I comment it
out, it works fine (without saving anything :-)

Here is the tag defined in minivend.cfg

# [vipid]
#
# This tag returns a unique ID, based on time, date and SessionID
#
UserTag vipid Routine <<EOF
sub { 
    my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
    my $session = $Vend::SessionName;
    $session =~ /^(\w+):.+$/;
    my $temp = $1;
    my $orderID = sprintf("%02d%02d%02d%02d%02d%02d%s",
            $year + 1900,$mon + 1,$mday,$hour,$min,$sec,$temp);
    
    # Replace illegal Characters with '_'
    $orderID =~ tr/:<>=+\@\"\%\&/_/d;

    # from Mike Heins <mikeh@minivend.com>
    my $sess_string = $Tag->uneval( { ref => $Vend::Session } );
    $Tag->writefile("tmp/$orderID", $sess_string);

    # Log complete SessionName in File etc/$orderID (old)
    #open(SESSION, "> etc/$orderID")
    #	or die "can´t open $orderID\n";
    #print SESSION $Vend::SessionName;
    #close SESSION;
    
    return "$orderID";
}
EOF


-- 
                            virtual earth
 Mathias Picker
 Geschäftsführer      Gesellschaft für Wissens re/prä sentation mbH

                            Mathias.Picker@virtual-earth.de 
			    Fon +49 89  / 540 7425-1
                            Fax +49 89  / 540 7425-9