I'm working my way up towards creating a script that will create image galleries for me.
When I run what I have it tells me
No such file or directory at photographycreate line 16.
------------
(program exited with code: 2)
Here is the code that I've gotten so far.
#!/etc/perl -w
#CHANGE THIS
$filecategory = "cooking";
$filenumber = 0;
#$filename = "photography";
$imagedirectory = "\"/media/New Volume/Programming/kai product/media/photography/".$filecategory."/images/\"";
$galleryfile = "\"/media/New Volume/Programming/kai product/pages/".$filenumber."_".$filecategory."_gallery.html\"";
@imagelocation = <$imagedirectory/*>; #*/
$filecount = @imagelocation;
while($filenumber < 3) {
open GALLERY, "+>", $galleryfile or die $!;
print GALLERY ($filecount."\n");
print GALLERY ($imagedirectory."\n");
print GALLERY ($galleryfile."\n");
close GALLERY;
++$filenumber;
}
What I want it to do is create the file, open it, write stuff to it, and then close/save it. How can I, using what I have, do this?
Here is the fix:
#!/etc/perl -w
use Fcntl; #The Module
use strict;
#CHANGE THIS
my $filecategory = "cooking";
my $filenumber = 0;
my $imagedirectory = "\"/media/New Volume/Programming/kaiproduct/media/photography/".$filecategory."/images/\"";
my $galleryfile = "/media/New Volume/Programming/kaiproduct/pages/".$filenumber."_".$filecategory."_gallery.html";
my @imagelocation = <$imagedirectory/*>; #*/
my $filecount = @imagelocation;
while($filenumber < 3)
{
open GALLERY, "+>", $galleryfile or die $!;
print (GALLERY $filecount."\n");
print (GALLERY $imagedirectory."\n");
print (GALLERY $galleryfile."\n");
close GALLERY;
++$filenumber;
}