Re: Thumbnail images on-the-fly

2002-01-16 Thread Briac Pilpré

Scott R. Godin wrote:
snip
 any pointers? I'm happy to toddle off and download and read my face off 
 -- that's not a problem.. I'd just like to have some indication on which 
 direction to start walking. :-)

Here are some Pictures Gallery-type modules that can be found on CPAN:
 Apache::Album: http://search.cpan.org/search?dist=Apache-Album
 HTML::PhotoAlbum: http://search.cpan.org/search?dist=HTML-PhotoAlbum
 Apache::PhotoIndex: http://search.cpan.org/search?dist=PhotoIndex

As for image manipulation tools, I use Image::Magick, which is really
powerful. The only drawback is that the learning curve is quite steep as
the documentation for this module can be hard to follow.

 http://www.imagemagick.org/
 http://search.cpan.org/search?dist=PerlMagick
 http://magick.net4tv.com/MagickStudio/scripts/advanced.cgi

 Good luck with your project!
 Briac

-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


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




[Fwd: Check Username and Password]

2002-01-16 Thread maureen


This may be a little off topic, but I hope someone can help me.

I set up this cgi file and html form on a Unix server. All functions of
the form and file worked correctly
on a Unix Server. However, I need to move these files to an IIS server.
In testing on the IIS server,  I get an HTTP Error 405- Method not
allowed when the form is submitted. 

I did some research, but was unable to determine which setting needs to
be changed on ISS to allow the post method. 

If anyone could help me out, I'd really appreciate it.

Thanks, Maureen
---BeginMessage---

--- maureen [EMAIL PROTECTED] wrote:
 
 Hello! In the following code verifies a password, passed from an html
 page:
 
 #check for proper password  
 if ($in{'password'} ne test)  
 { 
 
 I would like to change this so, the code looks at a text file of
 usernames and passwords, instead of the hardcoded password test. The
 text file currently exists and is formatted like this:
 
 bob|jane
 Jessica|732
 Mike|Chevy
 
 
 I'd appreciate any suggestions as to the best way to approach this.
 
 Thanks, Maureen

Maureen,

What a coincidence.  Yesterday, I posted the next lesson in my online CGI course and 
it covers
this very topic.  
http://www.easystreet.com/~ovid/cgi_course/lesson_four/lesson_four_2.html

I still need to do a little work on it as some of the terminology isn't exact, but 
this should
give you a good starting point.

Cheers,
Curtis Ovid Poe

=
Ovid on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




---End Message---

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


Getting NT print queue jobs via CGI

2002-01-16 Thread Kip DeGraaf

I'm trying to write a little piece of middleware to allow one of our
developers to use Flash to pull up a webpage that lists the current jobs in
a print queue in Windows NT.  I found this very nice little script called
NTPStat.pl at http://www.roth.net/perl/scripts/scripts.asp?NTPStat.pl and
removed the code for the deleting of a print job and hardcoded the server
that we need to query.  Ran the script in a command window and it works
wonderfully.

So I went and tried to turn it into a CGI script for use via a web page.
Now I get the following message after the column headings when I try to
access the CGI:

Unable to attach to registry key on MAIN

Where MAIN is the server whose queues I'm trying to access.


So, apparently I need to give the user account running the web service some
permissions, or should I run this script off of a webserver on MAIN?? 

Any pointers or security concerns I should be aware of would be greatly
appreciated.

Thank you,
Kip

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




RE: Getting NT print queue jobs via CGI

2002-01-16 Thread Aaron Shurts

This isn't PERL, but you could use regedt32.exe  to set permissions for
that user on the registry key.  I don't see any problems with giving
that user read permissions on that key.  They don't need to delete
things from the print queue do they? 

-_-Aaron

-Original Message-
From: Kip DeGraaf [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 6:56 AM
To: '[EMAIL PROTECTED]'
Subject: Getting NT print queue jobs via CGI


I'm trying to write a little piece of middleware to allow one of our
developers to use Flash to pull up a webpage that lists the current jobs
in
a print queue in Windows NT.  I found this very nice little script
called
NTPStat.pl at http://www.roth.net/perl/scripts/scripts.asp?NTPStat.pl
and
removed the code for the deleting of a print job and hardcoded the
server
that we need to query.  Ran the script in a command window and it works
wonderfully.

So I went and tried to turn it into a CGI script for use via a web page.
Now I get the following message after the column headings when I try to
access the CGI:

Unable to attach to registry key on MAIN

Where MAIN is the server whose queues I'm trying to access.


So, apparently I need to give the user account running the web service
some
permissions, or should I run this script off of a webserver on MAIN?? 

Any pointers or security concerns I should be aware of would be greatly
appreciated.

Thank you,
Kip

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


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




RE: Thumbnail images on-the-fly

2002-01-16 Thread John Edwards

I think you'll need to look at the image magik module for creating the
thumbnails. I've looked at this in the past, and come away with headaches,
but I believe it's the right tool for the job. Good luck

John

-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2002 10:24
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*,
4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Cgi on IIS

2002-01-16 Thread maureen


I hope someone can help me out.

I set up this cgi file and html form on a Unix server. The script
changes a user's password in a text file.

This works correctly on a Unix Server. However, I need to move these
files to an IIS server.
In testing on the IIS server,  I get an HTTP Error 405- Method not
allowed when the form is submitted. 

I did some research, but was unable to determine how to correct the
error. 

If anyone could help me out, I'd really appreciate it.

Thanks, Maureen

#!/usr/bin/perl
require cgi-lib.pl;
#process incoming form data 
ReadParse;
#set content type
print PrintHeader;
#initialize variables
$pwfile =
/data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.txt;
$tmpfile =
/data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.tmp;
$lokfile =
/data1/hypermart.net/worldwidewebstrategies/datafile/pwlock.fil;
#Print initial tags for web page
print HTMLBODY\n;
#check for existence of password file
unless (-e $pwfile)
{ 
#password file doesn't exist!
#print message  shut down
print PrintTag;
H1Sorry!/H1
P$pwfile has't been uploaded to the
proper directory. Please contact the webmaster./P
/BODY
/HTML
PrintTag
exit(0);
}
#check for blank form fields
if ($in{'oldname'}eq || $in{'oldpw'}eq)
{
#re-create form and shut down program
print PrintTag;
PBERROR:/B Please type your current username and
password in the spaces provided./P
FORM
ACTION=http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changepw.cgi;
METHOD=post
PYour current username:BR
INPUT TYPE=text NAME=oldname VALUE=$in{'oldname'}/P
PYour current password:BR
INPUT TYPE=textNAME=oldpw VALUE=$in{'oldpw'}/P
PYour new password:BR
INPUT TYPE=text NAME=newpw1 VALUE=$in{'newpw1'}/P
PType your new password again:BR
INPUT TYPE=text NAME=newpw2 VALUE=$in{'newpw2'}/P
P
PrintTag
if ($in{'delete'} eq yes)
{
print INPUT TYPE=\checkbox\ 
NAME=\delete\ VALUE=\yes\ CHECKED\n;
}
else
{
print \n;
}
print PrintTag;
/P
INPUT TYPE=submit VALUE=Change
/FORM
/BODY
/HTML
PrintTag
exit(0);  
} 
#make sure new passwords match 
if ($in{'newpw1'} ne $in{'newpw2'})
{ 
#re-create form and shut down program  
print PrintTag;
PBERROR:/B Your new passwords didn't match. 
You must type your new password exactly the same way twice. 
Please try again./P
FORM
ACTION=http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changepw.cgi;
METHOD=post
PYour current username:BR
INPUT TYPE=text NAME=oldname VALUE=$in{'oldname'}/P
PYour current password:BR
INPUT TYPE=text NAME=oldpw VALUE=$in{'oldpw'}/P
PYour new password:BR
INPUT TYPE=text NAME=newpw1/P
PType your new password again:BR
INPUT TYPE=text NAME=newpw2/P
INPUT TYPE=submit VALUE=Change
/FORM
/BODY
/HTML
PrintTag
exit(0);  
}
#check for existence of lock file  
if (-e $lokfile)   
{ 
#lock file exists! print message  shut down   
print PrintTag;
H1Try again!/H1  
PThe database is in use. Please try again later./P  
/BODY  
/HTML  
PrintTag
exit(0);  
} 
#everything is okay. Create lock file.  
open(LOCK_FILE, $lokfile) || 
die Couldn't create $lokfile\n;
#open password file in read-only mode 
open(FILE,$pwfile) || 
die Can't find $pwfile.\n; 
#store database contents in an array and close file
@indata = FILE;
close(FILE);
#open temp file in overwrite mode 
open(TEMP,$tmpfile) || 
die Can't create $tmpfile.\n; 
#copy password file contents to temp file 
#use a foreach loop to process each record in the array
foreach $i (@indata)
{
#remove hard return character from each record
chomp($i);
#split fields on pipe character
#assign a variable name to each of the fields
($username,$password) = split(/\|/,$i);
if ($username eq $in{'oldname'}  
$password eq $in{'oldpw'}  
$in{'delete'} ne yes)
{
print TEMP $in{'oldname'}|$in{'newpw1'}\n;   
print Ph1 Success!/h1Your password has been changed./P\n;
}
elsif ($username eq $in{'oldname'}  
$in{'delete'} eq yes)
{
print PYour password has been deleted./P\n;
}
else
{
print TEMP $i\n;
}
} 
#close temp file 
close(TEMP);
#change file names 
rename($pwfile, $pwfile..old); 
rename($tmpfile, $pwfile); 
#close and delete lock file 
close(LOCK_FILE); 
unlink($lokfile);
#close web page
print PThank you! /P\n;
print /BODY/HTML\n;
#end of script

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




Adding/deleting a file

2002-01-16 Thread rory oconnor

I need to touch a file with a 1 in it if a condition is true, and
either toggle the 1 to a 0 or delete the file (whichever is better,
probably toggle) if another condition is true.  Excuse my
newbie-ness...but can anyone give me some hints as to the correct syntax
for that?

thanks,

rory


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




Re: Adding/deleting a file

2002-01-16 Thread Ahmed Moustafa

Hi Rory,

Assuming that if there is a problem in opening the file then it's 0, I 
hope the following code helps.

#Code Begings
if (open (INFILE, file.txt)) {
 $flag = INFILE;
 close (INFILE);
} else {
 $flag = 0;
}

if ($flag == 0) {
 $flag = 1;
} else {
 $flag = 0;
}

open (OUTFILE, file.txt) || die;
print OUTFILE $flag;
close (OUTFILE);
#Code Ends

Regards,

Ahmed

Rory Oconnor wrote:

 I need to touch a file with a 1 in it if a condition is true, and
 either toggle the 1 to a 0 or delete the file (whichever is better,
 probably toggle) if another condition is true.  Excuse my
 newbie-ness...but can anyone give me some hints as to the correct syntax
 for that?
 
 thanks,
 
 rory


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




subroutine returning lines of text

2002-01-16 Thread Martin A. Hansen

hi

im wondering how i can make a subroutine that will return all text lines between 
certain marks such as START and STOP:

text file:

START
text
is here
and there
is
a
lot of it
STOP

so i would like to call the subroutine with the arguments START and STOP (because i 
may need more starts and stops later) and have the subroutine return the lines between 
START and STOP in a $.

i guess it should be pretty simple, however its out of my reach still :P

any help will be appreciated :) !

martin


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




Re: subroutine returning lines of text

2002-01-16 Thread Briac Pilpré

Martin A. Hansen wrote:
 im wondering how i can make a subroutine that will return all text
 lines between certain marks such as START and STOP:

Here's simple way to do it. It uses the '..' operator (see perldoc
perlop for more info about it).

Note that if START and STOP are in the same line, it will only print
this line. If you want to force START and STOP to be on different lines,
try using the '...' operator.

#!/usr/bin/perl -w
use strict;

my $start = 'START';
my $stop  = 'STOP';

while (DATA){
print if /$start/ .. /$stop/;
}

__DATA__
text
is here
and there
START
text
is here
and there
is
a
lot of it
STOP
text
is here
and there
__END__

-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


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




File::Find

2002-01-16 Thread Gary Hawkins

Here's a fairly simple little script to list directories and files recursively.
Couple questions:

-- Is it fairly simple to make it list everything in a properly indented
heirarchy?  (Somewhat similar to what windows explorer would look like if every
level were expanded).
-- In the sub, how can we know how many levels deep, to be able to add that
many tabs?
-- It would be useful to make it adhere to alphabetical order.  Right now,
maybe it is driven by creation date or something, not sure.

(If you're real new and want to try it, it will run as is, with only one likely
change necessary, to $toplevel).

#!/usr/local/bin/perl

use File::Find;

$toplevel = D:\\PERL;
$wildcardtab = ; # to be able to build these up, \t, \t\t, etc

find(\List, $toplevel);

sub List {
#$wildcardtab .= \t if some_condition;
print \n\n$wildcardtab$_ DIR\n if -d;
print \t$wildcardtab$_\n if -f;
}

Gary



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




Tr: creating DSN system

2002-01-16 Thread mb


-Message d'origine-
De : mb [EMAIL PROTECTED]
À : [EMAIL PROTECTED] [EMAIL PROTECTED]
Date : mercredi 16 janvier 2002 09:47
Objet : créating DSN system


Hi,
I'm trying to drive gestion commerial 100 data bases using ODBC 100 and do not 
found 
parameters (in any sage doc) to type on the -Data base admin ODBC32- window (on 
windows 98).

So I''m asking to get values of params below:
DATA PATH =   --is there a standard type 
of files do I must refer ?
SCHEMA PATH = ...
LOGON PATH = .


Thanks  in advance,   asma.





Re: File::Find

2002-01-16 Thread Sudarsan Raghavan

Gary Hawkins wrote:

 Here's a fairly simple little script to list directories and files recursively.
 Couple questions:

 -- Is it fairly simple to make it list everything in a properly indented
 heirarchy?  (Somewhat similar to what windows explorer would look like if every
 level were expanded).
 -- In the sub, how can we know how many levels deep, to be able to add that
 many tabs?
 -- It would be useful to make it adhere to alphabetical order.  Right now,
 maybe it is driven by creation date or something, not sure.

 (If you're real new and want to try it, it will run as is, with only one likely
 change necessary, to $toplevel).


Read through 'preprocess' subsection of the File::Find docs (perldoc File::Find).
This might be of help to you.

 hth,
 Sudarsan


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




RE: subroutine returning lines of text

2002-01-16 Thread Gary Hawkins

 im wondering how i can make a subroutine that will return all text
 lines between certain marks such as START and STOP:

 text file:

 START
 text
 is here
 and there
 is
 a
 lot of it
 STOP

 so i would like to call the subroutine with the arguments START and
 STOP (because i may need more starts and stops later) and have the
 subroutine return the lines between START and STOP in a $.

 i guess it should be pretty simple, however its out of my reach still :P

 any help will be appreciated :) !

 martin

Hi Martin,

Once upon a time (hmmm, last July) on another list I asked a similar question.
Japhy's answer might scramble some grey matter at first, but it works and you
might find it useful:

What's a good way to split up the contents of a file into separate arrays?

## Ignore   ##
stuff to ignore
## Preamble ##
Mary
## Body ##
had
a
## Epilog   ##
little lamb

Here's a cool trick:  use the $/ variable to change how much Perl reads in
when you use FH.

  my (@preamble, @body, @epilog);

  {
local $/ = \n## Preamble ##\n;
FILE;  # skip everything up to the beginning of the preamble

$/ = \n## Body ##\n;
chomp (my $pre_str = FILE);  # get everything to the end of pre.
@preamble = split /\n/, $pre_str;

$/ = \n## Epilog   ##\n;
chomp (my $bod_str = FILE);  # get everything to the end of body
@body = split /\n/, $bod_str;

$/ = undef;  # get everything else
chomp (my $epi_str = FILE);
@epilog = split /\n/, $epi_str;
  }

--


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




RE: File::Find

2002-01-16 Thread Gary Hawkins

 Read through 'preprocess' subsection of the File::Find docs
 (perldoc File::Find).
 This might be of help to you.

I already read the fantastic manual and was hoping for something that conveys
understanding.

preprocess
   The value should be a code reference. This code reference is used to
   preprocess a directory; it is called after readdir() but before the
   loop that calls the wanted() function. It is called with a list of
   strings and is expected to return a list of strings. The code can be
   used to sort the strings alphabetically, numerically, or to filter
   out directory entries based on their name alone.

/g



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




Re: Adding/deleting a file

2002-01-16 Thread John W. Krahn

Rory Oconnor wrote:
 
 I need to touch a file with a 1 in it if a condition is true, and
 either toggle the 1 to a 0 or delete the file (whichever is better,
 probably toggle) if another condition is true.  Excuse my
 newbie-ness...but can anyone give me some hints as to the correct syntax
 for that?


if ( $condition_is_true  !-e $file ) {
open FLAG,  $file or die Cannot create $file: $!;
close FLAG;

# process stuff here
}
elsif ( $another_condition_is_true  -e $file ) {
unlink $file or die Cannot delete $file: $!;

# process stuff here
}



John
-- 
use Perl;
program
fulfillment

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




Re: File::Find

2002-01-16 Thread Sudarsan Raghavan

Gary Hawkins wrote:

  Read through 'preprocess' subsection of the File::Find docs
  (perldoc File::Find).
  This might be of help to you.

 I already read the fantastic manual and was hoping for something that conveys
 understanding.

 preprocess
The value should be a code reference. This code reference is used to
preprocess a directory; it is called after readdir() but before the
loop that calls the wanted() function. It is called with a list of
strings and is expected to return a list of strings. The code can be
used to sort the strings alphabetically, numerically, or to filter
out directory entries based on their name alone.

This is an example code

  #!/usr/local/bin/perl
  use strict;
  use File::Find;

  find ( {wanted = \printFiles, preprocess = \sortFiles}, $yourdirname);
  # The first argument to the find routine can be a hash reference. The keys being 
the various
  #  operations that can be performed on the file. The 'preprocess' if specified 
is a reference to
  #  a subroutine. To this subroutine will be passed a list of files in the 
directory currently scanned.
  #  You can play around with list (sort it lexically etc.)
  #  To notice the difference in output comment the previous find call and 
uncomment the next
  #  find call.

 #find (\printFiles, 'dirs');
 sub sortFiles {
   sort (@_);
 }

 sub printFiles {
   print $File::Find::name\n;
 }

  hth,
  Sudarsan



 /g

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


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




RECOVERY

2002-01-16 Thread nafiseh saberi

hi dear team.
hope you be fine.

I dorp one important table in postgres:(
how can I recover it ??
thx for your favour.
thx for your time.
_
 Have a nice day

Sincerely yours Nafiseh Saberi  

The amount of beauty required to 
   launch one ship.

 I appreciate your sugesstions 




Win32::ActAcc - where from to download

2002-01-16 Thread Abhra Debroy

Hello All

Can anybody tell me where from I can down load 'Win32::ActAcc'. I tried it
from CPAN but failed.

Thanks

Abhra


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




Re: Win32::ActAcc - where from to download

2002-01-16 Thread Briac Pilpré

Abhra Debroy wrote:
 Can anybody tell me where from I can down load 'Win32::ActAcc'. I tried it
 from CPAN but failed.

Get the .zip here:

http://cpan.valueclick.com/authors/id/P/PB/PBWOLF/Win32-ActAcc-0.5.zip

then:

1 Unzip the zip (Win32-ActAcc-n.n.zip). Make sure your unzip program
preserved the directory tree: for example, you should see
Win32-ActAcc.tar.gz in an x86 subdirectory under the directory that
contains ActAcc.html (the documentation).

2   Open a command prompt window.

3 In the command prompt, cd to the directory that contains
ActAcc.html.

4 In the command prompt, issue the following command:

ppm install --location=.  Win32-ActAcc 
 
-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


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




Re: gt

2002-01-16 Thread Roger C Haslock

 depending on the locale!

- Original Message -
From: Hanson, Robert [EMAIL PROTECTED]
To: 'Naveen Parmar' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 15, 2002 7:16 PM
Subject: RE: gt


 Yes, but it is greater than in a character code sense.  So b (ASCII
98)
 is greater than a (ASCII 97), but A (ASCII 65) is less than a.  So
if
 you need to compare 2 strings disregarding case you would want this:

 lc($word1) gt lc($word2)

 Rob

 -Original Message-
 From: Naveen Parmar [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 15, 2002 2:03 PM
 To: [EMAIL PROTECTED]
 Subject: gt


 Is the following correct? Does 'gt' stand for 'greater than'?

 $word1 gt $word2 -- The string $word1 comes after $word2

 - NP


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







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




Re: Out of memory!

2002-01-16 Thread Jenda Krynicky

From: Edson Alvarenga (EDB) [EMAIL PROTECTED]

I've almost deleted the mail without reading. Please include what module 
do you have problems with in the subject!

 I'm writing a script file in order to get the print queues, but
 when I call the function EnumJobsA at the first time in order to
 know what is the size that I need to allocate for the buffer the
 function return the value 538976288 and when I try to alloc ate
 this value in a buffer variable the system abbend the script and
 return the error message Out of memory!. 

If you'd print the 

unpack( 'H*', $pcbSizeRequired)

you would find out that it consists of the four spaces. That is the value was 
not changed ... because the call failed. There are several more problems with your 
code.
See below.

  this is my script file -
 
 use Win32::API;
 use strict;
 
 my $printer_name = 'nt_xerox';
 my $OpenPrinter;
 $OpenPrinter ||= Win32::API-new( 'winspool.drv','OpenPrinter',
  [qw( P L P )],'N') or return;
 my $printer_handle = ' ' x 4;

It's better to use

my $printer_handle = \0 x 4

It's easier to see that the call failed and did not modify the value.

 $OpenPrinter-Call( $printer_name, $printer_handle, undef);

You should check the result and print the error message if necessary:

$OpenPrinter-Call( $printer_name, $printer_handle, undef)
 or die Win32::FormatMessage(Win32::GetLastError());


 my ($pcbSizeRequired, $pcbBytesReturned, $pl_bytes_needed, $sizeof_ji1_struct,
 $info_structs, $ji1structs, $long, $EnumJobs);
   
 $pcbSizeRequired  = ' ' x 4; # Reserve space for LONG
 $pcbBytesReturned = ' ' x 4; # Reserve space for LONG
 
 $EnumJobs ||= Win32::API-new('winspool.drv','EnumJobsA',[qw( L P P P P P P P 
)],'L'); 

You have the types wrong. If the MSDN says a parameters is DWORD you should use L and 
not P.

$EnumJobs ||= Win32::API-new('winspool.drv','EnumJobsA',[qw( L L L L P L P P 
)],'L'); 

 $EnumJobs-Call($printer_name, 0, 255, 1, $info_structs, 1, $pcbSizeRequired, 
 $pcbBytesReturned ); 

Again you should test for errors.

Plus there are two errors in that statement. First you should pass the handle you got 
from 
OpenPrinter, not the printer name. Second you pass a NULL pointer to the buffer, but 
claim that the buffer's 1 byte long. Even though it's unlikely there will only be one 
byte
of data for the printer, it's better to pass 0.

unless ($EnumJobs-Call($printer_handle, 0, 255, 1, $info_structs, 0, 
$pcbSizeRequired, $pcbBytesReturned )) {
my $error = Win32::GetLastError();
die Win32::FormatMessage($error). ($error)\n unless $error = 122; 
#ignore the expected data area too small error
}

As you can see we want to ignore the error that the buffer was too small.

 $pl_bytes_needed = unpack('L',$pcbSizeRequired);
 print Bytes Needed=$pl_bytes_needed\n\n;

To make it easier here is the whole script after all my changes :

#perl
use Win32::API;
use strict;

my $printer_name = 'HP LaserJet 4050 Series PCL';
my $OpenPrinter;
$OpenPrinter ||= Win32::API-new( 'winspool.drv','OpenPrinter',
 [qw( P P P )],'N') or return;
my $printer_handle = \0 x 4;
$OpenPrinter-Call( $printer_name, $printer_handle, undef)
 or die Win32::FormatMessage(Win32::GetLastError());

$printer_handle = unpack('L',$printer_handle);

my ($pcbSizeRequired, $pcbBytesReturned, $pl_bytes_needed, $sizeof_ji1_struct,
$info_structs, $ji1structs, $long, $EnumJobs);

$pcbSizeRequired  = \0 x 4; # Reserve space for LONG
$pcbBytesReturned = \0 x 4; # Reserve space for LONG

$EnumJobs ||= Win32::API-new('winspool.drv','EnumJobsA',[qw( L L L L P L P P )],'L'); 

unless ($EnumJobs-Call($printer_handle, 0, 255, 1, $info_structs, 0, 
$pcbSizeRequired, $pcbBytesReturned )) {
my $error = Win32::GetLastError();
die Win32::FormatMessage($error). ($error)\n unless $error = 122; 
#ignore the expected data area too small error
}

$pl_bytes_needed = unpack('L',$pcbSizeRequired);
print Bytes Needed=$pl_bytes_needed\n\n;

$info_structs = \0 x $pl_bytes_needed;

$EnumJobs-Call($printer_handle, 0, 255, 1, $info_structs, $pl_bytes_needed, 
$pcbSizeRequired, 
$pcbBytesReturned )
or die Win32::FormatMessage(Win32::GetLastError());

print INFO: $info_structs\n;
__END__

I'm too lazy to parse the $info_struct ;-)

HTH, Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




Re: RECOVERY

2002-01-16 Thread Brett W. McCoy

 I dorp one important table in postgres:(
 how can I recover it ??
 thx for your favour.
 thx for your time.

Uh, oh... you're probably out of luck.  Unless you have a backup of the
data or the original SQL you used to create the table, you won't be able
to recover your table.

BTW, you might want to join the PostgreSQL beginners list (I think it's
called Novice).  You can get to it via www.postgresql.org.  A lot fo the
actual PostgreSQL developers hang out on that list.

-- Brett
  http://www.chapelperilous.net/

BEWARE!  People acting under the influence of human nature.


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




take the file name in as an argument of the function

2002-01-16 Thread Booher Timothy B 1stLt AFRL/MNAC

Hello all.

I want to be able to take the file name in as an argument of the function,
for example:

%Extract.pl MyFile.txt

I know that I could use:

#!/usr/bin/perl
while () {

}

But how could I take two arguments from the command line:

i.e. my guess:

%Test.pl Foo Bar

#/!/usr/bin/perl
 $A = $ARGV[0];
 $B = $ARGV[1];
print Thing A: $A  Thing B: $B;

Thanks,

Tim



Reading Directories

2002-01-16 Thread Caroline Warnock

I'm trying to use the following, in order to be able to print the
names of sub-directories within a directory:

1   $folder = /home/cwarnock/public_html/staged/DEVELOPMENT/; 
2
3   opendir(DEV, $folder);
4
5   @all_files = readdir(DEV);
6
7   foreach $Name (@all_files) {
8   print  $Name;
9   if(-d $Name){
10  print $Name\n; 
11  }

I know that the directory has at least 4 sub-directories.

The 'print $Name;' on line 8, correctly prints all the sub-directory
and file names as well as '.' and '..'.
However, the 'print $Name\n;' on line 10 (after the if statement)
only prints '.' and '..'. None of the other 4 directories are
printed.

I have also tried using 'if(-f $Name)' to see if files will be
printed but these do not appear to be being picked up.

Is there any explanation as to why this may be happening.

Thank you for your help.

Caroline Warnock

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




Re: Reading Directories

2002-01-16 Thread Tanton Gibbs

Unless $folder is the current directory, you will either need to prepend it
to the name of the directory you are checking or cd to that directory.

i.e.

foreach $Name (@all_files) {
  print $Name;
  if( -d $folder/$Name ) {
print $Name;
  }
}
- Original Message -
From: Caroline Warnock [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 11:04 AM
Subject: Reading Directories


 I'm trying to use the following, in order to be able to print the
 names of sub-directories within a directory:

 1 $folder = /home/cwarnock/public_html/staged/DEVELOPMENT/;
 2
 3 opendir(DEV, $folder);
 4
 5 @all_files = readdir(DEV);
 6
 7 foreach $Name (@all_files) {
 8 print  $Name;
 9 if(-d $Name){
 10 print $Name\n;
 11 }

 I know that the directory has at least 4 sub-directories.

 The 'print $Name;' on line 8, correctly prints all the sub-directory
 and file names as well as '.' and '..'.
 However, the 'print $Name\n;' on line 10 (after the if statement)
 only prints '.' and '..'. None of the other 4 directories are
 printed.

 I have also tried using 'if(-f $Name)' to see if files will be
 printed but these do not appear to be being picked up.

 Is there any explanation as to why this may be happening.

 Thank you for your help.

 Caroline Warnock

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



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




Re: Reading Directories

2002-01-16 Thread Jenda Krynicky

From:   Caroline Warnock [EMAIL PROTECTED]

 I'm trying to use the following, in order to be able to print the
 names of sub-directories within a directory:
 
 1 $folder = /home/cwarnock/public_html/staged/DEVELOPMENT/; 
 2
 3 opendir(DEV, $folder);
 4
 5 @all_files = readdir(DEV);
 6
 7 foreach $Name (@all_files) {
 8 print  $Name;
 9 if(-d $Name){
 10print $Name\n; 
 11}
 
 I know that the directory has at least 4 sub-directories.
 
 The 'print $Name;' on line 8, correctly prints all the sub-directory
 and file names as well as '.' and '..'.
 However, the 'print $Name\n;' on line 10 (after the if statement)
 only prints '.' and '..'. None of the other 4 directories are
 printed.

The readdir only returns the NAME of the file/directory, not the 
whole path. So you have to use

if (-d $folder/$Name) ...

Jenda


=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




Re: take the file name in as an argument of the function

2002-01-16 Thread Johnathan Kupferer



But how could I take two arguments from the command line:

i.e. my guess:

%Test.pl Foo Bar

#/!/usr/bin/perl
 $A = $ARGV[0];
 $B = $ARGV[1];
   print Thing A: $A  Thing B: $B;


I think you already answered your own question!  Though your shebang 
line should be #!/usr/bin/perl.

Other ways of doing this are:

#!/usr/bin/perl
($A, $B) = @ARGV;

#!/usr/bin/perl
use strict;
# Lets be strict and explicitly declare $A and $B.
my ($A, $B) = @ARGV;

#!/usr/bin/perl
use strict;
# After this @ARGV will be two elements shorter.
# if @ARGV contains ('foo.txt','bar.txt','another.txt','yetanother.txt') now
my $A = shift @ARGV;
my $B = shift @ARGV;
# then @ARGV contains ('another.txt','yetanother.txt') now.



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




RE: Maintaining a Cache of Hash References

2002-01-16 Thread Tomasi, Chuck

 sub GetUser
 {
  my ($id, $user)=@_; # record number and hash reference to
 populate
 
  if (defined($UserCache[$id])) {
 $user = $UserCache[$id]; 

 return(1);   

  }
 
  # Store the info from the DB for later
  $UserCache[$id] = $user;
 
  return 1;
 }
 
 To change the value PASSED to the function, you must modify the
 corresponding element in @_:
 
   $_[1] = $UserCache[$id];

Tried it, didn't work.  When the select from the database is made, and
populates $user-{FieldName}, I'm populating $user, not $_[1], so why
would I have to operate any differently when referencing a different source
of the data?  I know data is getting in to the cache because
$UserCache[$id]-{'Name'} prints out the data I expect.  It just isn't
getting back to the sub that called GetUser (yes, I checked many times to
make sure I'm passing \%user).


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




RE: Maintaining a Cache of Hash References

2002-01-16 Thread Tomasi, Chuck

I'll have to keep this in mind.  I don't think it applies here since my
return value is either a 0 or a 1 (no records read or valid data found).  I
fill in the hash reference from the database data.

It never hurts to learn about a new module!

--Chuck

 -Original Message-
 From: Frank [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 15, 2002 11:59 AM
 To: '[EMAIL PROTECTED]'
 Subject: Re: Maintaining a Cache of Hash References
 
 
 On Tue, Jan 15, 2002 at 11:41:28AM -0600, Tomasi, wrote:
  I'm trying to maintain a cache of hashes to reduce database 
 hits.  What I
  want is to determine if I've retrieved the data from the DB 
 before, if so,
  just pass back the copy of information used last time, 
 otherwise read it
  from the DB and make a note of it.  It would seem I'm not 
 copying the
  information in to the $user arg properly.  Something like this:
  
 ---end quoted text---
 
 There is the Memoize module that caches the results of a function
 
 sub somefunc {
   # hit db
   return $results;
 }
 
 use Memoize;
 memoize('somefunc');
 
 IIRC it then seemlessly caches in the background, for DB stuff also
 checkout the expiring caches, in case values change in the DB.
 
 Documentation here: 
 http://theoryx5.uwinnipeg.ca/CPAN/data/perl/Memoize.html
 
 -- 
  Frank Booth - Consultant
 Parasol Solutions Limited.
 (www.parasolsolutions.com)
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

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




Re: Win32::ActAcc - where from to download

2002-01-16 Thread Shaun Sloan

Abhra DebroyIn wrote:

 Win32::ActAcc
Available at:
http://uiarchive.uiuc.edu/mirrors/ftp/cpan.cse.msu.edu/modules/by-category/22_
Microsoft_Windows_Modules/Win32/Win32-ActAcc-1.0.zip 

Shaun

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




Thumbnail images on-the-fly

2002-01-16 Thread Scott R. Godin

I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*, 4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-)

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




RE: Thumbnail images on-the-fly

2002-01-16 Thread John Edwards

I think you'll need to look at the image magik module for creating the
thumbnails. I've looked at this in the past, and come away with headaches,
but I believe it's the right tool for the job. Good luck

John

-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: 16 January 2002 10:24
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*,
4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




RE: Thumbnail images on-the-fly

2002-01-16 Thread Hanson, Robert


I suggest using Image::Magick for generating thumnails.  It is painless to
do and the resulting files are of good quality.  Here is a code snippet:

use Image::Magick;

my $im = new Image::Magick();
$im-Read($inputfile);
$im-Resize( geometry = 200x200 );
$im-Write($outputfile);
undef $im;

I would also not have the CGI script handle this as it could be slow if
there are lots of files to process or very large images.  Instead try a cron
job (or some scheduled task) to create the thumbnails.  So when a new image
is uploaded the CGI script handling that could add an entry in a log, then
the scheduled task would check the log for files to process and handle them.
But that is just a suggestion.

Rob


-Original Message-
From: Scott R. Godin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 5:24 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Thumbnail images on-the-fly


I've got an idea kicking around in my head .. 

having a web-directory that can have image files added to it, taken 
away, or prefaced with . to have them be ignored temporarily without 
removing them.

initial run of the .cgi indexes the directory into a local database 
file, and creates thumbnails of each image in the directory (havn't 
decided whether they should be variable size yet, as I'm not certain 
about the tool I'd need to use for this)

future runs of the .cgi double check the directory, match it against the 
database and create further thumbnails if necessary, or update the db to 
reflect images no longer listed, or marked with . as in do not display

upon updating, it then provides an html-page with the thumbnails laid 
out in a table for easy clicking by the user. 

This is pretty straightforward, and I'm sure it's been done in the past. 

What I'm looking for is a bit of a shove in the right direction from 
those of you who have walked this path before.. I've never worked with 
the graphical Perl modules yet, and am really unfamiliar with which 
tools (i.e. modules) would be the most elegant and efficient for a job 
like this. 

any pointers? I'm happy to toddle off and download and read my face off 
-- that's not a problem.. I'd just like to have some indication on which 
direction to start walking. :-)

print pack H*,
4a75737420416e6f74686572204d61635065726c204861636b65722c0d;
-- 
Scott R. Godin| e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |web : http://www.webdragon.net/
It is not necessary to cc: me via e-mail unless you mean to speak off-group.
I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox.
:-)

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

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




Re: take the file name in as an argument of the function

2002-01-16 Thread Jonathan E. Paton

Hi,

For anything more complex than a simple script you should
consider using switches and parameters.

You know, something like this [highly dangerous] dd
command:

dd if=/dev/zero of=/dev/hda7 count=1 bs=512

Or:

tar -zxvf archive.tar.gz

Processing these can be quite hard, but guess what... there
is a module to do it for you.  Take a look at the
documentation for them at:

perldoc Getopt::Long
perldoc GetOptions
perldoc GetOptions::Std

To do that dd command you'd do _something_ like:

use GetOptions;

my ($if, $of, $bs, $count);
GetOptions(if:s= \$if,
   of:s= \$of,
   bs:s= \$bs,
   count:s = \$count);

My preference is for Getopt::Long, but didn't fit my
example.  Hope you find this useful knowledge, whether or
not it fits in with your current task.

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: Thumbnail images on-the-fly

2002-01-16 Thread Daniel Gardner

Wednesday, January 16, 2002, 10:24:27 AM, Scott R. Godin wrote:

 I've got an idea kicking around in my head .. 

 having a web-directory that can have image files added to it, taken 
 away, or prefaced with . to have them be ignored temporarily without 
 removing them.

[snip]

 any pointers? I'm happy to toddle off and download and read my face off 
 -- that's not a problem.. I'd just like to have some indication on which 
 direction to start walking. :-)


If you're feeling a bit sadistic and want to walk for many,
many miles you could try to make something as clever as
Apache::Gallery.

It uses mod_perl, Inline::C and a C libary called imlib2 to
do it's thing. The guy who wrote it has a demo site at
http://pictures.legart.dk/

Very comprehensive, very good, and a long way to walk - but
very educational and a fun trip if you make it over the
mountains



-- 
Best Regards,
Daniel[EMAIL PROTECTED]


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




time function

2002-01-16 Thread Roy Peters

I need someone to tell me the function that will convert time in this
format to epoch time: 1/17/2002 11:15 AM



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




Re: Matching Problem (Solved)

2002-01-16 Thread Lysander

I didn't think I needed the \s+ because in the perlre man page it says
$ matches the end of the line before the last newline.

Anyway, that did work so I wanted to thank you.

Sheridan

- Original Message -
From: Tanton Gibbs [EMAIL PROTECTED]
To: Lysander [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, January 15, 2002 4:59 PM
Subject: Re: Matching Problem


 If it really is a blank line, then it will have a newline and won't match
 /^$/

 therefore, chomp the string before trying to match against it, or test for
 spaces
 /^\s+$/
 - Original Message -
 From: Lysander [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, January 15, 2002 6:07 PM
 Subject: Re: Matching Problem


  - Original Message -
  From: Jenda Krynicky [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, January 15, 2002 4:28 PM
  Subject: Re: Matching Problem
 
 
   From:   Lysander [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject:Matching Problem
   Date sent:  Tue, 15 Jan 2002 16:07:41 -0600
  
I setup sendmail to forward mail for a specifc addy to my PERL
script.
I can't figure out how to match the blank line between the header
and
  the
body of the message, though.
   
I got ?^$? from an example in the perlop man page, but it doesn't
seem
  to be
working.
Does anyone have a suggestion?  Below is the block of code in
 question:
   
# Allow filename to be used instead of STDIN for debugging purposes
open (STDIN, $ARGV[0]) if (($ARGV[0] ne )  ($ARGV[0] ne -));
   
$msgbody = 0;
   
@mail = STDIN;
for $mail (@mail)
{
  if ($msgbody == 1)
  {
$count = @body;
@body[$count] = $mail;
  } else {
$msgbody = 1 if ($mail =~ ?^$?);  #Find Blank Line After Header
  }
}
  
   You should either use /^$/ instead or make sure you use the ?^$?
   correctly. Please reread the description in perlop manpage and if
   you are not sure you understand it use /^$/ instead.
  
   I've never used the ?? operator, so maybe you should not either :-)
  
   Jenda
 
  I tried:
 
  $msgbody = 1 if ($mail =~ /^$/);  #Find Blank Line After Header
 
  $msgbody = 1 if ($mail =~ m/^$/);  #Find Blank Line After Header
 
  $_ = $mail;
  $msgbody = 1 if (?^$?);  #Find Blank Line After Header
 
  $_ = $mail;
  $msgbody = 1 if (/^$/);  #Find Blank Line After Header
 
  and none of them worked.


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Re: time function

2002-01-16 Thread Jeff 'japhy' Pinyan

On Jan 16, Roy Peters said:

I need someone to tell me the function that will convert time in this
format to epoch time: 1/17/2002 11:15 AM

If localtime() isn't good enough for you, then perhaps you'll want to use
the POSIX strftime() function, or you could hand-roll a solution.

  my ($min, $hr, $day, $mon, $year) = (localtime)[1..5];
  my $date = sprintf(
%d/%d/%d %d:%d %s,   # format string
$mon + 1, $day, $year + 1900,  # date
(($hr - 1) % 12 + 1), $min,# time
$hr  12 ? AM : PM # mode
  );

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **
stu what does y/// stand for?  tenderpuss why, yansliterate of course.


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




RE: time function

2002-01-16 Thread Hanson, Robert

You could also use the Date::Parse module, part of the TimeDate package...

use Date::Parse;

my $epoch = str2time('1/17/2002 11:15 AM');


Rob

-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 12:57 PM
To: Roy Peters
Cc: [EMAIL PROTECTED]
Subject: Re: time function


On Jan 16, Roy Peters said:

I need someone to tell me the function that will convert time in this
format to epoch time: 1/17/2002 11:15 AM

If localtime() isn't good enough for you, then perhaps you'll want to use
the POSIX strftime() function, or you could hand-roll a solution.

  my ($min, $hr, $day, $mon, $year) = (localtime)[1..5];
  my $date = sprintf(
%d/%d/%d %d:%d %s,   # format string
$mon + 1, $day, $year + 1900,  # date
(($hr - 1) % 12 + 1), $min,# time
$hr  12 ? AM : PM # mode
  );

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for Regular Expressions in Perl published by Manning, in 2002 **
stu what does y/// stand for?  tenderpuss why, yansliterate of course.


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

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




RE: time function

2002-01-16 Thread Peter Cornelius

To convert *to* seconds since the epoch you want the timelocal() function.
It's part of the Time::Local standard module and takes input in the form of
localtime's output.  From 'perldoc Time::Local'

use Time::Local;

$time = timelocal($sec,$min,$hours,$mday,$mon,$year);

so a completely worthless example would be

$epoch_time = timelocal(localtime());

In your case you just need to parse the string up to get a the individual
pieces.

Hope this helps,
Peter C.

-Original Message-
From: Roy Peters [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 9:45 AM
To: [EMAIL PROTECTED]
Subject: time function


I need someone to tell me the function that will convert time in this
format to epoch time: 1/17/2002 11:15 AM



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


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




Security advice: SHA vs crypt for authenticator

2002-01-16 Thread GoodleafJ

Hello,
I'm using a nice little GDBM file for authentication. It just stores users
and passwords as SHA1 hashes. When I need to authenticate someone (fewer
than 15 lines in the dbm file) I just tie it and compare the SHA'd user
input against the hex value in the dbm file. (The file is not publicly
readable.)

It has been suggested, however, that this is not adequately secure and that
the passwords would be better stored crypted or some such. I don't really
see the difference between a SHA password and a crypted password in this
context. Wouldn't they be equally difficult to crack?

Oh, I should add that the authenticator runs as part of a server daemon on
a remote system, and so authentication is performed as the same user each
time.

Just wanted to collect some opinions before I go further. (I'm perfectly
willing to accept the possibility I'm wrong--if I weren't I wouldn't
ask--so fire away.)

Thanks,
John


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




Re: Thumbnail images on-the-fly

2002-01-16 Thread Johnathan Kupferer

Your choices are basically GD or Image-Magick I've had good experiences 
with both.  Image::Magick is more full featured but slower so if you're 
doing anything on the fly you should use GD, but if its just a one pass 
sort of thing (and I think that is what you're doing) then Image::Magick 
is better suited.  There are at least a couple online tutorials for both 
but I learned how to use them from O'Reilly's Programming Web Graphics 
with Perl  GNU Software.  That book is starting to get dated since 
there have been some significant changes in the GD module regarding GIF 
support but its still a great reference.

- Johnathan


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




Won't write IP address to file

2002-01-16 Thread K.L. Hayes

Hello All,

Could somebody please help me figure out why the following code will
not write the IP address to a file?

I've verified that the code can find the file, open it  overwrite any
junk/test data already there with nothing. I've also printed out the
IP address on the previous page using just the print statement.

CODE
sub pcheck {
if (param('pwd') eq $pw ) {
open  (CHECK,${path}dmp.dat) || die Cannot open dmp.dat: $!;
flock (CHECK, 2) if ($flock);
while (CHECK) {
print $ENV{'REMOTE_ADDR'}; }
close (CHECK);
flock (CHECK, 8) if ($flock);
} else  { invalid_info; }
ad2;
}
/CODE

All help is appreciated. Thank you for your time.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=+
+ Only two things are infinite, the universe and +
+ human stupidity, and I'm not sure about the former.+
+ -- Albert Einstien  +
+=+



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




RE: Won't write IP address to file

2002-01-16 Thread Hanson, Robert

It looks like you forgot to specify the file handle when printing.

print CHECK $ENV{'REMOTE_ADDR'}; }

Rob


-Original Message-
From: K.L. Hayes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 6:23 PM
To: [EMAIL PROTECTED]
Subject: Won't write IP address to file


Hello All,

Could somebody please help me figure out why the following code will
not write the IP address to a file?

I've verified that the code can find the file, open it  overwrite any
junk/test data already there with nothing. I've also printed out the
IP address on the previous page using just the print statement.

CODE
sub pcheck {
if (param('pwd') eq $pw ) {
open  (CHECK,${path}dmp.dat) || die Cannot open dmp.dat: $!;
flock (CHECK, 2) if ($flock);
while (CHECK) {
print $ENV{'REMOTE_ADDR'}; }
close (CHECK);
flock (CHECK, 8) if ($flock);
} else  { invalid_info; }
ad2;
}
/CODE

All help is appreciated. Thank you for your time.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=+
+ Only two things are infinite, the universe and +
+ human stupidity, and I'm not sure about the former.+
+ -- Albert Einstien  +
+=+



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

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




Re[2]: Won't write IP address to file

2002-01-16 Thread K.L. Hayes

Hello Robert,

Duh! Thanks! I knew it was something stupid/simple. I just couldn't
figure IT out AND be pulled in 20 other directions at the same time.

Sometimes another eye planted in the middle of my forehead would
really come in handy... *;) Thanks again for your time!

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

Wednesday, January 16, 2002, 12:32:06 PM, you wrote:

HR It looks like you forgot to specify the file handle when printing.

HR print CHECK $ENV{'REMOTE_ADDR'}; }

HR Rob


HR -Original Message-
HR From: K.L. Hayes [mailto:[EMAIL PROTECTED]]
HR Sent: Wednesday, January 16, 2002 6:23 PM
HR To: [EMAIL PROTECTED]
HR Subject: Won't write IP address to file


HR Hello All,

HR Could somebody please help me figure out why the following code will
HR not write the IP address to a file?

HR I've verified that the code can find the file, open it  overwrite any
HR junk/test data already there with nothing. I've also printed out the
HR IP address on the previous page using just the print statement.

HR CODE
HR sub pcheck {
HR if (param('pwd') eq $pw ) {
HR open  (CHECK,${path}dmp.dat) || die Cannot open dmp.dat: $!;
HR flock (CHECK, 2) if ($flock);
HR while (CHECK) {
HR print $ENV{'REMOTE_ADDR'}; }
HR close (CHECK);
HR flock (CHECK, 8) if ($flock);
HR } else  { invalid_info; }
HR ad2;
HR }
HR /CODE

HR All help is appreciated. Thank you for your time.



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




SEND

2002-01-16 Thread Oktay Ahmed

Hi

Ý am a very beginner in Perl. Here is my problem:

I want to send some data on (via) established connection (telnet). I don't 
need any code to establish connection, to login, etc. I just need to send 
data (including \n at the end). How to do this?

What modules I have to use?

Sorry for asking this kind of simple questions...

Best,
Oktay

-
Oktay AHMED, MA, Chairman
MENSA MACEDONIA, The High-IQ Society
P.O.Box 747, 1000 Skopje, Macedonia
E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
Web: www.mensa.org.mk
Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
-



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




verifying if a server is listening on a port

2002-01-16 Thread charles

i am hoping to use perl to verify whether a remote machine is listening on 
UDP/69. i've found some examples, and modified them slightly to come up 
with the attached snippet of code. the output always seems to be that the 
port is up. i am imagining that $disconn is never being set to true 
since the $checkport will always at least attempt a connection.

maybe my reasoning to that is incorrect, but i guess, that is why i am 
writing :) any help is appreciated. thanks -charles


#!/usr/bin/perl -w

use strict;
use IO::Socket;

my $remoteip = 10.6.21.10;
my $port = 69;
my $proto = udp;
 my $disconn = 0;
 my $checkport = IO::Socket::INET-new(
  PeerAddr = $remoteip,
  PeerPort = $port,
  Proto = $proto,
  Timeout = '0') or $disconn = 1;

 if ($disconn) {
   print   Port $port is down.\n;
 } else {
  print   Port $port is up.\n;
 }
 close $checkport;



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




RE: SEND

2002-01-16 Thread Hanson, Robert

You can't send data through an open Telnet session if that is what you are
thinking. (disclaimer: maybe you can, but good luck trying to do that).
What you want is to use the Net::Telnet module.

use Net::Telnet;

# Open a telnet session
my $t = new Net::Telnet (Timeout = 10);
$t-open(1.2.3.4);

# Login
$t-login($username, $passwd);

# Execute the command 'ls' (or whatever you need) when you see the prompt '$
'
$t-cmd(String = 'ls', Prompt = '/\$ $/');

# Close the connection
$t-close;

Or are you just trying to upload data?  Anyway, check out the Net::Telnet
docs, it might do exactly what you need.

Rob


-Original Message-
From: Oktay Ahmed [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 17, 2002 12:48 AM
To: [EMAIL PROTECTED]
Subject: SEND


Hi

Ý am a very beginner in Perl. Here is my problem:

I want to send some data on (via) established connection (telnet). I don't 
need any code to establish connection, to login, etc. I just need to send 
data (including \n at the end). How to do this?

What modules I have to use?

Sorry for asking this kind of simple questions...

Best,
Oktay

-
Oktay AHMED, MA, Chairman
MENSA MACEDONIA, The High-IQ Society
P.O.Box 747, 1000 Skopje, Macedonia
E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
Web: www.mensa.org.mk
Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
-



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

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




Re: SEND

2002-01-16 Thread Agustin Rivera

Is there a way with Net::Telnet that I can read data and send data
simultaneously?  Or how about capturing the data that comes in to a
variable?

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



- Original Message -
From: Hanson, Robert [EMAIL PROTECTED]
To: 'Oktay Ahmed' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 1:12 PM
Subject: RE: SEND


 You can't send data through an open Telnet session if that is what you are
 thinking. (disclaimer: maybe you can, but good luck trying to do that).
 What you want is to use the Net::Telnet module.

 use Net::Telnet;

 # Open a telnet session
 my $t = new Net::Telnet (Timeout = 10);
 $t-open(1.2.3.4);

 # Login
 $t-login($username, $passwd);

 # Execute the command 'ls' (or whatever you need) when you see the prompt
'$
 '
 $t-cmd(String = 'ls', Prompt = '/\$ $/');

 # Close the connection
 $t-close;

 Or are you just trying to upload data?  Anyway, check out the Net::Telnet
 docs, it might do exactly what you need.

 Rob


 -Original Message-
 From: Oktay Ahmed [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 17, 2002 12:48 AM
 To: [EMAIL PROTECTED]
 Subject: SEND


 Hi

 Ý am a very beginner in Perl. Here is my problem:

 I want to send some data on (via) established connection (telnet). I don't
 need any code to establish connection, to login, etc. I just need to send
 data (including \n at the end). How to do this?

 What modules I have to use?

 Sorry for asking this kind of simple questions...

 Best,
 Oktay

 -
 Oktay AHMED, MA, Chairman
 MENSA MACEDONIA, The High-IQ Society
 P.O.Box 747, 1000 Skopje, Macedonia
 E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Web: www.mensa.org.mk
 Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
 -



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

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


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




Conditional Expressions

2002-01-16 Thread Naveen Parmar

The following conditional expression tests whether the value of $number1 is 
negative or greater than 12:

(($number1  1) || ($number1  12))

Shouldn't this test whether the number is 0, negative, or  12? Is this 
unique to the way Perl uses numbers?

TIA,
- NP

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




RE: SEND

2002-01-16 Thread Hanson, Robert

All the module allows you to do is open up a telnet session and interact
with it.  So yes, you can store the return value of a command into a
variable like this:

my $host = $t-cmd(String = 'hostname', Prompt = '/\$ $/')

I'm not sure what you mean by sending/read data at the sime time.  I am
thinking that you can't do that, at least not the way you want.  You could
always open up two telnet sessions if you needed to, but you would need to
have two seperate processes (fork) and then have the processes talk to one
another.

Rob


-Original Message-
From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 4:15 PM
To: Hanson, Robert; 'Oktay Ahmed'; [EMAIL PROTECTED]
Subject: Re: SEND


Is there a way with Net::Telnet that I can read data and send data
simultaneously?  Or how about capturing the data that comes in to a
variable?

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



- Original Message -
From: Hanson, Robert [EMAIL PROTECTED]
To: 'Oktay Ahmed' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 1:12 PM
Subject: RE: SEND


 You can't send data through an open Telnet session if that is what you are
 thinking. (disclaimer: maybe you can, but good luck trying to do that).
 What you want is to use the Net::Telnet module.

 use Net::Telnet;

 # Open a telnet session
 my $t = new Net::Telnet (Timeout = 10);
 $t-open(1.2.3.4);

 # Login
 $t-login($username, $passwd);

 # Execute the command 'ls' (or whatever you need) when you see the prompt
'$
 '
 $t-cmd(String = 'ls', Prompt = '/\$ $/');

 # Close the connection
 $t-close;

 Or are you just trying to upload data?  Anyway, check out the Net::Telnet
 docs, it might do exactly what you need.

 Rob


 -Original Message-
 From: Oktay Ahmed [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 17, 2002 12:48 AM
 To: [EMAIL PROTECTED]
 Subject: SEND


 Hi

 Ý am a very beginner in Perl. Here is my problem:

 I want to send some data on (via) established connection (telnet). I don't
 need any code to establish connection, to login, etc. I just need to send
 data (including \n at the end). How to do this?

 What modules I have to use?

 Sorry for asking this kind of simple questions...

 Best,
 Oktay

 -
 Oktay AHMED, MA, Chairman
 MENSA MACEDONIA, The High-IQ Society
 P.O.Box 747, 1000 Skopje, Macedonia
 E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Web: www.mensa.org.mk
 Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
 -



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

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

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




RE: Conditional Expressions

2002-01-16 Thread Wagner-David

If really want negative then the 1 should be 0.
Wags ;)

-Original Message-
From: Naveen Parmar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 13:20
To: [EMAIL PROTECTED]
Subject: Conditional Expressions


The following conditional expression tests whether the value of $number1 is 
negative or greater than 12:

(($number1  1) || ($number1  12))

Shouldn't this test whether the number is 0, negative, or  12? Is this 
unique to the way Perl uses numbers?

TIA,
- NP

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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

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




RE: verifying if a server is listening on a port

2002-01-16 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 16, 2002 4:01 PM
 To: Perl Discuss
 Subject: verifying if a server is listening on a port
 
 
 i am hoping to use perl to verify whether a remote machine is 
 listening on 
 UDP/69. i've found some examples, and modified them slightly 
 to come up 
 with the attached snippet of code. the output always seems to 
 be that the 
 port is up. i am imagining that $disconn is never being set to true 
 since the $checkport will always at least attempt a connection.
 
 maybe my reasoning to that is incorrect, but i guess, that is 
 why i am 
 writing :) any help is appreciated. thanks -charles

connect() on a SOCK_DGRAM (UDP) socket doesn't really do anything;
it just caches the address for future calls to send().

Since UDP does not guarantee delivery, you have to send a message
and get a response from the server according to some higher-level
protocol.

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




Re: SEND

2002-01-16 Thread Agustin Rivera

Ok, thanks.  But now you've made me curious about fork..

You can make the two processes of a fork talk to each other?  How?  I've
tried setting a variable in the child and printing in the parent, but that
didn't work.

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



- Original Message -
From: Hanson, Robert [EMAIL PROTECTED]
To: 'Agustin Rivera' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 1:29 PM
Subject: RE: SEND


 All the module allows you to do is open up a telnet session and interact
 with it.  So yes, you can store the return value of a command into a
 variable like this:

 my $host = $t-cmd(String = 'hostname', Prompt = '/\$ $/')

 I'm not sure what you mean by sending/read data at the sime time.  I am
 thinking that you can't do that, at least not the way you want.  You could
 always open up two telnet sessions if you needed to, but you would need to
 have two seperate processes (fork) and then have the processes talk to one
 another.

 Rob


 -Original Message-
 From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 16, 2002 4:15 PM
 To: Hanson, Robert; 'Oktay Ahmed'; [EMAIL PROTECTED]
 Subject: Re: SEND


 Is there a way with Net::Telnet that I can read data and send data
 simultaneously?  Or how about capturing the data that comes in to a
 variable?

 Agustin Rivera
 Webmaster, Pollstar.com
 http://www.pollstar.com



 - Original Message -
 From: Hanson, Robert [EMAIL PROTECTED]
 To: 'Oktay Ahmed' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Wednesday, January 16, 2002 1:12 PM
 Subject: RE: SEND


  You can't send data through an open Telnet session if that is what you
are
  thinking. (disclaimer: maybe you can, but good luck trying to do that).
  What you want is to use the Net::Telnet module.
 
  use Net::Telnet;
 
  # Open a telnet session
  my $t = new Net::Telnet (Timeout = 10);
  $t-open(1.2.3.4);
 
  # Login
  $t-login($username, $passwd);
 
  # Execute the command 'ls' (or whatever you need) when you see the
prompt
 '$
  '
  $t-cmd(String = 'ls', Prompt = '/\$ $/');
 
  # Close the connection
  $t-close;
 
  Or are you just trying to upload data?  Anyway, check out the
Net::Telnet
  docs, it might do exactly what you need.
 
  Rob
 
 
  -Original Message-
  From: Oktay Ahmed [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 17, 2002 12:48 AM
  To: [EMAIL PROTECTED]
  Subject: SEND
 
 
  Hi
 
  Ý am a very beginner in Perl. Here is my problem:
 
  I want to send some data on (via) established connection (telnet). I
don't
  need any code to establish connection, to login, etc. I just need to
send
  data (including \n at the end). How to do this?
 
  What modules I have to use?
 
  Sorry for asking this kind of simple questions...
 
  Best,
  Oktay
 
  -
  Oktay AHMED, MA, Chairman
  MENSA MACEDONIA, The High-IQ Society
  P.O.Box 747, 1000 Skopje, Macedonia
  E-mail: [EMAIL PROTECTED], [EMAIL PROTECTED]
  Web: www.mensa.org.mk
  Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
  -
 
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

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


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




RE: SEND

2002-01-16 Thread Bob Showalter

 -Original Message-
 From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 16, 2002 4:27 PM
 To: Hanson, Robert; [EMAIL PROTECTED]
 Subject: Re: SEND
 
 
 Ok, thanks.  But now you've made me curious about fork..
 
 You can make the two processes of a fork talk to each other?  
 How?  I've
 tried setting a variable in the child and printing in the 
 parent, but that
 didn't work.

Processes can't access one another's memory, so you need to
use some form of IPC (interprocess communication). Examples
are pipes, signals, shared memory, message queues, semaphores

These are discussed at length in perldoc perlipc.

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




Re: Running commands as variables

2002-01-16 Thread Brett W. McCoy

On Wed, 16 Jan 2002, David Ulevitch wrote:

   I am trying to do this:
   $ns1_in = `/usr/local/sbin/iptables -xvnL |grep 'mrtg' |grep -v 'Chain' |grep 
'ns1-in' |awk '{print $2}'`;

   but perl thinks the $2 is for it so it evals it (to '') and then awk
   in return prints the whole line, as opposed to the $2 that I want.

   Escaping the $2 to \$2 didn't work.

   I know this could be done in perl, but I'm always one for the quick
   and dirty CLI way first. ;-)

I think if you set your qx symbol to be ', it will turn off interpolation:

$ns1_in = qx'your commands';

Of course, you will need to escape any single quotes with the comamnd-line
string itself.

I really do recommend rewriting this in Perl anyway -- it wouldn't be that
much more difficult, and would make it more maintainable.  I would start
with something like:

open IPTABLE, '/usr/local/sbin/iptables |' or die Can't fork: $!\n;

while(IPTABLE) {

  #do stuff with output, which is in $_

}

-- Brett
  http://www.chapelperilous.net/

Breadth-first search is the bulldozer of science.
-- Randy Goebel


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




Re: Running commands as variables

2002-01-16 Thread Briac Pilpré

In article [EMAIL PROTECTED], David Ulevitch wrote:
   I am trying to do this:
   $ns1_in = `/usr/local/sbin/iptables -xvnL |grep 'mrtg' |grep -v 'Chain' |grep 
'ns1-in' |awk '{print $2}'`;
 
   but perl thinks the $2 is for it so it evals it (to '') and then awk
   in return prints the whole line, as opposed to the $2 that I want.

 try with the following syntax:
 $ns1_n = qx( ... );

 the qx() operator acts as the q or qq operator, by allowing you to
 choose your own set of delimiters.
 see perldoc perlop for more infos.

-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


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




RE: verifying if a server is listening on a port

2002-01-16 Thread charles


so, i would need to use something like $checkport-send(); and get a 
response from the tftp server to verify the port is listening correct?

thanks -c

On Wed, 16 Jan 2002, Bob Showalter wrote:

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, January 16, 2002 4:01 PM
  To: Perl Discuss
  Subject: verifying if a server is listening on a port
  
  
  i am hoping to use perl to verify whether a remote machine is 
  listening on 
  UDP/69. i've found some examples, and modified them slightly 
  to come up 
  with the attached snippet of code. the output always seems to 
  be that the 
  port is up. i am imagining that $disconn is never being set to true 
  since the $checkport will always at least attempt a connection.
  
  maybe my reasoning to that is incorrect, but i guess, that is 
  why i am 
  writing :) any help is appreciated. thanks -charles
 
 connect() on a SOCK_DGRAM (UDP) socket doesn't really do anything;
 it just caches the address for future calls to send().
 
 Since UDP does not guarantee delivery, you have to send a message
 and get a response from the server according to some higher-level
 protocol.
 
 


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




Finding a running process in Windows

2002-01-16 Thread SathishDuraisamy

Hi All,

Does anyone know how to find ( in a PERL script running under Windows)
whether a process( program ) is already running or not. In Unix, I can
easily do this using the 'ps' command in backticks. I don't know how to do
this in Windows.  Any thoughts?

Thanks,
sathish


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




RE: verifying if a server is listening on a port

2002-01-16 Thread Bob Showalter

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 16, 2002 4:49 PM
 To: Bob Showalter
 Cc: Perl Discuss
 Subject: RE: verifying if a server is listening on a port
 
 
 
 so, i would need to use something like $checkport-send(); and get a 
 response from the tftp server to verify the port is listening correct?

Right. But since it's tftp, just try to put or get the file and
check to see if it worked. You should probably consider using the
Net::TFTP module from CPAN.

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




Re[2]: Won't write IP address to file

2002-01-16 Thread K.L. Hayes

Hello Robert,

After trying your advise it still didn't write to the file. Went  had
some dinner... came back  it was obvious... Took the while (CHECK)
statement out  it worked like a charm.

Whomever says that your stomach  brain aren't connected... is just
wrong... in my case anyway... ;)

Posted the solution in case anybody wanted to know.

Thanks again!

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

Wednesday, January 16, 2002, 12:32:06 PM, you wrote:

HR It looks like you forgot to specify the file handle when printing.

HR print CHECK $ENV{'REMOTE_ADDR'}; }

HR Rob


HR -Original Message-
HR From: K.L. Hayes [mailto:[EMAIL PROTECTED]]
HR Sent: Wednesday, January 16, 2002 6:23 PM
HR To: [EMAIL PROTECTED]
HR Subject: Won't write IP address to file


HR Hello All,

HR Could somebody please help me figure out why the following code will
HR not write the IP address to a file?

HR I've verified that the code can find the file, open it  overwrite any
HR junk/test data already there with nothing. I've also printed out the
HR IP address on the previous page using just the print statement.

HR CODE
HR sub pcheck {
HR if (param('pwd') eq $pw ) {
HR open  (CHECK,${path}dmp.dat) || die Cannot open dmp.dat: $!;
HR flock (CHECK, 2) if ($flock);
HR while (CHECK) {
HR print $ENV{'REMOTE_ADDR'}; }
HR close (CHECK);
HR flock (CHECK, 8) if ($flock);
HR } else  { invalid_info; }
HR ad2;
HR }
HR /CODE

HR All help is appreciated. Thank you for your time.



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




Random Access Numbers

2002-01-16 Thread Naveen Parmar

Is there is a built in function in Perl for generating random access #s?

How would that function be used?

TIA,
- NP

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




Re: Cgi on IIS

2002-01-16 Thread Johnathan Kupferer

Hanson, Robert wrote:

It's been a long time since I worked on IIS, but I believe the Method not
allowed error refers to GET, POST, PUT, and HEAD.  In IIS you can
allow/deny each of these, but I forget exactly where in the MMC that this
was located, it was with the file types.

So maybe .cgi doesn't have GET access (or whatever you are trying to do).
It could also be a permissions problem.  Make sure that the group Everyone
can write to the file (or at least the username that the web server uses
would need to)

If you're using ActivePerl, the default is to expect all perl files to 
end in .pl  You'll also have to make sure the directory the script is 
located in allows executables.  You can configure these through the 
Internet Services Manager.  Active perl should configure everything you 
will need except the directory permissions.

- Johnathan



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




RE: verifying if a server is listening on a port

2002-01-16 Thread charles

 
 Right. But since it's tftp, just try to put or get the file and
 check to see if it worked. You should probably consider using the
 Net::TFTP module from CPAN.
 

i'll looks into net::tftp. but i dont think the get/put will
give me what i need since i really want to use this as a check
to see whether or not tftp is running before i start my actual
tftp transfer. the app i am writing will just trudge along and
try to force a remote device to tftp its config to the server
whether or not the tftp server is running. i was hoping to put
in a test that could check to see if the port is listening, so
the script could exit if it is not.

thanks for your input. i appreciate it. -charles


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




Re: Running commands as variables

2002-01-16 Thread John W. Krahn

David Ulevitch wrote:
 
   I am trying to do this:
   $ns1_in = `/usr/local/sbin/iptables -xvnL |grep 'mrtg' |grep -v 'Chain' |grep 
'ns1-in' |awk '{print $2}'`;
 
   but perl thinks the $2 is for it so it evals it (to '') and then awk
   in return prints the whole line, as opposed to the $2 that I want.
 
   Escaping the $2 to \$2 didn't work.
 
   I know this could be done in perl, but I'm always one for the quick
   and dirty CLI way first. ;-)


One way to do this to perl:

/mrtg/ and !/Chain/ and /ns1-in/ and $ns1_in = (split)[1] for 
`/usr/local/sbin/iptables -xvnL`;



John
-- 
use Perl;
program
fulfillment

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




Re[2]: Won't write IP address to file

2002-01-16 Thread K.L. Hayes

Hello John,

Just wanted to say Thank You for ripping my poor little code segment
apart the way you did. Some might be offended if you did it to them,
but not me... IT MAKES ME A BETTER PERL HACKER! :)

Thanks for opening my eyes to some of my stupid code  enlightening
me to some new ways of doing things. Since some of my reference
material is a couple years old, I welcome the help in getting it
right. In the future I'll make it a point to cross reference my books
to perldoc to save everybody some time.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

Wednesday, January 16, 2002, 2:12:13 PM, you wrote:

JWK K.L. Hayes wrote:
 
 Hello All,

JWK Hello,

 Could somebody please help me figure out why the following code will
 not write the IP address to a file?
 
 I've verified that the code can find the file, open it  overwrite any
 junk/test data already there with nothing. I've also printed out the
 IP address on the previous page using just the print statement.
 
 CODE
 sub pcheck {
 if (param('pwd') eq $pw ) {
 open  (CHECK,${path}dmp.dat) || die Cannot open dmp.dat: $!;
 flock (CHECK, 2) if ($flock);

JWK use Fcntl ':flock';

JWK if ( $flock ) {
JWK flock( CHECK, LOCK_EX ) or die Cannot lock dmp.dat: $!;
JWK }


 while (CHECK) {

JWK You need this line only if you are reading data IN from a file, not
JWK writing OUT to a file.


 print $ENV{'REMOTE_ADDR'}; }

JWK print CHECK $ENV{'REMOTE_ADDR'};


 close (CHECK);
 flock (CHECK, 8) if ($flock);

JWK There is no point in trying to unlock the file now, the close() has
JWK already unlocked it.


 } else  { invalid_info; }

JWK   } else  { invalid_info() }

 ad2;

JWK   ad2();

JWK When you call subroutines you shouldn't use an ampersand unless you
JWK understand how and why it behaves differently.

JWK perldoc perlsub


 }
 /CODE
 
 All help is appreciated. Thank you for your time.



JWK John



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




Pattern Matching - Remove Alpha

2002-01-16 Thread Hewlett Pickens

I am unable to use split with pattern matching to remove alpha characters
from a string and will appreciate a pointer on what I'm doing wrong. (Have
looked in Learning Perl and Programming Perl but can't spot my error.)

The detail:

 $stat is a string that has alpha and numeric data in it.
 I want to remove all of the alpha and put the numeric data into an array.

 The first attempt:

   my @nums = split(/a-zA-Z/,$stat); # removes all data from the string

 The second attempt:

   my @nums = split(/a-z/,$stat); # removes all data from the string

From reading, my understanding of split:  Discards all data that matches
the pattern and returns a set of list values for the unmatched data. (my
understanding may be the problem)

This pattern works - removes all blanks (white space) but leaves alpha and
numbers which of course isn't what I want

   my @nums = split(/ +/,$stat);   # removes all blanks 

Hewlett


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




Greedy 'split' ???

2002-01-16 Thread Scott Lutz


$DOM_NAME, my $TLD) = split(/\./, $domain);
creates two variable out of an inputted domain name, 

until this comes along:
domainname.org.uk

which it interprets as : 
$DOM_NAME = domainname
$TLD = org

so is it possible to do a 'greedy split' ??


Scott Lutz
Pacific Online Support
Phone: 604.638.6010
Fax: 604.638.6020
Toll Free: 1.877.503.9870
http://www.paconline.net


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




RE: Pattern Matching - Remove Alpha

2002-01-16 Thread Wagner-David

Could do something like:

   @MyNbrs = map{ /(\d+)/g } $MyInp;

Small script:

my @MyNbrs = ();

while ( 1 ) {
   printf Please enter string of data:\n;
   chomp(my $MyInp = STDIN);
   last if ( $MyInp =~ /^ex$/i );
   @MyNbrs = map{ /(\d+)/g } $MyInp;
   my $MyCnt = 1;
   foreach ( @MyNbrs ) {
  printf %3d: %6d\n, $MyCnt++, $_;
}
 }

Input:
adfafdafd1234erer12dasd34qweqeqweqw4567

Output:

  1:   1234
  2: 12
  3: 34
  4:   4567

Wags ;)
-Original Message-
From: Hewlett Pickens [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 15:39
To: [EMAIL PROTECTED]
Subject: Pattern Matching - Remove Alpha


I am unable to use split with pattern matching to remove alpha characters
from a string and will appreciate a pointer on what I'm doing wrong. (Have
looked in Learning Perl and Programming Perl but can't spot my error.)

The detail:

 $stat is a string that has alpha and numeric data in it.
 I want to remove all of the alpha and put the numeric data into an array.

 The first attempt:

   my @nums = split(/a-zA-Z/,$stat); # removes all data from the string

 The second attempt:

   my @nums = split(/a-z/,$stat); # removes all data from the string

From reading, my understanding of split:  Discards all data that matches
the pattern and returns a set of list values for the unmatched data. (my
understanding may be the problem)

This pattern works - removes all blanks (white space) but leaves alpha and
numbers which of course isn't what I want

   my @nums = split(/ +/,$stat);   # removes all blanks 

Hewlett


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

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




Re: extracting links.. continued..

2002-01-16 Thread Michael Fowler

On Thu, Jan 17, 2002 at 10:10:16AM +1000, Lorne Easton wrote:
 Thanks for the advice. I looked at using HTML::LinkExtor but decided against
 it.

Why would you do that?  HTML is deceptively difficult to parse; given a
choice, an already mature parser is usually much preferable to a hand-rolled
solution.

I would suggest using HTML::SimpleLinkExtor.

use HTML::SimpleLinkExtor;

sub get_urls {
my ($data) = @_;

print $data;

my $extor = HTML::SimpleLinkExtor-new();
$extor-parse($data);

return $extor-a;
}


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: Greedy 'split' ???

2002-01-16 Thread Michael Fowler

On Wed, Jan 16, 2002 at 03:57:44PM -0800, Scott Lutz wrote:
 
 $DOM_NAME, my $TLD) = split(/\./, $domain);
 creates two variable out of an inputted domain name, 
 
 until this comes along:
   domainname.org.uk
 
 which it interprets as : 
   $DOM_NAME = domainname
   $TLD = org
 
 so is it possible to do a 'greedy split' ??

Specifying a third argument to split would solve this problem how you want. 
E.g.

my $domain = domainname.org.uk;
my($DOM_NAME, $TLD) = split(/\./, $domain, 2);

$DOM_NAME eq 'domainname'
$TLD  eq 'org.uk'

However, unless you're guaranteed that the first portion of the name will be
the domain, and the last portion will be the toplevel, this won't work in
all situations.  Given the above, www.foo.org.uk would parse as 'www' and
'foo.org.uk'.  The only solution to this problem would be to know what
toplevels you can have and parse it based on that.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: Pattern Matching - Remove Alpha

2002-01-16 Thread Michael Fowler

On Wed, Jan 16, 2002 at 05:38:56PM -0600, Hewlett Pickens wrote:
 The detail:
 
  $stat is a string that has alpha and numeric data in it.
  I want to remove all of the alpha and put the numeric data into an array.
 
  The first attempt:
 
my @nums = split(/a-zA-Z/,$stat); # removes all data from the string
 
  The second attempt:
 
my @nums = split(/a-z/,$stat); # removes all data from the string

You've somehow got tr/// and regexes confused, or perhaps tr/// and split,
or perhaps you're just making stuff up.  ;)

Regardless, split(/a-zA-Z/, $stat) splits the string $stat on the string
a-zA-Z.  Say, for example, $stat = foo bar a-zA-Z baz qux.  Your split
would result in the list (foo bar ,  baz qux).  You were probably aiming
for the regex /[a-zA-Z]/, or better yet, \w, as in, split(/\w/, $stat), or
perhaps split(/\w+/, $stat).

Please read perldoc perlre and the regex sections of your books.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




RE: extracting links from HTML data (7my own problem usiing grep

2002-01-16 Thread mike

On Wed, 2002-01-16 at 07:15, Gary Hawkins wrote:
  However the script continues
  print @list3;
  my $var1='META';
  @lista= grep{$var1} @list3;## not picked up at all
  print @lista
  
  anyone any clues
 
 Suppose I'm a little confused but perhaps you meant:
 
 print @list3;
 @lista= grep(/META/, @list3);
 print @lista;
 
 /g

thanks a lot

couple of points

this is basically a learning/getting rid of rustiness exercise
why is this syntax not mentioned in programming perl - any ideas?

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




Re: Greedy 'split' ???

2002-01-16 Thread mike

On Thu, 2002-01-17 at 00:55, Michael Fowler wrote:
 On Wed, Jan 16, 2002 at 03:57:44PM -0800, Scott Lutz wrote:
  
  $DOM_NAME, my $TLD) = split(/\./, $domain);
  creates two variable out of an inputted domain name, 
  
  until this comes along:
  domainname.org.uk
  
  which it interprets as : 
  $DOM_NAME = domainname
  $TLD = org
  
  so is it possible to do a 'greedy split' ??
 
 Specifying a third argument to split would solve this problem how you want. 
 E.g.
 
 my $domain = domainname.org.uk;
 my($DOM_NAME, $TLD) = split(/\./, $domain, 2);
 
 $DOM_NAME eq 'domainname'
 $TLD  eq 'org.uk'
 
 However, unless you're guaranteed that the first portion of the name will be
 the domain, and the last portion will be the toplevel, this won't work in
 all situations.  Given the above, www.foo.org.uk would parse as 'www' and
 'foo.org.uk'.  The only solution to this problem would be to know what
 toplevels you can have and parse it based on that.

as an idea would using reverse on the string before split be an idea,
then reversing the spit strinngs + a join on $array[1],array[2] etc


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




Re: Security advice: SHA vs crypt for authenticator

2002-01-16 Thread Steven Brooks

On Wednesday 16 January 2002 11:45 am, [EMAIL PROTECTED] wrote:
 Hello,
 I'm using a nice little GDBM file for authentication. It just stores users
 and passwords as SHA1 hashes. When I need to authenticate someone (fewer
 than 15 lines in the dbm file) I just tie it and compare the SHA'd user
 input against the hex value in the dbm file. (The file is not publicly
 readable.)

 It has been suggested, however, that this is not adequately secure and that
 the passwords would be better stored crypted or some such. I don't really
 see the difference between a SHA password and a crypted password in this
 context. Wouldn't they be equally difficult to crack?

 Oh, I should add that the authenticator runs as part of a server daemon on
 a remote system, and so authentication is performed as the same user each
 time.

 Just wanted to collect some opinions before I go further. (I'm perfectly
 willing to accept the possibility I'm wrong--if I weren't I wouldn't
 ask--so fire away.)

 Thanks,
 John

Do you mean hash the password then encrypt the file that lists the hashes, or 
keep the passwords plaintext and encrypt the file?

A few concerns I can see would be if the hashes where plaintext and the file 
was encrypted would be if you broke that, then you'd have all the passwords.  
Also if someone had an account, they'd know their own username/password and 
may help with a known clear-text attack.

If the passwords where hashed, then stored in a plaintext file (like the 
passwd file on Unix/Linux systems), then that would leave them more open to 
dictionary attacks.  But you said it wasn't world-readable, so I guess that 
would make it more like shadow passwords, but still, if someone got the file, 
they could use a dictionary attack (like the crack program).

If you hashed the passwords then encrypted the file, it would make it more 
difficult to crack, but then you'd have to decrypt the entire file everytime 
you wanted to check a password (probably more pain than it's worth, 
especially if it really starts slowing down authentication).

There are tons of different options, but limiting it to these options, I'd 
probably suggest that you hash the passwords, then limit who has access to 
the file.

There's tons of webpages on encryption and subjects like this.  I'd check 
them out too.  (can't think of any of the top of my head).


Steven

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




Re: What are the uses of the =~ operator?

2002-01-16 Thread Steven Brooks

On Wednesday 16 January 2002 03:56 pm, rabs wrote:
 I am new to regualr expressions and becoming  accqainted with the =~
 operator. It appears to me that the =~ allows me to match a pattern in a
 REGEX against a variable. As such it  replaces the $_ varible.

 $name =~ /[rabs]/;

 mtaches with a string containing   any of the following characters   r a b
 s

 is this correct? I am quite confused

The following text is from the perlop man-page (perldoc perlop)  -- Steven

Binary =~ binds a scalar expression to a pattern match.
   Certain operations search or modify the string $_ by
   default.  This operator makes that kind of operation work
   on some other string.  The right argument is a search pat­
   tern, substitution, or transliteration.  The left argument
   is what is supposed to be searched, substituted, or
   transliterated instead of the default $_.  When used in
   scalar context, the return value generally indicates the
   success of the operation.  Behavior in list context
   depends on the particular operator.  See the Regexp Quote-
   Like Operators entry elsewhere in this document for
   details.

   If the right argument is an expression rather than a
   search pattern, substitution, or transliteration, it is
   interpreted as a search pattern at run time.  This can be
   less efficient than an explicit search, because the pat­
   tern must be compiled every time the expression is evalu­
   ated.

   Binary !~ is just like =~ except the return value is
   negated in the logical sense.

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




Re: Pattern Matching - Remove Alpha

2002-01-16 Thread John W. Krahn

Hewlett Pickens wrote:
 
 I am unable to use split with pattern matching to remove alpha characters
 from a string and will appreciate a pointer on what I'm doing wrong. (Have
 looked in Learning Perl and Programming Perl but can't spot my error.)
 
 The detail:
 
  $stat is a string that has alpha and numeric data in it.
  I want to remove all of the alpha and put the numeric data into an array.
 
  The first attempt:
 
my @nums = split(/a-zA-Z/,$stat); # removes all data from the string
 
  The second attempt:
 
my @nums = split(/a-z/,$stat); # removes all data from the string
 
 From reading, my understanding of split:  Discards all data that matches
 the pattern and returns a set of list values for the unmatched data. (my
 understanding may be the problem)
 
 This pattern works - removes all blanks (white space) but leaves alpha and
 numbers which of course isn't what I want
 
my @nums = split(/ +/,$stat);   # removes all blanks


my @nums = $stat =~ /\d+/g;


John
-- 
use Perl;
program
fulfillment

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




Re: Greedy 'split' ???

2002-01-16 Thread Christopher Solomon

On Wed, 16 Jan 2002, Scott Lutz wrote:


 $DOM_NAME, my $TLD) = split(/\./, $domain);
 creates two variable out of an inputted domain name,

 until this comes along:
   domainname.org.uk

 which it interprets as :
   $DOM_NAME = domainname
   $TLD = org

 so is it possible to do a 'greedy split' ??

This might work (untested):

my $host1 = 'hr.foo.com';
my $host2 = 'web.hr.foo.com';
my $host3 = 'foo.com';

foreach my $host ($host1, $host2, $host3) {
my ($dom, $tld) = (split /\./, $host)[-2, -1];
print dom: $dom, tld: $tld\n;
}


Christopher


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




Re: Greedy 'split' ???

2002-01-16 Thread John W. Krahn

Scott Lutz wrote:
 
 $DOM_NAME, my $TLD) = split(/\./, $domain);
 creates two variable out of an inputted domain name,
 
 until this comes along:
 domainname.org.uk
 
 which it interprets as :
 $DOM_NAME = domainname
 $TLD = org
 
 so is it possible to do a 'greedy split' ??

No, you have to use a regular expression:

my ( $DOM_NAME, $TLD ) = $domain =~ /(.+)\.(.*)/g;


John
-- 
use Perl;
program
fulfillment

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




Re: What are the uses of the =~ operator?

2002-01-16 Thread John W. Krahn

Rabs wrote:
 
 I am new to regualr expressions and becoming  accqainted with the =~
 operator. It appears to me that the =~ allows me to match a pattern in a
 REGEX against a variable.

Yes.

 As such it  replaces the $_ varible.

No, a regular expression will not replace anything and does not affect
the $_ variable.

 $name =~ /[rabs]/;

Anything between the [ and ] is a character class not a regular
expression.

 mtaches with a string containing   any of the following characters   r a b s
 
 is this correct? I am quite confused

Yes.



John
-- 
use Perl;
program
fulfillment

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




Re: Thumbnail images on-the-fly

2002-01-16 Thread Pieter Blaauw


This is how I do it on a FreeBSD boxpath is different on linux etc,
but works the same and straight from the command line...dunno if it helps.

for a in *; do
/usr/ports/graphics/ImageMagick/work/ImageMagick-5.3.8/utilities/convert
-geometry 128x96! $a thn-$a; done

Cheers
P.

On Wed, 16 Jan 2002, Scott R. Godin wrote:

 I've got an idea kicking around in my head ..

 any pointers? I'm happy to toddle off and download and read my face off
 -- that's not a problem.. I'd just like to have some indication on which
 direction to start walking. :-)



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




Re: Cgi on IIS

2002-01-16 Thread Lorne Easton

Hi Robert,

Right click on the servername and choose Properties.
Choose Home Directory and choose Configuration
under Application Settings.

You can edit your application mappings from the App
Mappings tab.

These should have been set up for you if you installed
perl after IIS, but you will need to add either perlis.dll
or perl %s %s as a mapping to the .pl extension ( and
or .cgi if you require).

Cheers,
Lorne



Robert Hanson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 It's been a long time since I worked on IIS, but I believe the Method not
 allowed error refers to GET, POST, PUT, and HEAD.  In IIS you can
 allow/deny each of these, but I forget exactly where in the MMC that this
 was located, it was with the file types.

 So maybe .cgi doesn't have GET access (or whatever you are trying to
do).
 It could also be a permissions problem.  Make sure that the group
Everyone
 can write to the file (or at least the username that the web server uses
 would need to)

 Rob

 -Original Message-
 From: maureen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 16, 2002 4:19 PM
 To: Beginners CGI List; [EMAIL PROTECTED]
 Subject: Cgi on IIS



 I hope someone can help me out.

 I set up this cgi file and html form on a Unix server. The script
 changes a user's password in a text file.

 This works correctly on a Unix Server. However, I need to move these
 files to an IIS server.
 In testing on the IIS server,  I get an HTTP Error 405- Method not
 allowed when the form is submitted.

 I did some research, but was unable to determine how to correct the
 error.

 If anyone could help me out, I'd really appreciate it.

 Thanks, Maureen

 #!/usr/bin/perl
 require cgi-lib.pl;
 #process incoming form data
 ReadParse;
 #set content type
 print PrintHeader;
 #initialize variables
 $pwfile =
 /data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.txt;
 $tmpfile =
 /data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.tmp;
 $lokfile =
 /data1/hypermart.net/worldwidewebstrategies/datafile/pwlock.fil;
 #Print initial tags for web page
 print HTMLBODY\n;
 #check for existence of password file
 unless (-e $pwfile)
 {
 #password file doesn't exist!
 #print message  shut down
 print PrintTag;
 H1Sorry!/H1
 P$pwfile has't been uploaded to the
 proper directory. Please contact the webmaster./P
 /BODY
 /HTML
 PrintTag
 exit(0);
 }
 #check for blank form fields
 if ($in{'oldname'}eq || $in{'oldpw'}eq)
 {
 #re-create form and shut down program
 print PrintTag;
 PBERROR:/B Please type your current username and
 password in the spaces provided./P
 FORM

ACTION=http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changep
 w.cgi
 METHOD=post
 PYour current username:BR
 INPUT TYPE=text NAME=oldname VALUE=$in{'oldname'}/P
 PYour current password:BR
 INPUT TYPE=textNAME=oldpw VALUE=$in{'oldpw'}/P
 PYour new password:BR
 INPUT TYPE=text NAME=newpw1 VALUE=$in{'newpw1'}/P
 PType your new password again:BR
 INPUT TYPE=text NAME=newpw2 VALUE=$in{'newpw2'}/P
 P
 PrintTag
 if ($in{'delete'} eq yes)
 {
 print INPUT TYPE=\checkbox\
 NAME=\delete\ VALUE=\yes\ CHECKED\n;
 }
 else
 {
 print \n;
 }
 print PrintTag;
 /P
 INPUT TYPE=submit VALUE=Change
 /FORM
 /BODY
 /HTML
 PrintTag
 exit(0);
 }
 #make sure new passwords match
 if ($in{'newpw1'} ne $in{'newpw2'})
 {
 #re-create form and shut down program
 print PrintTag;
 PBERROR:/B Your new passwords didn't match.
 You must type your new password exactly the same way twice.
 Please try again./P
 FORM

ACTION=http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changep
 w.cgi
 METHOD=post
 PYour current username:BR
 INPUT TYPE=text NAME=oldname VALUE=$in{'oldname'}/P
 PYour current password:BR
 INPUT TYPE=text NAME=oldpw VALUE=$in{'oldpw'}/P
 PYour new password:BR
 INPUT TYPE=text NAME=newpw1/P
 PType your new password again:BR
 INPUT TYPE=text NAME=newpw2/P
 INPUT TYPE=submit VALUE=Change
 /FORM
 /BODY
 /HTML
 PrintTag
 exit(0);
 }
 #check for existence of lock file
 if (-e $lokfile)
 {
 #lock file exists! print message  shut down
 print PrintTag;
 H1Try again!/H1
 PThe database is in use. Please try again later./P
 /BODY
 /HTML
 PrintTag
 exit(0);
 }
 #everything is okay. Create lock file.
 open(LOCK_FILE, $lokfile) ||
 die Couldn't create $lokfile\n;
 #open password file in read-only mode
 open(FILE,$pwfile) ||
 die Can't find $pwfile.\n;
 #store database contents in an array and close file
 @indata = FILE;
 close(FILE);
 #open temp file in overwrite mode
 open(TEMP,$tmpfile) ||
 die Can't create $tmpfile.\n;
 #copy password file contents to temp file
 #use a foreach loop to process each record in the array
 foreach $i (@indata)
 {
 #remove hard return character from each record
 chomp($i);
 #split fields on pipe character
 #assign a variable name to each of the fields
 ($username,$password) = split(/\|/,$i);
 if ($username eq $in{'oldname'} 
 $password eq $in{'oldpw'} 
 $in{'delete'} ne yes)
 {
 print TEMP 

Re: Array Problem

2002-01-16 Thread Leon

- Original Message -
From: maureen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]

 Currently, the array seems to only be picking up the last name listed in
 the text file.

 @indata = FILE;
 close(FILE);
 foreach $i (@indata)
 {
 #remove hard return character from each record
 chomp($i);
 #split fields on pipe character
 #assign a variable name to each of the fields
 ($username,$password) = split(/\|/,$i);
 }
snip off
 #check for proper password
 if ($username!=~/$in{'username'}/)
 {
 #invalid password--create error message and exit
 print PrintHeader;

In the foreach loop, after iteration, $username,$password received the last
line of the file. What you really want is to check
$in{'username'} against every line of the file, to do this, you must check
within the foreach loop like this :-

foreach $i (@indata){
 chomp $i;
 ($username,$password) = split(/\|/,$i);
 if ($username !~ /$in{username}/) {
# I would prefer to use ne instead of !~
#invalid password--create error message and exit
print PrintHeader;
...
 };
};







_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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