sendmail not working

2003-04-05 Thread mel awaisi
Hello,

i have the script below retest.pl, and whe i try to run it i get nothing.

[EMAIL PROTECTED] cgi-bin]# perl retest.pl
[EMAIL PROTECTED] cgi-bin]#
-retest.pl
# Open Sendmail
open(MAIL, |/usr/lib/sendmail -t);
# Write to the sendmail program
print MAIL To: [EMAIL PROTECTED];
print MAIL From: [EMAIL PROTECTED];
print MAIL Subject:Your Subject\n\n;
print MAIL Your message here;
# Close the sendmail program
close(MAIL);
---
Cheers
Mel
_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


sending an email to a email address after a perl operation

2003-04-04 Thread mel awaisi
Hi,

I have a script named renamer.pl that takes images from a directory and 
renames images and stores image meta information in a mysql. i also have a 
script that sends an email notification when excecuted to a desired email 
address.

is there away that i could combine the 2 scripts together, so when the meta 
information are inserted into MySQL, an email is sent to me.

Cheers

Mel

---emailtest.pl

#!/usr/local/bin/perl

use Net::SMTP;

print Content-type: text/plain, \n\n;

my $DEBUG = 1;

if($DEBUG)
{
$| = 1;
open(STDERR, STDOUT);
}
# Set this variable to your smtp server name
my $ServerName = smtp.dundee.ac.uk;
# Create a new SMTP object
$smtp = Net::SMTP-new($ServerName, Debug = 1);
# If you can't connect, don't proceed with the rest of the script
die Couldn't connect to server unless $smtp;
# Initiate the mail transaction
# Your real email address
my $MailFrom = [EMAIL PROTECTED];
# Recipient's real email address
my $MailTo = [EMAIL PROTECTED];
$smtp-mail( $MailFrom );
$smtp-to( $MailTo );
# Start the mail
$smtp-data();
# Send the header
# This address will appear in the message
$smtp-datasend(To: [EMAIL PROTECTED]);
# So will this one
$smtp-datasend(From: [EMAIL PROTECTED]);
$smtp-datasend(Subject: image_alert\n);
$smtp-datasend(\n);
# Send the body.
$smtp-datasend(This is to notify you of a new image being sent to the 
server!\n\n);

# Send the termination string
$smtp-dataend();
# Close the connection
$smtp-quit();


renamerr.pl
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use Date::Manip;
=head1 NAME # renamer - renames files received by ftp, moving them to a new
directory
=head1 SYNOPSIS

nohup ./renamer image /home/httpd/htdocs /home/me/images jpg renamer.process

=head1 DESCRIPTION

#The above instructs renamer to look for files called image.jpg in
/home/httpd/htdocs.
#It checks once per minute for such a file to appear. If it sees a
#readable file called /home/httpd/htdocs.jpg it moves it
to/home/httpd/htdocs/image.200302251530.jpg
#where the number is a
#time stamp with year (four digits), month, day of the month, hour (in24
mode), and minute.
#Read the bugs section closely.
=head1 BUGS

#The original and new directories must be on the same file system.The
#program probably does not work on windows systems.
#The daemon behavior is weak.Not much testing has been done, so the script
may have other problems.
=cut

my $usage = EOUSAGE;
usage: $0 initial_name original_dir new_dir suffix lockfile
example: $0 pic /home/httpd/htdocs /home/me/images jpg
/home/me/renamer.process
EOUSAGE
my $check_file = shift or die $usage;
my $original_dir = shift or die $usage;
my $new_dir = shift or die $usage;
my $suffix = shift or die $usage;
my $lockfile = shift or die $usage;
##
# If you put it into the cron, comment out between the START and END BLOCK,
# and uncomment the section below it so you don't get multiple
# copies running. Also, comment out the
# lockfile bits above.
#START BLOCK
exit if (fork());
while (-e $lockfile) {
process($check_file) if (-r $original_dir/$check_file.$suffix);
sleep 30;
}
#END BLOCK
##
#
# process($check_file) if (-r $original_dir/$check_file.$suffix);
#
##
sub process {
my $file = shift;
my @st = (stat($original_dir/$file.$suffix));
my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear,
$IsDST) = localtime($st[10]);
$Year += 1900;
$Month++;
my $stamp = sprintf %4d_%02d_%02d_%02d_%02d_%02d, $Year, $Month, $Day,
$Hour, $Minute, $Second;
print renaming $original_dir/$file.$suffix to
$new_dir/$stamp.$suffix\n;
rename $original_dir/$file.$suffix, $new_dir/$stamp.$suffix or warn
couldn't rename file: $! $file to $new_dir/$file.$stamp.$suffix\n;
print adding $new_dir/$stamp.$suffix to database\n;
my $single_string = $new_dir . '/' . $stamp . '.' . $suffix;
infoinsert ($single_string);
}





#
# Connect to Database Named cctvimages on the localhost with the root user
# $dbh=DBI-connect(DBI:mysql;$database, $user, $password);
# and insert info about the file given as the argument $_[0];

#


sub infoinsert
{
my ($file) = @_;
dieFailed to get the info\n\$file is: $file if not defined $file;
my $dbh = DBI-connect(DBI:mysql:dbname=cctvimages;host=localhost,root,
, {'RaiseError' = 1});
my $size;
my $mtime;
my $secs;
($size, $secs) = (stat ($file))[7,9];
$mtime = ParseDateString(epoch $secs);
# even after conversion ':' is used to seperate hh and mn and ss
$mtime =~ s/://g;
# the above swaps out the ':' for nothing
$file =~ s/\/home\/me\/images\///;
# the above strips path
printsize is $size\nmodified is $mtime\nfilename is $file\n;
my $rows_affected = $dbh-do(INSERT INTO imageinfo VALUES(null, '$file',
'$size', '$mtime'))
or die Do Fails: 

RE: sending an email to a email address after a perl operation

2003-04-04 Thread mel awaisi
thanks Dan,

sorry for forgetting to send to list.

the email script works alone, as it is, so maybe it is something else.

Regards,

Mel





From: Dan Muey [EMAIL PROTECTED]
To: mel awaisi [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: RE: sending an email to a email address after a perl operation
Date: Fri, 4 Apr 2003 17:10:10 -0600
 Hi Dan

Hey, reply to the list not just me.


 yeh still here, back from a small break. just want to finish it!!.

 i tried this and this is what i got:

 Global symbol $smtp requires explicit package name at
Make
$smtp = ...
my $smtp = ...

There was a thread earlier today about namespaces. Check out the archive it 
was quite informative.

 rename.pl line 140. Global symbol $smtp requires explicit
 package name at rename.pl line 143. Global symbol $smtp
 requires explicit package name at rename.pl line 151. Global
 symbol $smtp requires explicit package name at rename.pl
 line 152. Global symbol $smtp requires explicit package
 name at rename.pl line 155. Global symbol $smtp requires
 explicit package name at rename.pl line 159. Global symbol
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
Surf together with new Shared Browsing 
http://join.msn.com/?page=features/browsepgmarket=en-gbXAPID=74DI=1059

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


script to send email message

2003-03-25 Thread mel awaisi
Hi,

I have been researching on this. i got a script when i try to run get an 
error connecting to server. This script i am just trying to get to work, but 
the main reason for this is to be able to insert it into another Perl script 
where i would like email to be sent automatically when the other part of the 
script does something!

[EMAIL PROTECTED] cgi-bin]# perl email.pl
Content-type: text/plain
Couldn't connect to server at email.pl line 22.
[EMAIL PROTECTED] cgi-bin]#
Regards,

Mel

-email.pl

#!/usr/local/bin/perl

use Net::SMTP;

print Content-type: text/plain, \n\n;

my $DEBUG = 1;

if($DEBUG)
{
  $| = 1;
  open(STDERR, STDOUT);
}
# Set this variable to your smtp server name
my $ServerName = smtp.134.36.16.12;
# Create a new SMTP object
$smtp = Net::SMTP-new($ServerName, Debug = 1);
# If you can't connect, don't proceed with the rest of the script
die Couldn't connect to server unless $smtp;
# Initiate the mail transaction
# Your real email address
my $MailFrom = [EMAIL PROTECTED];
# Recipient's real email address
my $MailTo = [EMAIL PROTECTED];
$smtp-mail( $MailFrom );
$smtp-to( $MailTo );
# Start the mail
$smtp-data();
# Send the header
# This address will appear in the message
$smtp-datasend(To:  [EMAIL PROTECTED]);
# So will this one
$smtp-datasend(From:  [EMAIL PROTECTED]);
$smtp-datasend(Subject: Test Message\n);
$smtp-datasend(\n);
# Send the body.
$smtp-datasend(Hello World!\n\n);
# Send the termination string
$smtp-dataend();
# Close the connection
$smtp-quit();
_
On the move? Get Hotmail on your mobile phone 
http://www.msn.co.uk/msnmobile/mobilehotmail

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: script to send email message

2003-03-25 Thread mel awaisi
Hi

thanks for the help, i changed the smtp.cctv.dundee.ac.uk to the 
smtp.dundee.ac.uk, and i got results, but does no email sent?

[EMAIL PROTECTED] cgi-bin]# perl emailtest.pl
Content-type: text/plain
Net::SMTP: Net::SMTP(2.24)
Net::SMTP:   Net::Cmd(2.21)
Net::SMTP: Exporter(5.566)
Net::SMTP:   IO::Socket::INET(1.26)
Net::SMTP: IO::Socket(1.27)
Net::SMTP:   IO::Handle(1.21)
Net::SMTP=GLOB(0x81cdf28) 220 mh-gen-a1.dundee.ac.uk Mercury 1.48 ESMTP 
serve
r ready.
Net::SMTP=GLOB(0x81cdf28) EHLO localhost.localdomain
Net::SMTP=GLOB(0x81cdf28) 250-mh-gen-a1.dundee.ac.uk Hello 
localhost.localdom
ain; ESMTPs are:
Net::SMTP=GLOB(0x81cdf28) 250-TIME
Net::SMTP=GLOB(0x81cdf28) 250-SIZE 3000
Net::SMTP=GLOB(0x81cdf28) 250 HELP
Net::SMTP=GLOB(0x81cdf28) MAIL FROM:[EMAIL PROTECTED]
Net::SMTP=GLOB(0x81cdf28) 250 Sender OK - send RCPTs.
Net::SMTP=GLOB(0x81cdf28) RCPT TO:[EMAIL PROTECTED]
Net::SMTP=GLOB(0x81cdf28) 250 Recipient OK - send RCPT or DATA.
Net::SMTP=GLOB(0x81cdf28) DATA
Net::SMTP=GLOB(0x81cdf28) 354 OK, send data, end with CRLF.CRLF
Net::SMTP=GLOB(0x81cdf28) To:  [EMAIL PROTECTED]
Net::SMTP=GLOB(0x81cdf28) From:  [EMAIL PROTECTED]
Net::SMTP=GLOB(0x81cdf28) Subject: Test Message
Net::SMTP=GLOB(0x81cdf28)
Net::SMTP=GLOB(0x81cdf28) Hello World!
Net::SMTP=GLOB(0x81cdf28) .
Net::SMTP=GLOB(0x81cdf28) 250 Data received OK.
Net::SMTP=GLOB(0x81cdf28) QUIT
Net::SMTP=GLOB(0x81cdf28) 221 mh-gen-a1.dundee.ac.uk Service closing 
channel.
[EMAIL PROTECTED] cgi-bin]#
[EMAIL PROTECTED] cgi-bin]#



Regards,

Mel





From: Dan Muey [EMAIL PROTECTED]
To: mel awaisi [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: RE: script to send email message
Date: Tue, 25 Mar 2003 15:03:58 -0600

 Hi Dan
Howdy - Post back to the list so everyone can share.


 ok, i changed it to
 smtp.cctv.dundee.ac.uk

 but still,
 [EMAIL PROTECTED] cgi-bin]# perl emailtest.pl
 Content-type: text/plain

 Couldn't connect to server at emailtest.pl line 23.
 [EMAIL PROTECTED] cgi-bin]#

 does the email from has to be from the server? if so then how
Depends how smtp is set up at smtp.cctv.dundee.ac.uk
Does that allow smtp connections from the ip address the script is at?
 do i create
 this, i dont have an email server on my server. i basically
 installed red
 hat 8.
Another thing. It may be dns ::
If I do a ping ::
# ping smtp.cctv.dundee.ac.uk
ping: cannot resolve smtp.cctv.dundee.ac.uk: Unknown host
#
Try the ip address of the server instead of the domain or a resolvable 
domain at least.

If you specify/can resolve the domain to it's ip and the smtp server will
allow smtp connections from your ip address then you're all set.
It's not really a perl issue but an smtp server/dns issue.

Hope that helps

DMuey


 Regards,

 Mel





 From: Dan Muey [EMAIL PROTECTED]
 To: mel awaisi [EMAIL PROTECTED],  [EMAIL PROTECTED]
 Subject: RE: script to send email message
 Date: Tue, 25 Mar 2003 14:35:51 -0600
 
 
   Hi,
  
   I have been researching on this. i got a script when i try to run
   get an error connecting to server. This script i am just trying to
   get to work, but
   the main reason for this is to be able to insert it into
   another Perl script
   where i would like email to be sent automatically when the
   other part of the
   script does something!
  
   [EMAIL PROTECTED] cgi-bin]# perl email.pl
   Content-type: text/plain
  
   Couldn't connect to server at email.pl line 22.
   [EMAIL PROTECTED] cgi-bin]#
  
  
   Regards,
  
   Mel
  
   -email.pl
  
   #!/usr/local/bin/perl
  
   use Net::SMTP;
  
   print Content-type: text/plain, \n\n;
  
   my $DEBUG = 1;
  
   if($DEBUG)
   {
  $| = 1;
  open(STDERR, STDOUT);
   }
  
   # Set this variable to your smtp server name
   my $ServerName = smtp.134.36.16.12;
 
 Uh, IP address or name can't mix em. I'd make this 134.36.16.12
 Or
 smtp.whateverthedomainisforthatip.com
 
 I'll bet tha'd clear it right up
 
 DMuey
 
  
   # Create a new SMTP object
   $smtp = Net::SMTP-new($ServerName, Debug = 1);
  
   # If you can't connect, don't proceed with the rest of the script
   die Couldn't connect to server unless $smtp;
  
   # Initiate the mail transaction
   # Your real email address
   my $MailFrom = [EMAIL PROTECTED];
  
   # Recipient's real email address
   my $MailTo = [EMAIL PROTECTED];
  
   $smtp-mail( $MailFrom );
   $smtp-to( $MailTo );
  
   # Start the mail
   $smtp-data();
  
   # Send the header
   # This address will appear in the message
   $smtp-datasend(To:  [EMAIL PROTECTED]);
  
   # So will this one
   $smtp-datasend(From:  [EMAIL PROTECTED]);
   $smtp-datasend(Subject: Test Message\n); $smtp-datasend(\n);
  
   # Send the body.
   $smtp-datasend(Hello World!\n\n);
  
   # Send the termination string
   $smtp-dataend();
  
   # Close the connection
   $smtp-quit();
  
  
   _
   On the move? Get Hotmail on your mobile phone
   http://www.msn.co.uk/msnmobile/mobilehotmail

The Loop in this script is driving me crazy.

2003-03-24 Thread mel awaisi
Hi,

The problem has been highlighted to me by a great person in this list, but i 
just cant solve it.

I have this script that is not working as it should be. this is what it is 
supposed to be doing, take images from a directory (images are coming from 
camera) and renames them with the date and time of image. then insert some 
meta information into MySQL. what the script is supposed to be doing is to 
always keep looking and whenever it finds images to perform the change and 
insert. the output is as follow: it only does the process once.

i would appreciate any help.

cheers,
Mel
---
renaming /home/httpd/htdocs/image.jpg to 
/home/me/images/2003_03_24_18_14_12.jpg
adding /home/me/images/2003_03_24_18_14_12.jpg to database
[EMAIL PROTECTED] cgi-bin]# size is 196378
modified is 20030324181412
filename is 2003_03_24_18_14_12.jpg
Use of uninitialized value in concatenation (.) or string at renamerr.pl 
line 99
.
Failed to get the info
$file is: at renamerr.pl line 99.
-

The script is as follow:

#!/usr/bin/perl

use strict;
use warnings;
use DBI;
use Date::Manip;
=head1 NAME # renamer - renames files received by ftp, moving them to a new 
directory

=head1 SYNOPSIS

nohup ./renamer image /home/httpd/htdocs /home/me/images jpg renamer.process 


=head1 DESCRIPTION

#The above instructs renamer to look for files called image.jpg in 
/home/httpd/htdocs.It checks once per minute for such a file to appear. If 
it sees a
#readable file called /home/httpd/htdocs.jpg it moves it 
to/home/httpd/htdocs/image.200302251530.jpg where the number is a
#time stamp with year (four digits), month, day of the month, hour (in24 
mode), and minute.
#Read the bugs section closely.

=head1 BUGS

#The original and new directories must be on the same file system.The 
program probably does not work on windows systems.
#The daemon behavior is weak.Not much testing has been done, so the script 
may have other problems.

=cut

my $usage = EOUSAGE;
usage: $0 initial_name original_dir new_dir suffix lockfile
example: $0 pic /home/httpd/htdocs /home/me/images jpg 
/home/me/renamer.process
EOUSAGE

my $check_file = shift or die $usage;
my $original_dir = shift or die $usage;
my $new_dir = shift or die $usage;
my $suffix = shift or die $usage;
my $lockfile = shift or die $usage;
##
# If you put it into the cron, comment out between the START and END BLOCK, 
and uncomment the section below it so you don't get multiple copies running. 
Also, comment out the
# lockfile bits above.

#START BLOCK
exit if (fork());
while (-e $lockfile) {
process($check_file) if (-r $original_dir/$check_file.$suffix);
infoinsert();
sleep 30;
}
#END BLOCK
##
#
# process($check_file) if (-r $original_dir/$check_file.$suffix);
#
##
sub process {
my $file = shift;
my @st = (stat($original_dir/$file.$suffix));
my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, 
$IsDST) = localtime($st[10]);
$Year += 1900;
$Month++;
my $stamp = sprintf %4d_%02d_%02d_%02d_%02d_%02d, $Year, $Month, $Day, 
$Hour, $Minute, $Second;
print renaming $original_dir/$file.$suffix to $new_dir/$stamp.$suffix\n;
rename $original_dir/$file.$suffix, $new_dir/$stamp.$suffix or warn 
couldn't rename file: $! $file to $new_dir/$file.$stamp.$suffix\n;
print adding $new_dir/$stamp.$suffix to database\n;
my $single_string = $new_dir . '/' . $stamp . '.' . $suffix;
infoinsert ($single_string);
}




#
# Connect to Database Named cctvimages on the localhost with the root user
# $dbh=DBI-connect(DBI:mysql;$database, $user, $password);
# and insert info about the file given as the argument $_[0];

#


sub infoinsert
{
my ($file) = @_;
dieFailed to get the info\n\$file is: $file if not defined $file;
my $dbh = DBI-connect(DBI:mysql:dbname=cctvimages;host=localhost,root,
**, {'RaiseError' = 1});
my $size;
my $mtime;
my $secs;
($size, $secs) = (stat ($file))[7,9];
$mtime = ParseDateString(epoch $secs);
# even after conversion ':' is used to seperate hh and mn and ss
$mtime =~ s/://g;
# the above swaps out the ':' for nothing
$file =~ s/\/home\/me\/images\///;
# the above strips path
printsize is $size\nmodified is $mtime\nfilename is $file\n;
my $rows_affected = $dbh-do(INSERT INTO imageinfo VALUES(null, '$file',
'$size', '$mtime'))
or die Do Fails: $DBI::errstr\n;
my $sql = SELECT * FROM imageinfo;
my $sth = $dbh-prepare($sql);
$sth-execute or dieExecute fails: $DBI::errstr\n;
$sth-finish;
$dbh-disconnect;
}


_
Surf together with new Shared Browsing 
http://join.msn.com/?page=features/browsepgmarket=en-gbXAPID=74DI=1059

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


combining two perl scripts together.

2003-03-16 Thread mel awaisi
Hi

i have 2 perl scripts that do the following:

The first is named renamer.pl. the script looks in to a directory namely 
/home/httpd/htdocs for files named images.jpg(coming from camera). the 
script renames the images with the date of the image, and moves to a new 
location namly /home/me/images/. this script is running all the time.

The Second script takes image information (name, date, and size) from the 
images directory (../me/images/) and insets into MySQL.

What the problem i am having is that the second script only starts manually. 
is there away i could start it automatically?

I would however prefer something else instead of starting it automatically. 
I would prefer to combine both scripts, so that when the images are renamed 
and relocated, in the same time, the data is inserted into MySQL.

I would really appreciate any help. please find enclosed both scripts:

Regards,

Mel

---renamer.pl
#!/usr/bin/perl
use strict;
use warnings;
=head1 NAME

# renamer - renames files received by ftp, moving them to a new directory

=head1 SYNOPSIS

   nohup ./renamer image /home/httpd/htdocs /home/me/images jpg 
renamer.process 

=head1 DESCRIPTION

#The above instructs renamer to look for files called image.jpg in 
/home/httpd/htdocs.
#It checks once per minute for such a file to appear.  If it sees a
#readable file called /home/httpd/htdocs.jpg it moves it to
#/home/httpd/htdocs/image.200302251530.jpg where the number is a
#time stamp with year (four digits), month, day of the month, hour (in
#24 mode), and minute.

#Read the bugs section closely.

=head1 BUGS

#The original and new directories must be on the same file system.
#The program probably does not work on windows systems.
#The daemon behavior is weak.
#Not much testing has been done, so the script may have other problems.
=cut

my $usage = EOUSAGE;
usage: $0 initial_name original_dir new_dir suffix lockfile
example: $0 pic /home/httpd/htdocs /home/me/images jpg 
/home/me/renamer.process
EOUSAGE

my $check_file   = shift or die $usage;
my $original_dir = shift or die $usage;
my $new_dir  = shift or die $usage;
my $suffix   = shift or die $usage;
my $lockfile = shift or die $usage;


##
# If you put it into the cron, comment out between the START and END BLOCK, 
and uncomment
# the section below it so you don't get multiple copies running. Also, 
comment out the
# lockfile bits above.
#START BLOCK
exit if (fork());

while (-e $lockfile) {
   process($check_file) if (-r $original_dir/$check_file.$suffix);
   sleep 30;
}
#END BLOCK
##
#
# process($check_file) if (-r $original_dir/$check_file.$suffix);
#
##
sub process {
   my $file = shift;
	my @st = (stat($original_dir/$file.$suffix));
	my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, 
$IsDST) = localtime($st[10]);
   $Year += 1900;
   $Month++;
   my $stamp = sprintf %4d_%02d_%02d_%02d_%02d_%02d, $Year, $Month, $Day, 
$Hour, $Minute, $Second;
   print renaming $original_dir/$file.$suffix to 
$new_dir/$stamp.$suffix\n;
   rename $original_dir/$file.$suffix, $new_dir/$stamp.$suffix or warn 
couldn't rename file: $! $file to $new_dir/$file.$stamp.$suffix\n;


# Maybe i could add the MySQL insert here

}
__
--infoinsert.pl

#!/usr/bin/perl -w

use strict;
use DBI;
use Date::Manip;

#
#   Connect to Database Named cctvimages on the localhost with the root user
#   $dbh=DBI-connect(DBI:mysql;$database, $user, $password);

#
my $dbh = DBI-connect(DBI:mysql:dbname=cctvimages;host=localhost,root,
, {'RaiseError' = 1});
my $file;
my $size;
my $mtime;
my $secs;


my $imagedir=/home/me/images;
chdir($imagedir) or die Can't cd to $imagedir; $!\n;
my @jpegs = *.jpg;
foreach (@jpegs)  {
 my $file = $_;




 #$file = /home/me/images/2003_03_11_14_32_42.jpg;

 ($size, $secs) = (stat ($file))[8,9];

 my $mtime = ParseDateString(epoch $secs);
# even after conversion ':' is used to seperate hh and mn and ss
 $mtime =~ s/://g;	# the above swaps out the ':' for nothing

 $file =~ s/\/home\/me\/images\///;	# the above strips path

 printsize is $size\nmodified is $mtime\nfilename is $file\n;

 my $rows_affected = $dbh-do(
INSERT INTO imageinfo
VALUES(null, '$file', '$size', '$mtime')
 ) or die Do Fails: $DBI::errstr\n;
 my $sql = SELECT * FROM imageinfo;
 my $sth = $dbh-prepare($sql);
 my $sth = $dbh-prepare($sql);
 $sth-execute or dieExecute fails: $DBI::errstr\n;
 $sth-finish;
}
$dbh-disconnect;

_
Express yourself with cool 

help needed in frames with php

2003-03-15 Thread mel awaisi
Hi,

help needed in frames with php

I have been trying to do this for sometime now, and i am getting 
frustratted.

i have a form that takes 2 variables (dates). the action of the form is set 
to index.php (a page with 2 frames) the index.php has one frame called 
mainmenu.php, which is a script that extracts data from MySQL using the 2 
variables entered in the form.

The index.php is not working as required, as the variables form the form are 
placed in index.php, rather than mainmenu.php. if i change the action to 
mainmenu.php. it works, but only the mainmenu is displayed, index.html is 
not.

Please help.

Regards,
Mel
_
Overloaded with spam? With MSN 8, you can filter it out 
http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


ls: *.jpg: No such file or directory

2003-03-11 Thread mel awaisi
Hi

My error is as the subject says, i have a script that i am trying in it to 
locate where a directory with images are.

the part in the script that the error i think is arising from is

my $dir = '/home/me/images/';
my @jpegs = `ls *.jpg`;
foreach (@jpegs) {
	print$_; 	# dont forget that a newline is still at the end of each 
element in the array...
}


ls: *.jpg: No such file or directory
---
Regards,

Mel

_
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Searchable archive for this list?

2003-03-10 Thread mel awaisi
Please tell me if you do find one?

Regards,

Mel





From: Deb [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Perl List [EMAIL PROTECTED]
Subject: Searchable archive for this list?
Date: Mon, 10 Mar 2003 07:31:04 -0800
Does anyone know of a searchable archive for the [EMAIL PROTECTED] list?

The archives I've located don't seem to be searchable...

Thanks,
d
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
Worried what your kids see online? Protect them better with MSN 8 
http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


store file paths in the database of the images

2003-03-08 Thread mel awaisi
Hi

I have a perl script that takes images coming from a camera 
/home/httpd/htdocs/image.jpg and renames them the date and time of images to 
/home/me/images/2003_7_3_20_11_23.jpg.

I would like to store file paths in the database of the images, (images 
header to include image_name, image_size and image_date) in order for a web 
user to be able to make a query which will display the image header and the 
image on the net.

Ideally i would like some kind of a user interface that a user can search 
between two times for images taken by camera (images are only taken by 
camera when movement happens), and then display the image with the name, 
size and the date.

I would really appreciate any help.

Regards,
Mel
_
Express yourself with cool emoticons http://messenger.msn.co.uk
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Problem with script:usage

2003-03-05 Thread mel awaisi
hi

Could someone please look at my script and tell me why i am getting this!!! 
please

[EMAIL PROTECTED] cgi-bin]# ./renamer.pl
[2] 11033
[1]   Exit 127renamer.pl
[EMAIL PROTECTED] cgi-bin]# usage: ./renamer.pl initial_name original_dir new_dir 
suffi
x
example: ./renamer.pl image /home/httpd/htdocs/ /home/me/images/ jpg

[2]+  Exit 255./renamer.pl
[EMAIL PROTECTED] cgi-bin]#
Regards,

Mel

_
Express yourself with cool emoticons http://messenger.msn.co.uk
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Script does not want to run, error

2003-03-05 Thread mel awaisi
Hi,

I am having problems opening this script on my machine. i have been getting 
help from a very helpful person on this list.

I have checked the shebang line, that perl exists, and perl -v gives proper 
output.

i try to run the script below as follow:

[EMAIL PROTECTED] httpd]# cd cgi-bin
[EMAIL PROTECTED] cgi-bin]# ls -la
total 28
drwxr-xr-x2 me   root 4096 Mar  5 21:49 .
drwxr-xr-x5 me   root 4096 Mar  3 01:50 ..
-rwxr-xr-x1 me   root  268 Mar  4 13:50 printenv
-rwxr-xr-x1 me   me   1792 Mar  5 15:20 renamer
-rwxr-xr-x1 me   me   1788 Mar  4 16:40 renamer.cgi
-rw---1 root root 1731 Mar  5 21:49 renamer.pl
-rwxr-xr-x1 me   root  757 Mar  3 01:50 test-cgi
[EMAIL PROTECTED] cgi-bin]# renamer.pl 
[1] 10254
[EMAIL PROTECTED] cgi-bin]# bash: renamer.pl: command not found
[1]+  Exit 127renamer.pl
[EMAIL PROTECTED] cgi-bin]#
[EMAIL PROTECTED] cgi-bin]# ./renamer.pl 
[1] 10297
[EMAIL PROTECTED] cgi-bin]# bash: ./renamer.pl: Permission denied
[1]+  Exit 126./renamer.pl
[EMAIL PROTECTED] cgi-bin]#


Regards,

Mel



_
Worried what your kids see online? Protect them better with MSN 8 
http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How to access CGI

2003-03-04 Thread mel awaisi
Hi

How do i access the files in my CGI-BIN, when my web site data is stored in 
/htdocs (a different directory).

/home/httpd/htdocs/index.htmlweb site files
/home/httpd/cgi-bin/ cgi files
Cheers

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Help really needed in this script: error: Prematue end of script header

2003-03-04 Thread mel awaisi
Hi,

I have with the help of one of the guys of this list got this script to take 
an image from one directory and then rename it with the time and date of the 
image and then store it onto a new directory.

I sotred the image in the cgi-bin, and then tried to run the file, i got 
errors, when i went to the errorlog i got an error saying:
Prematue end of script header: /home/httpd/cgi-bin.renamer.cgi

Regards,

Mel

#!/usr/bin/perl
use strict;
use warnings;
=head1 NAME

# renamer - renames files received by ftp, moving them to a new directory

=head1 SYNOPSIS

 nohup ./renamer image /home/httpd/htdocs /home/me/images jpg 

=head1 DESCRIPTION

#The above instructs renamer to look for files called image.jpg in 
/home/httpd/htdocs.
#It checks once per minute for such a file to appear.  If it sees a
#readable file called /home/httpd/htdocs.jpg it moves it to
#/home/httpd/htdocs/image.200302251530.jpg where the number is a
#time stamp with year (four digits), month, day of the month, hour (in
#24 mode), and minute.

#Read the bugs section closely.

=head1 BUGS

#The original and new directories must be on the same file system.
#The program probably does not work on windows systems.
#The daemon behavior is weak.
#Not much testing has been done, so the script may have other problems.
=cut

my $usage = EOUSAGE;
usage: $0 initial_name original_dir new_dir suffix
example: $0 pic /home/httpd/htdocs /home/me/images jpg
EOUSAGE
my $check_file   = shift or die $usage;
my $original_dir = shift or die $usage;
my $new_dir  = shift or die $usage;
my $suffix   = shift or die $usage;
exit if (fork());

while (1) {
 process($check_file) if (-r $original_dir/$check_file.$suffix);
 sleep 60;
}
sub process {
 my $file  = shift;
 my ($hour, $min, $mon, $day, $year) = (localtime)[1..5];
 $year += 1900;
 $mon++;
 my $stamp = $year$mon$day$hour$min;
 print
   renaming $original_dir/$file.$suffix to 
$new_dir/$file.$stamp.$suffix\n;
 rename $original_dir/$file.$suffix, $new_dir/$file.$stamp.$suffix
 or warn couldn't rename file $file to 
$new_dir/$file.$stamp.$suffix\n;
}

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Help really needed in this script: error: Prematue end of script header

2003-03-04 Thread mel awaisi
Hi,

I have with the help of one of the guys of this list got this script to take 
an image from one directory and then rename it with the time and date of the 
image and then store it onto a new directory.

I sotred the image in the cgi-bin, and then tried to run the file, i got 
errors, when i went to the errorlog i got an error saying:
Prematue end of script header: /home/httpd/cgi-bin.renamer.cgi

Regards,

Mel

#!/usr/bin/perl
use strict;
use warnings;
=head1 NAME

# renamer - renames files received by ftp, moving them to a new directory

=head1 SYNOPSIS

 nohup ./renamer image /home/httpd/htdocs /home/me/images jpg 

=head1 DESCRIPTION

#The above instructs renamer to look for files called image.jpg in 
/home/httpd/htdocs.
#It checks once per minute for such a file to appear.  If it sees a
#readable file called /home/httpd/htdocs.jpg it moves it to
#/home/httpd/htdocs/image.200302251530.jpg where the number is a
#time stamp with year (four digits), month, day of the month, hour (in
#24 mode), and minute.

#Read the bugs section closely.

=head1 BUGS

#The original and new directories must be on the same file system.
#The program probably does not work on windows systems.
#The daemon behavior is weak.
#Not much testing has been done, so the script may have other problems.
=cut

my $usage = EOUSAGE;
usage: $0 initial_name original_dir new_dir suffix
example: $0 pic /home/httpd/htdocs /home/me/images jpg
EOUSAGE
my $check_file   = shift or die $usage;
my $original_dir = shift or die $usage;
my $new_dir  = shift or die $usage;
my $suffix   = shift or die $usage;
exit if (fork());

while (1) {
 process($check_file) if (-r $original_dir/$check_file.$suffix);
 sleep 60;
}
sub process {
 my $file  = shift;
 my ($hour, $min, $mon, $day, $year) = (localtime)[1..5];
 $year += 1900;
 $mon++;
 my $stamp = $year$mon$day$hour$min;
 print
   renaming $original_dir/$file.$suffix to 
$new_dir/$file.$stamp.$suffix\n;
 rename $original_dir/$file.$suffix, $new_dir/$file.$stamp.$suffix
 or warn couldn't rename file $file to 
$new_dir/$file.$stamp.$suffix\n;
}

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]