Документ взят из кэша поисковой машины. Адрес оригинального документа : http://hea.iki.rssi.ru/Z-90/z90-prelist2.pl~
Дата изменения: Wed Dec 8 21:06:43 2004
Дата индексирования: Mon Oct 1 21:29:53 2012
Кодировка:

Поисковые слова: m 5
#!/usr/bin/perl

#use Text::BibTeX;


require "bp.pl";

# get current time and data
@TIME = localtime(time);
$DATE = @TIME[3].".".(@TIME[4]+1).".".(@TIME[5]+1900);
$time = @TIME[2].":".@TIME[1].":".@TIME[0];


$bib_file1="/export/web/www/Z-90/data/z90-form.bib.p1";
$bib_file2="/export/web/www/Z-90/data/reg-db.bib.p1";

$head="/export/web/www/Z-90/lhead.html";
$tail="/export/web/www/Z-90/ltail.html";
$form="form";

@TIME = localtime(time);
$DATE = @TIME[3].".".(@TIME[4]+1).".".(@TIME[5]+1900);
$time = @TIME[2].":".@TIME[1].":".@TIME[0];
$query;

if($ENV{'REQUEST_METHOD'} eq 'GET'){
$query = $ENV{'QUERY_STRING'};
}elsif($ENV{'REQUEST_METHOD'} eq 'POST'){
sysread(STDIN,$query,$ENV{'CONTENT_LENGTH'});
}
$query=urldecode($query);



if($query ne ''){
@fvalues = split(/&/,$query);

foreach $i (0 .. $#fvalues){
$str=$fvalues[$i];
($name,$val) = split(/=/,$fvalues[$i],2);
$name=&urldecode($name);
$val=&urldecode($val);
$field{$name} = $val;
}
}

$bib_file=$bib_file1;
if(defined $field{'db'}){
$bib_file=$bib_file1 if ($field{'db'} eq "1");
$bib_file=$bib_file2 if ($field{'db'} eq "2");
}

print "Content-Type: text/html\n\n";


# my $bibfile = new Text::BibTeX::File "/tmp/foo.bib";
# my $newfile = new Text::BibTeX::File ">/tmp/newfoo.bib";
# while ($entry = new Text::BibTeX::Entry $bibfile)
# {
# next unless $entry->parse_ok;
# print "
".$entry->key."
";
# $entry->write ($newfile);
# }
# exit 0;



if(checkf($head)){
open FD,"<$head" ;
while (){
print;
}close FD;
}

&check ($bib_file);

if(checkf($tail)){
open FD,"<$tail" ;
while (){
print;
}close FD;
}



sub urldecode{
local($val)=@_;
#$val =~ s/\+/ /g;
$val =~ s/%([0-9a-hA-H]{2})/pack('C',hex($1))/ge;
return $val;
}


sub check{
&bib'format("auto");

%prelist=();

print "";
foreach $file ($_[0]) {
next unless &bib'open($file);
$totrecs = 0;

while ($record = &bib'read($file) ) {

%entry = &bib'explode($record);

next if(defined $entry{'unable'});
next if(defined $entry{'hide'});


$entry{'author'} = $entry{'author1'}." ".$entry{'author2'} unless(defined $entry{'author'});

#
# split author name to extract last name and make shorter first name.
#

@l = split " ",$entry{'author'};
$key = pop @l;
push @l," $key";

if( defined $prelist{$key}){
$key.=$idx;
$idx++;
}
$entry{'author'}=~s/ /_/;
if($entry{'email'}=~m/(.ru$)|(.spb.edu$)|(.su$)/ |
$entry{'address'}=~m/Moscow|Russia|Petersburg/ ||
$entry{'institution'}=~m/Moscow|Russia|IKI|RAN|RAS/){

$prelist{$key}.="$entry{'author'} $entry{'email'}\n";

}else{

$prelist{$key}.="$entry{'author'} $entry{'email'}\n";

}




if(defined($entry{'presentation_talk'})){
$prelist{$key}.="T\n";
}elsif(defined($entry{'presentation_poster'})){
$prelist{$key}.="P\n";
}elsif(defined($entry{'presentation_none'})){
$prelist{$key}.="N\n";
}


$prelist{$key}.=" ".$entry{'attendence'}."" ;#if(defined $entry{'attendence'});
$prelist{$key}.=" ".$entry{'institution'}."" ;#if(defined $entry{'institution'});
$prelist{$key}.=" ".$entry{'address'}."" ;#if(defined $entry{'address'});
#$prelist{$key}.=" ".$entry{'title'}."";

if($entry{'abstract'} ne ""){
$abstract=$entry{abstract};
$abstract=~s/\'+/\\\'/g;
$abstract=~s/\"+/\\\'/g;
$prelist{$key}.="$entry{'title'}\n";
#if(defined($entry{'title'}));
}else{
$prelist{$key}.="$entry{'title'}\n";
#if(defined($entry{'title'}));
}

if($entry{'use_preregistration'} eq "on"){
$prelist{$key}.="use prereg. info\n";
}else{
$prelist{$key}.="\n";
}


$prelist{$key}.=" $entry{'arriving_date'} (arr.)\n";
$prelist{$key}.=" $entry{'departure_date'} (dep.)\n";




if(defined $entry{'oral'}){
$prelist{$key}.="oral\n";
}else{
$prelist{$key}.=" \n";
}


$sub=(split " ",$entry{'submitted'})[0];
$prelist{$key}.=
"\ $sub (submitted)\n";


if(defined $entry{'unable'}){
$prelist{$key}.="unable\n";
}


$prelist{$key}.="\n";
$totrecs++;
}
&bib'close($file);
}

print "";
#print "";

foreach $i (sort keys %prelist){
print "$prelist{$i}";
}
print "
ParticipantP (\%)Title From...
";

print "
Total number is $totrecs.

";

print "";

}

sub checkf{
unless (-f $_[0]){
print "ERROR: Can\'t open file \"$_[0]\"" ;
return false;
}else{
return true;
}
}