servus,<P>hier ein broken code um euch ein bischen antrieb zu geben.<BR>ist perl udn absolut nicht fehlerfrei <BR>war ein 30 min hack ;-)<P><BLOCKQUOTE><font size="1" face="Verdana, Helvetica, sans-serif">Code:</font><HR><pre><BR>#!c:/perl/bin/perl.exe -w<BR>#use strict;<BR>#use warnings;<P>my %id;<BR>print "Content-type: text/htmlnn";<P>if($ENV{'REQUEST_METHOD'} eq 'GET')<BR> {<BR> $Daten = $ENV{'QUERY_STRING'}<BR> }<BR>else<BR> {<BR> read(STDIN, $Daten, $ENV{'CONTENT_LENGTH'});<BR> }<BR>chomp $Daten;<BR> for my $fields ( split '&', $Daten ) {<BR> my ($key, $val) = split '=', $fields;<BR> $params{$key} = $val;<BR> }<BR>if ($params{ACTION} eq 'listall' ) {<BR>print "listall";<BR>&getAllData;<BR>&listall;<BR>}<BR>if ($params{ACTION} eq 'showID' ) {<BR>print "showID";<BR>&showID($params{ID});<P>}<P>sub getAllData{<BR>while (<DATA> ) {<BR> # ID holen<BR> my ($first) = split ';', $_, 0;<BR> print "$firstn";<BR> my (undef, $no) = split '=', $first;<BR># print "$non";<BR> push (@IDs, $no);<BR> for my $pairs ( split ';', $_ ) {<BR> my ($key, $val) = split '=', $pairs;<BR># $id{$key} = $val;<BR> $id{$no}{$key} = $val;<BR> }<BR># print "$id{$no}{$key}";<BR>}<BR>}<P>sub showID{<BR>$showID=$_[0];<P>while (<DATA> ) {<BR> $zeile = $_;<BR> $debugg++;<BR> #print "$debuggn";<BR> # ID holen<BR> my ($first) = split ';', $_, 0;<BR># print "$firstn";<BR> my (undef, $no) = split '=', $first;<P> push (@IDs, $no);<BR> if ($no eq $showID)<BR> {<BR> $datafound=0;<BR> for my $pairs ( split ';', $zeile ) {<BR> $debugg++;<BR># print "$debuggn";<P> my ($key, $val) = split '=', $pairs;<BR> $id{$key} = $val;<BR> }<BR> }<P>}<BR>print "$id{TITLE}<br>$id{SHORT}";<P>}<P><BR>sub listall {<BR>print "<ul>";<BR>foreach $IDs (@IDs){<BR>print "<li>$id{$IDs}{TITLE}<br>$id{$IDs}{SHORT}</li>";<BR>}<BR>print "</ul>";<BR>}<P><BR>__DATA__<BR>ID=00001;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00002;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Irgendwas anderes ;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00003;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00004;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00005;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00006;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00007;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR>ID=00008;KAT=Perl;AUTHOR=M.Renz;CREATED=16.05.2001;MODIFIED=16.05.2001;TITLE=Hello world Perl;SHORT=Alles um hello world;DESCRIPTION=Text zur erklärung und code snippets<pre>#!/usr/bin/..nprint "hello"</pre>;LINKS=<Perl.com,http://www.perl.com><BR></pre><HR></BLOCKQUOTE><P>gruß<BR>pfuschi<p>[ 17.05.2001: Beitrag editiert von: pfuschi ]
Source Code Editor in Perl
http://proton-ce.sf.net