KyleYankan has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl #INCLUDE LIBRARIES AND MODULES AS NEEDED #use strict; use CGI::Carp qw(fatalsToBrowser); use CGI; use DBI; #assign values $DBuser = "not"; $DBpass = "telling"; $DBtable= "the"; $DBhost = "world"; #connect to Database $dbh = DBI->connect("DBI:mysql:$DBtable:$DBhost", "$DBuser", "$DBpass" +, { PrintError => 0, RaiseError => 1 } ) || die "Error connecting: $D +BI::errstr!"; print "Content-type: text/html\n\n"; #grab files into @files opendir(DIR,"/home/kyleyankan/public_html/content/") || die "Can' open + dir: $!"; @files = readdir(DIR); close(DIR); #@files = glob("../public_html/content/*.inc"); #run loop, to transfer each file while (@files) { #print filename print $_ . "\n"; #grab file contents open(FILE,"/home/kyleyankan/public_html/content/$_"); @content = <FILE>; close(FILE); while (@content) { $stuff .= $_; } #remove .inc from file $_ =~ s/.inc//; #dump into DB $sth = $dbh->prepare(qq~ INSERT INTO quadrants (title, author, content) VALUES ("$_","KyleYankan","$stuff")~) || die "Can't insert values: $!"; $sth->execute || die "Can't insert values: $!"; } #leave that mysql alone $dbh->disconnect();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Script being caught up, somewhere. Causing infinite loop.
by Enlil (Parson) on Feb 02, 2003 at 19:35 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by mattriff (Chaplain) on Feb 02, 2003 at 19:35 UTC | |
by Anonymous Monk on Feb 02, 2003 at 19:41 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by Anonymous Monk on Feb 02, 2003 at 19:52 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by diotalevi (Canon) on Feb 02, 2003 at 23:44 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by KyleYankan (Acolyte) on Feb 02, 2003 at 19:26 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by castaway (Parson) on Feb 02, 2003 at 19:38 UTC | |
|
Re: Script being caught up, somewhere. Causing infinite loop.
by KyleYankan (Acolyte) on Feb 02, 2003 at 19:46 UTC |