in reply to about where to check the flag
I will now add a quote from the CGI pod (my fav, quoting pod that is):#!/usr/bin/perl -wT use strict; use CGI; my %defaultRecord = ( interaction_site => undef, TITLE => undef, channel => undef, target_cell =>undef, c_end => undef, ,); my $blankRecord = new CGI(\%defaultRecord); $blankRecord->param(-name => 'channel', -value => 'Sodium channel', ,); open(SAVERECORDHERE,'>','savedrecord.dat') or die "crapola $!"; $blankRecord->save(SAVERECORDHERE); close(SAVERECORDHERE);
SAVING THE STATE OF THE SCRIPT TO A FILE: $query->save(FILEHANDLE) This will write the current state of the form to the provided filehandle. You can read it back in by providing a filehandle to the new() method. Note that the filehandle can be a file, a pipe, or whatever!
The format of the saved file is:
Both name and value are URL escaped. Multi-valued CGI parameters are represented as repeated names. A session record is delimited by a single = symbol. You can write out multiple records and read them back in with several calls to new. You can do this across several sessions by opening the file in append mode, allowing you to create primitive guest books, or to keep a history of users' queries. Here's a short example of creating multiple session records:NAME1=VALUE1 NAME1=VALUE1' NAME2=VALUE2 NAME3=VALUE3 =
Not only does the above make life simpler, it's built on the tried'and'true CGI.pm.use CGI; open (OUT,">>test.out") || die; $records = 5; foreach (0..$records) { my $q = new CGI; $q->param(-name=>'counter',-value=>$_); $q->save(OUT); } close OUT; # reopen for reading open (IN,"test.out") || die; while (!eof(IN)) { my $q = new CGI(IN); print $q->param('counter'),"\n"; }
Now you can concentrate on finishing your app, instead of parsing flat-files ... also, an alternative to the above CGI thingy might be to use windows ini style records, something like
for which there is also a module on cpan (Config::INI)[recordorsomething] key = value k0ey = valuee [recordothersomething] k = v
What I also like to do, as opposed to using a flat-file, is to add DB_File to the mix, which along with CGI.pm, makes for better than flatfile, and as always,makes for an easy to parse, quick to write with the security of familiarity, solution.
Happy Coding!
update:
It has been brought to my attention, that gdnew is using a very peculiar dataformat, sorta like:
mentioned in strange quotes.COMMERCIAL SUPPLIERS SEQUENCE /exon="1-120" /intron=" " //
Now my question is for you gdnew, where did you get the idea to use such a bizzare format?
| ______crazyinsomniac_____________________________ Of all the things I've lost, I miss my mind the most. perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;" |
|
|---|