apisteuto cgi provlima

George Daflidis-Kotsis gdk at demon.net
Thu Oct 5 12:08:16 EEST 2000


On Wed, Oct 04, 2000 at 11:32:34PM +0300, Giorgos Pallas wrote:

> #!/usr/bin/perl -w
> 
>   use CGI qw/:standard/;
>   print header,
>         start_html('George Pallas MP3 Database'),
>         h1('Find an MP3 from George Pallas Huge MP3 Collection...'),
>         start_form,
>         "What is the mp3 pattern to look for ",textfield('name'),p,
>         submit,
>         end_form,
>         hr;
>    if (param()) {
> 
> my($findm)=em(param('name'));
> print p,"Searching for pattern '",$findm,"'",p;
> 
> #mexri edo kala, pairnei sosta apo ti forma to $findm
> 
> open(FILE_DATA,"my_mp3s.txt"); # ok to arxeio einai sto current directory
> 
> while ($line = <FILE_DATA>)

Exw thn entupwsh pws auth h grammh einai pou thn kanei olh th douleia.

Se auth th sunta3h kaneis kati tou stul while (shift $line = <FILE_DATA>)
alla de 8umamai akribws th sunta3h.

Se tetoies periptwseis kaneis kati tou stul:

while (<FILE_DATA>) 

kai meta douleueis panw sto $_

Des to programma sou , opws to diamorfwsa, parakatw.


#!/usr/bin/perl -w

use CGI qw/:standard/;

print header,
	start_html('George Pallas MP3 Database'),
	h1('Find an MP3 from George Pallas Huge MP3 Collection...'),
	start_form,
	"What is the mp3 pattern to look for ",textfield('name'),p,
	submit,reset,
	end_form,
	hr;

if ($findm = param('name')) {

	print p,"Searching for pattern '",$findm,"'",p;

	open(FILE_DATA,"my_mp3s.txt");

		while (<FILE_DATA>) {

		chomp;

			if (/\s*CDLABEL\s*:\s*([\w-]+)/) {
			$label=$1;
			print "NEO LABEL : ",$label,p;
			}

			if (/$findm/) {
			print "BRHKA!!! line = ",$_,p;
			}

		}

 print hr;

}

-- 
-- George Daflidis-Kotsis -- Systems Administrator -- Demon Internet. --
--  Welcome to hell, here is your DoubleSpaced 386SX and Windows 98.  --

--
linux-greek-users mailing list -- http://lists.hellug.gr




More information about the Linux-greek-users mailing list