Debugging Problem: Phantom line numbers!

2003-01-07 Thread Christopher D . Lewis
Dear all,
	I'm writing (as a practice piece, all the better to learn Perl coding) 
what is for me a big, complicated program which has lots of options and 
output possibilities.  And ... heh, heh ... it isn't working.  My 
problem is that the errors Perl coughs up end with:

syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 305, near "sub rollRequest"
syntax error at ./nudice-01c line 325, near "while @rawRollArray"
syntax error at ./nudice-01c line 457, near "}"
Execution of ./nudice-01c aborted due to compilation errors.

This would be all well and good, except that every text editor I point 
at my program agrees that the actual line count ends at 304.

Ideas?

Thanks,
	Chris


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



Get photos from an FTP site

2003-01-07 Thread Michael Kramer
I've been having some problems with this little code two major issues.
What I'm tring to do is get Photos off an FTP site:
I have a text file with about 4000 lines and on each line is an eight digit
number "30635325".  I take all of the is an put it into an array.  Then I
have to change the info to 30635325_0.jpg because on the FTP site that's how
each one of the Photos are saved.  I'm getting weird output here the "." is
not working example of the output "_0.jp 78".  Next assuming it works. I
connect to the FTP site and get a list of what they have.  The fun thing is
that the FTP site has most of the photos I need but they are separated in to
different folders, so the file I need is "30635325_0.jpg" is located in
first folder "30" second folder "635" then the file is "325_0.jpg".  I have
written the code to do this but it take a long time and I wanted to know if
this is the best way to do it.  If any one could please help me it would be
greatly appreciated.

Thanks

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

print "Step 1: Find the $file in $dir.\n";
chdir($dir) or die "Can't open $dir: $!";

print "Step 2: Open the $file.\n";
open(FILE, $file) or die "Can't open $file: $!";
@word = ;
chomp @word;
close(FILE);

print "Step 3: Clean up our listings.\n";
#I need to fix the listings from the text file to what they are on the FTP
sit
@correctedwords = ();
foreach $item (@word) {
if (substr($item,length($item) - 6, length($item)) ne 
"_0.jpg"){
$looking_for_listings{$item . "_0.jpg"} = 1;
} else {
$looking_for_listings{$item} = 1;
}
}

#once I do this I have been getting some funkey out put. "_0.jp 67"


#I need to see if they exist on the ftp site.
print "Step 4: Start FTP.\n";
use Net::FTP;
#... connect to the FTP site.

$ftp->cwd("$pin_folder")
or $ftp->cwd("$pin_folder")
or die "Couldn't change to dir $pin_folder. \n$!\n";

print "Step 5: Get the list they have.\n";
@first_folder = $ftp->ls()
or die "Couldn't get a list of files. $!\n";

foreach $myfolder (@first_folder) {
$ftp->cwd("$myfolder")
or die "Did not work $myfolder\n";
@second_folder = $ftp->ls()
or die "can't get list in $second_folder. \n";
foreach $folder2 (@second_folder) {
$ftp->cwd("$folder2")
or die "did not work $folder2\n";
@files = $ftp->ls()
or die "can't get the list in $folder2";
$ftp->cwd("../")
or die "can't get the list in ../";
foreach $file (@files) {
if ($looking_for_listings{$myfolder . $folder2 
. $file}) {
$seen{$myfolder . $folder2 . $file} = 
1;
}
}
}
$ftp->cwd("../")
or die "can't get the list in ../";
}

print "Step 6: print the list they have and we want.\n";
#I should get about 300 listings but I get nothing
for $a ( keys %seen) {
print "$a=$seen{$a}\n";
}

$ftp->quit();


Michael Kramer
[EMAIL PROTECTED]



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




sorting an id like a.12.34

2003-01-07 Thread Konrad Foerstner
Hi Folks!

My problem: I have a file of ids like a.12.34 or z.9.234 and want to sort
it into a new file. As the sort function sorts digit by digit I can't use
it (not so easy). Additionally the data file is quite big (11M) so I don't
know if it is okay to work with such big array.

I hope someone could help me on some parts of my problem.

cu

Konrad 

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




RE: Help!!!

2003-01-07 Thread Joel Biss
In windows you can use

/Start/Programs/Accessories/System Tools/Scheduled Tasks

or 

'at' from the cmd prompt to schedule your perl program to run every minute
or so.


-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: 06 January 2003 16:46
To: 'George Schlossnagle'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Help!!!


You could do it with Perl. Dump the output of the system call ping to a
log file. Set it up to run however often you want to check. In Linux you
could do this by setting up cron job. Not sure how you would do it in
windows.

kind of doing this from memory so let me know if I am wrong.

$var=`ping xxx.xxx.xxx.xxx`;
print LOG "$var\n";



> -Original Message-
> From: George Schlossnagle [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, January 06, 2003 11:45 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: Help!!!
> 
> 
> Not in Perl (though you can write extensions for it in Perl), but try 
> Netsaint (now Nagios):  http://www.nagios.org/.
> 
> George
> 
> On Monday, January 6, 2003, at 11:55  AM, Jose Vicente Paredes Loor 
> wrote:
> 
> >
> > Hi, friends.
> >
> > I am looking for a script(or a group of them) to monitor my 
> network,i 
> > mean, i want to ping from one server and collect the data 
> in some web 
> > page maybe, and show the ping result from all my servers in 
> only one 
> > page. I have scripts to make ping from the server, but i 
> dont know how 
> > to collect the data to show them after.
> > I need to know when i dont have internet from a specific server.
> >
> > Please help me.
> >
> > Thanks in advance.
> >
> >
> >
> >
> >
> > --
> > 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]




How to substract words

2003-01-07 Thread Alex Demmler
Hi folks!

I have a problem with pattern matching.
I want do find the difference between two words. I have tried, but donot get
it work. Any tips?

Example:

1. Word = helloRed
2. Word = hello
---
Result = Red

Thanks Alex


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




Re: Help!!!

2003-01-07 Thread Desmond Coughlan
Le Mon, Jan 06, 2003 at 11:55:11AM -0500, Jose Vicente Paredes Loor a écrit ... 

> I am looking for a script(or a group of them) to monitor my network,i
> mean, i want to ping from one server and collect the data in some web page
> maybe, and show the ping result from all my servers in only one page.
> I have scripts to make ping from the server, but i dont know how to
> collect the data to show them after.
> I need to know when i dont have internet from a specific server.

I'm a perl beginner (spot the understatement !), too, but you _might_ find
what you want, with 'Big Brother'.

D.

-- 
Desmond Coughlan
[EMAIL PROTECTED]
http://www.zeouane.org



msg36001/pgp0.pgp
Description: PGP signature


Search and Replace Lines

2003-01-07 Thread Kehayias, Evan N Mr NISO/Lockheed Martin
Hello all,

I was hoping someone could steer me in the right direction for a scripting
problem I am having.  The problem I am experiencing is using sed and vi.
The solution I am attempting can most likely be done in perl but not sure
how.  If anyone has any suggestions on how to accomplish it in perl - it
would be much appreciated.


What I am attempting to do is read in a file and add text in specific
locations.  The catch is I need to add text followed by carriage returns
followed by more text and so on.  Below using sed I am attempting to find
something in a file that will always be there like and replace accordingly:

trimmed file contents before:
# Cmnd alias specification




trimmed file contents after:
# Runas_Alias specification
Runas_Alias AP = acl

# Cmnd alias specification



I can do it on the command line using sed:

sed 's/\(\#\)\( Cmnd alias specification\)/\# Runas_Alias
specification\^JRunas_Alias   AP = acl\1\2/' s1 > s3

Command line works great but when I try to script it using vi it breaks.  In
vi I can't do ctrl-v ctrl-j at all and ctrl-v ctrl-M (or Enter) don't work.
I have been told there is a way to do it in awk but I would rather learn the
perl way if possible.

Again any help would be greatly appreciated:)

Regards,
Evan



Re: Excel

2003-01-07 Thread David Eason
Are you creating the Excel files on a Windows system? If so, it looks like
Win32::OLE would be your best bet:
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl-5.6/faq/Windo
ws/ActivePerl-Winfaq12.html

You may need to read up on the Office object model, too.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeomg/html
/deovrobjectmodelguide.asp?frame=true

Dave



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




Phantom Line Numbers

2003-01-07 Thread Christopher D . Lewis
I'm writing a little toy tool to teach myself more Perl than I have 
used before, and I am puzzled by error messages I get when trying to 
run and debug it:


syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 305, near "sub rollRequest"
syntax error at ./nudice-01c line 325, near "while @rawRollArray"
syntax error at ./nudice-01c line 457, near "}"
Execution of ./nudice-01c aborted due to compilation errors.


The problem is, you see, that (according to two different text editors) 
nudice-01c has only 304 lines 

Any ideas how I debug lines which don't exist?  Any ideas why Perl is 
reporting nonexistent line numbers?  Perl 5.8.0.

Thanks in advance,
	Chris


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



Can't make Storable

2003-01-07 Thread Scott Lutz
I need some pointers as to why the Storable module won't compile on my Intel/Debian 
machine.
I am not sure if recompiling DynaLoader would help, so if any one has any ideas, I 
would be most grateful.
This has failed using both CPAN and using the older 2.05 version I have.

Here is the complete output from the "make test":

# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib 
-I/usr/local/lib/perl5/5.6.1/i586-linux -I/usr/local/lib/perl5/5.6.1 -e 'use 
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/blessedCan't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/blessed.t line 26
Compilation failed in require at t/blessed.t line 26.
BEGIN failed--compilation aborted at t/blessed.t line 26.
t/blesseddubious 
Test returned status 255 (wstat 65280, 0xff00)
t/canonical..Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/canonical.t line 24
Compilation failed in require at t/canonical.t line 24.
BEGIN failed--compilation aborted at t/canonical.t line 24.
t/canonical..dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/code...skipped
all skipped: tests only work with B::Deparse 0.61 and at least perl 5.6.0
t/compat06...Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/compat06.t line 28
Compilation failed in require at t/compat06.t line 28.
BEGIN failed--compilation aborted at t/compat06.t line 28.
t/compat06...dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/croak..Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/croak.t line 26
Compilation failed in require at t/croak.t line 26.
BEGIN failed--compilation aborted at t/croak.t line 26.
t/croak..dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/dclone.Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/dclone.t line 25
Compilation failed in require at t/dclone.t line 25.
BEGIN failed--compilation aborted at t/dclone.t line 25.
t/dclone.dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/downgrade..Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/downgrade.t line 30
Compilation failed in require at t/downgrade.t line 30.
BEGIN failed--compilation aborted at t/downgrade.t line 30.
t/downgrade..dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/forgiveCan't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/forgive.t line 31
Compilation failed in require at t/forgive.t line 31.
BEGIN failed--compilation aborted at t/forgive.t line 31.
t/forgivedubious 
Test returned status 255 (wstat 65280, 0xff00)
t/freeze.Can't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/freeze.t line 25
Compilation failed in require at t/freeze.t line 25.
BEGIN failed--compilation aborted at t/freeze.t line 25.
t/freeze.dubious 
Test returned status 255 (wstat 65280, 0xff00)
t/integerCan't load 'blib/arch/auto/Storable/Storable.so' for module Storable: 
libgcc_s.so.1: cannot open shared object file: No such file or directory at 
/usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
 at t/integer.t line 30
Compilation failed in require at t/integer.t line 30.
BEGIN failed--compilation aborted at t/integer.t line 30.
t/inte

How to substract words

2003-01-07 Thread Alex Demmler
Hi folks!

I have a problem with pattern matching.
I want do find the difference between two words. I have tried, but donot get
it work. Any tips?

Example:

1. Word = helloRed
2. Word = hello
---
Result = Red

Thanks Alex


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




Re: Search and Replace Lines

2003-01-07 Thread John W. Krahn
Evan N Mr Niso/Lockheed Martin Kehayias wrote:
> 
> Hello all,

Hello,

> I was hoping someone could steer me in the right direction for a scripting
> problem I am having.  The problem I am experiencing is using sed and vi.
> The solution I am attempting can most likely be done in perl but not sure
> how.  If anyone has any suggestions on how to accomplish it in perl - it
> would be much appreciated.
> 
> What I am attempting to do is read in a file and add text in specific
> locations.  The catch is I need to add text followed by carriage returns
> followed by more text and so on.  Below using sed I am attempting to find
> something in a file that will always be there like and replace accordingly:
> 
> trimmed file contents before:
> # Cmnd alias specification
> 
> trimmed file contents after:
> # Runas_Alias specification
> Runas_Alias AP = acl
> 
> # Cmnd alias specification
> 
> I can do it on the command line using sed:
> 
> sed 's/\(\#\)\( Cmnd alias specification\)/\# Runas_Alias
> specification\^JRunas_Alias   AP = acl\1\2/' s1 > s3

perl -pe's{^(#)( Cmnd alias specification)}
  {# Runas_Alias specification\nRunas_Alias   AP = ac\n\nl$1$2}' s1 > s3



John
-- 
use Perl;
program
fulfillment

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




tailing a text file

2003-01-07 Thread Admin-Stress
Hi,

Anyone have the fastest and efficien way to tail a text file ?

suppose I have a text file "example.txt" and I want to print the last X lines.

Thanks.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




problem with proxy server and modules installation

2003-01-07 Thread Prasad K M
Hi all,


Firstly I wasn't able to test my perl scripts which used cgi/html/LWP cause
I wasn't able to connect to the net. I guess some settings have to be done
but not aware as to what...Please note that I am behind a proxy server.

Secondly I had this problem while installing modules from CPAN .It a real
pain to install modules.First I got to download them and go about installing
them one by one...I pray Is there a better way/automated way to install
moduleswhich will also take care of dependencies ( i faced a lot of
problem with this dependency stuff)

Tried something like

perl -MCPAN -e shell;

but again faced problems due to proxy server stuff.. not sure as where i
shud enter the authentication details.

thanks to one and all in advance
--prasad


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




Re: How to substract words

2003-01-07 Thread Pavle Lukic
Alex

This is one way to resolve the issue:
$x = substr($a,0,index($a,$b)).substr($a,index($a,$b)+length($b));

I would like to see a solution in terms of regex.

Cheers

Pavle

- Original Message -
From: "Alex Demmler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 06, 2003 3:06 PM
Subject: How to substract words


> Hi folks!
>
> I have a problem with pattern matching.
> I want do find the difference between two words. I have tried, but donot
get
> it work. Any tips?
>
> Example:
>
> 1. Word = helloRed
> 2. Word = hello
> ---
> Result = Red
>
> Thanks Alex
>
>
> --
> 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: How to substract words

2003-01-07 Thread Dave K
$ perl -e '
$minuend = 'red';
$subtra = 'Hellored';
$res = $subtra =~ s/$minuend//;
print $minuend, "\t", $subtra, "\t", $res;'
red Hello   1

$res flags success/fail. If you would like $subtra to remain unchanged
assign
$dif = $subtra
then
$res = $dif =~ s/$minuend//;

HTH
"Pavle Lukic" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Alex
>
> This is one way to resolve the issue:
> $x = substr($a,0,index($a,$b)).substr($a,index($a,$b)+length($b));
>
> I would like to see a solution in terms of regex.
>
> Cheers
>
> Pavle
>
> - Original Message -
> From: "Alex Demmler" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, January 06, 2003 3:06 PM
> Subject: How to substract words
>
>
> > Hi folks!
> >
> > I have a problem with pattern matching.
> > I want do find the difference between two words. I have tried, but donot
> get
> > it work. Any tips?
> >
> > Example:
> >
> > 1. Word = helloRed
> > 2. Word = hello
> > ---
> > Result = Red
> >
> > Thanks Alex
> >
> >
> > --
> > 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: tailing a text file

2003-01-07 Thread Tanton Gibbs
If you want it continually updated you might try File::Tail
http://search.cpan.org/author/MGRABNAR/File-Tail-0.98/Tail.pm

otherwise, use File::ReadBackwards
http://search.cpan.org/author/URI/File-ReadBackwards-0.99/ReadBackwards.pm

Tanton
- Original Message -
From: "Admin-Stress" <[EMAIL PROTECTED]>
To: "perl" <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 7:23 AM
Subject: tailing a text file


> Hi,
>
> Anyone have the fastest and efficien way to tail a text file ?
>
> suppose I have a text file "example.txt" and I want to print the last X
lines.
>
> Thanks.
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.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: tailing a text file

2003-01-07 Thread wiggins
One way is answered in the FAQ, don't know if it is the most efficient.

perldoc -q 'tail'

http://danconia.org



On Tue, 7 Jan 2003 04:23:22 -0800 (PST), Admin-Stress <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Anyone have the fastest and efficien way to tail a text file ?
> 
> suppose I have a text file "example.txt" and I want to print the last X lines.
> 
> Thanks.
> 
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.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]




Timeout at C:/Perl/lib/Net/FTP.pm line 741

2003-01-07 Thread Aman Thind
Hi all ,

I have currently two ftp uploads being made from my machine.

I am using the Net::FTP for the recursive transfer of product builds to
germany.

While one script is successfully transferring, the other is aborting with
the following error :

Timeout at C:/Perl/lib/Net/FTP.pm line 741

Both the transfer scripts are exactly the same barring the difference in
source->target parameters.

What does this message mean and is there any workaround ?

Thanks
aman

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




RE: Can't make Storable

2003-01-07 Thread Kipp, James
scott
 looks like you are missing some libraries on your machine.  namely libgcc.
do a google search for libgcc_s.so.1 or use whatever package installer
debian uses and verify this library is there. if not, install it

> -Original Message-
> From: Scott Lutz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 06, 2003 4:54 PM
> To: Beginners (E-mail)
> Subject: Can't make Storable
> 
> 
> I need some pointers as to why the Storable module won't 
> compile on my Intel/Debian machine.
> I am not sure if recompiling DynaLoader would help, so if any 
> one has any ideas, I would be most grateful.
> This has failed using both CPAN and using the older 2.05 
> version I have.
> 
> Here is the complete output from the "make test":
> 
> # make test
> PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib 
> -I/usr/local/lib/perl5/5.6.1/i586-linux 
> -I/usr/local/lib/perl5/5.6.1 -e 'use Test::Harness 
> qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
> t/blessedCan't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/blessed.t line 26
> Compilation failed in require at t/blessed.t line 26.
> BEGIN failed--compilation aborted at t/blessed.t line 26.
> t/blesseddubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/canonical..Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/canonical.t line 24
> Compilation failed in require at t/canonical.t line 24.
> BEGIN failed--compilation aborted at t/canonical.t line 24.
> t/canonical..dubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/code...skipped
> all skipped: tests only work with B::Deparse 0.61 and 
> at least perl 5.6.0
> t/compat06...Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/compat06.t line 28
> Compilation failed in require at t/compat06.t line 28.
> BEGIN failed--compilation aborted at t/compat06.t line 28.
> t/compat06...dubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/croak..Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/croak.t line 26
> Compilation failed in require at t/croak.t line 26.
> BEGIN failed--compilation aborted at t/croak.t line 26.
> t/croak..dubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/dclone.Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/dclone.t line 25
> Compilation failed in require at t/dclone.t line 25.
> BEGIN failed--compilation aborted at t/dclone.t line 25.
> t/dclone.dubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/downgrade..Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/downgrade.t line 30
> Compilation failed in require at t/downgrade.t line 30.
> BEGIN failed--compilation aborted at t/downgrade.t line 30.
> t/downgrade..dubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/forgiveCan't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/forgive.t line 31
> Compilation failed in require at t/forgive.t line 31.
> BEGIN failed--compilation aborted at t/forgive.t line 31.
> t/forgivedubious  
>
> Test returned status 255 (wstat 65280, 0xff00)
> t/freeze.Can't load 
> 'blib/arch/auto/Storable/Storable.so' for module Storable: 
> libgcc_s.so.1: cannot open shared object file: No such file 
> or directory at 
> /usr/local/lib/perl5/5.6.1/i586-linux/DynaLoader.pm line 206.
>  at t/freeze

Re: How to substract words

2003-01-07 Thread John W. Krahn
Alex Demmler wrote:
> 
> Hi folks!

Hello,

> I have a problem with pattern matching.
> I want do find the difference between two words. I have tried, but donot get
> it work. Any tips?
> 
> Example:
> 
> 1. Word = helloRed
> 2. Word = hello
> ---
> Result = Red


my $word1 = 'helloRed';
my $word2 = 'hello';

# make sure that $word1 is longer than word2
( $word1, $word2 ) = ( $word2, $word1 ) if length( $word1 ) < length( $word2 );

( my $result = $word1 ) =~ s/\Q$word2//;

print "$result\n";



John
-- 
use Perl;
program
fulfillment

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




RE: Timeout at C:/Perl/lib/Net/FTP.pm line 741

2003-01-07 Thread Dan Muey
What are the parameteres that are different and which are the same?
Is then one ftp server set to timeout after xx amount of seconds?
The message means ( not a dictionary definition ) basically that the server hasn't 
seen aby action for a specified period of time and said good bye to your script.

Dan


-Original Message-
From: Aman Thind [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 7:39 AM
To: [EMAIL PROTECTED]
Subject: Timeout at C:/Perl/lib/Net/FTP.pm line 741


Hi all ,

I have currently two ftp uploads being made from my machine.

I am using the Net::FTP for the recursive transfer of product builds to germany.

While one script is successfully transferring, the other is aborting with the 
following error :

Timeout at C:/Perl/lib/Net/FTP.pm line 741

Both the transfer scripts are exactly the same barring the difference in
source->target parameters.

What does this message mean and is there any workaround ?

Thanks
aman

-- 
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: Phantom Line Numbers

2003-01-07 Thread Dan Muey
Do you 'require' or 'use' any libs or modules?

-Original Message-
From: Christopher D. Lewis [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 2:30 PM
To: [EMAIL PROTECTED]
Subject: Phantom Line Numbers


I'm writing a little toy tool to teach myself more Perl than I have 
used before, and I am puzzled by error messages I get when trying to 
run and debug it:


syntax error at ./nudice-01c line 187, near "sub displayResults " syntax error at 
./nudice-01c line 305, near "sub rollRequest" syntax error at ./nudice-01c line 325, 
near "while @rawRollArray" syntax error at ./nudice-01c line 457, near "}" Execution 
of ./nudice-01c aborted due to compilation errors.


The problem is, you see, that (according to two different text editors) 
nudice-01c has only 304 lines 

Any ideas how I debug lines which don't exist?  Any ideas why Perl is 
reporting nonexistent line numbers?  Perl 5.8.0.

Thanks in advance,
Chris


-- 
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: passing array ref to subroutine

2003-01-07 Thread R. Joseph Newton
Hi Paul,

I think you're looking for:
sub suby {
  $temp=$_[0];
  print "$_[0]\n";
  print "$$temp[0]\n";
}
I'm not sure why.  It seems like it should be   print "$$_[0]\n";, but I believe the 
results I got from the interpreter.  Output:
ARRAY(0x1ab28e0)
paul
ARRAY(0x1ab28e0)
paul

Joseph

Paul Kraus wrote:

> I don't understand why the output of the two print statements inside the
> subroutine is different. The one only prints the new line.
>
> #!/usr/bin/perl -w
>
> @array=qw/paul david kraus/;
> $arrayref=\@array;
>
> print "$arrayref\n";
> print "$$arrayref[0]\n";
>
> &suby($arrayref);
>
> sub suby {
>   $temp=$_[0];
>   print "$$_[0][0]\n";
>   print "$temp[0]\n";
> }
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.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]




Q : How to resume an ftp session + RE: Timeout at C:/Perl/lib/Net /FTP.pm line 741

2003-01-07 Thread Aman Thind
As it turned out there was some problem with the file I was trying to
transfer.
I could not transfer it even using an ftp client.
The ftp client also aborts with a time out.

Another question.
How can I use the *Resume* facility provided by an ftp server???
Currently on error I restart the process again.
I go back to the start of the script - match the sizes of the file to upload
and the one present - if different then upload - else go to next file.
The incompletely transferred file is overwritten and the transfer is not
resumed from where it aborted. 

Thanks 
aman

-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 8:06 PM
To: Aman Thind; [EMAIL PROTECTED]
Subject: RE: Timeout at C:/Perl/lib/Net/FTP.pm line 741


What are the parameteres that are different and which are the same?
Is then one ftp server set to timeout after xx amount of seconds?
The message means ( not a dictionary definition ) basically that the server
hasn't seen aby action for a specified period of time and said good bye to
your script.

Dan


-Original Message-
From: Aman Thind [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 7:39 AM
To: [EMAIL PROTECTED]
Subject: Timeout at C:/Perl/lib/Net/FTP.pm line 741


Hi all ,

I have currently two ftp uploads being made from my machine.

I am using the Net::FTP for the recursive transfer of product builds to
germany.

While one script is successfully transferring, the other is aborting with
the following error :

Timeout at C:/Perl/lib/Net/FTP.pm line 741

Both the transfer scripts are exactly the same barring the difference in
source->target parameters.

What does this message mean and is there any workaround ?

Thanks
aman

-- 
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: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Christopher D . Lewis) writes:
>Dear all,
>   I'm writing (as a practice piece, all the better to learn Perl coding) 
>what is for me a big, complicated program which has lots of options and 
>output possibilities.  And ... heh, heh ... it isn't working.  My 
>problem is that the errors Perl coughs up end with:
>
>syntax error at ./nudice-01c line 187, near "sub displayResults "
>syntax error at ./nudice-01c line 305, near "sub rollRequest"
>syntax error at ./nudice-01c line 325, near "while @rawRollArray"
>syntax error at ./nudice-01c line 457, near "}"
>Execution of ./nudice-01c aborted due to compilation errors.
>
>This would be all well and good, except that every text editor I point 
>at my program agrees that the actual line count ends at 304.
>
>Ideas?

What line numbers do your text editors say the above statements are
actually on?

Sprinkle a few

print __LINE__;

statements around and see what Perl thinks the line numbers are.

This program hasn't been near a Windoze system, has it?  Check the
line terminators.

Failing that, show us the thing.

-- 
Peter Scott
http://www.perldebugged.com

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




perl command line not working

2003-01-07 Thread Patricia Hinman
I've intstalled the binary distribution for Win32 of
Perl 5.8.0 and Apache 2.0.43,
together with mod_perl-1.99_08-dev.

I have 2 questions.  

1.  Why does Apache start up while booting?

2.  Why can't I use perl at msdos prompt?

This is in my path variables:

PATH=C:\Perl\bin\;
CLASSPATH=C:\Perl\bin;


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: perl command line not working

2003-01-07 Thread Dan Muey
1)
Probably so that when your computer is running so is your webserver, why else have a 
web server installed?
Probably need to ask an apache list though.
2)
Can you run it with the entire path the same way you'd run other programs at the 
prompt?



-Original Message-
From: Patricia Hinman [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 10:37 AM
To: [EMAIL PROTECTED]
Subject: perl command line not working


I've intstalled the binary distribution for Win32 of
Perl 5.8.0 and Apache 2.0.43,
together with mod_perl-1.99_08-dev.

I have 2 questions.  

1.  Why does Apache start up while booting?

2.  Why can't I use perl at msdos prompt?

This is in my path variables:

PATH=C:\Perl\bin\;
CLASSPATH=C:\Perl\bin;


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.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: perl command line not working

2003-01-07 Thread Paul Kraus
are your running your apps with Perl as the command.

Perl myscript.pl



> -Original Message-
> From: Patricia Hinman [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 11:37 AM
> To: [EMAIL PROTECTED]
> Subject: perl command line not working
> 
> 
> I've intstalled the binary distribution for Win32 of
> Perl 5.8.0 and Apache 2.0.43,
> together with mod_perl-1.99_08-dev.
> 
> I have 2 questions.  
> 
> 1.  Why does Apache start up while booting?
> 
> 2.  Why can't I use perl at msdos prompt?
> 
> This is in my path variables:
> 
> PATH=C:\Perl\bin\;
> CLASSPATH=C:\Perl\bin;
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now. 
http://mailplus.yahoo.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: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Christopher D . Lewis

On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:



What line numbers do your text editors say the above statements are
actually on?

the errors Perl coughs up end with:

syntax error at ./nudice-01c line 187, near "sub displayResults "


the text "sub displayResults " occurs on line 130, and its closing 
bracket occurs in line 187.

syntax error at ./nudice-01c line 305, near "sub rollRequest"


the text "sub rollRequest" occurs on line 189, and its closing bracket 
occurs in line 267.

syntax error at ./nudice-01c line 325, near "while @rawRollArray"


occurs on line 199


syntax error at ./nudice-01c line 457, near "}"


this occurs quite a bit, but the last one is at line 304 (ending sub 
printHelp).  The last "}" which closes a sub which likely contains an 
error is on line 267.

Execution of ./nudice-01c aborted due to compilation errors.




This program hasn't been near a Windoze system, has it?  Check the
line terminators.


Has been edited in jEdit and vi on a MacOS X system (e.g., Unix line 
terminators) ...

Failing that, show us the thing.


I've been given some instructions on following the errors in order ... 
I will see if that helps ... I am thinking that if following the errors 
in order is a problem I should post the error output and maybe even 
embarrass myself with my horrible code ... since I'm trying to get used 
to anonymous arrays and hashes, I have quite a bit of code that looks 
out of place given the program is set up to iterate through each 
element and doesn't really need to store the whole data set at once.  
Ug-ly.  I'll be back!
Thanks,
	Chris


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



Re: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Christopher D . Lewis

On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:


 [EMAIL PROTECTED] (Christopher D . Lewis) writes:

My problem is that the errors Perl coughs up end with:

syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 305, near "sub rollRequest"
syntax error at ./nudice-01c line 325, near "while @rawRollArray"
syntax error at ./nudice-01c line 457, near "}"
Execution of ./nudice-01c aborted due to compilation errors.

This would be all well and good, except that every text editor I point
at my program agrees that the actual line count ends at 304.

Ideas?


What line numbers do your text editors say the above statements are
actually on?

Sprinkle a few

	print __LINE__;

statements around and see what Perl thinks the line numbers are.


I replaced the entirety of sub displayResults with:

sub displayResults { print __line__ . "sub displayResults"; }

(both to get Perl's idea of the line numbers, and to implement another 
suggestion I replace contents of problem subroutines with simple code 
to track down bugs)

and my errors went from:
chris% ./nudice-01c
"my" variable $labelThrow masks earlier declaration in same scope at 
./nudice-01c line 193.
"my" variable @requests masks earlier declaration in same statement at 
./nudice-01c line 193.
"my" variable $requestNumber masks earlier declaration in same 
statement at ./nudice-01c line 193.
"my" variable $labelThrow masks earlier declaration in same scope at 
./nudice-01c line 195.
"my" variable @requests masks earlier declaration in same scope at 
./nudice-01c line 195.
"my" variable $requestNumber masks earlier declaration in same scope at 
./nudice-01c line 195.
"my" variable $labelThrow masks earlier declaration in same scope at 
./nudice-01c line 197.
"my" variable @requests masks earlier declaration in same scope at 
./nudice-01c line 197.
"my" variable $requestNumber masks earlier declaration in same scope at 
./nudice-01c line 197.
"my" variable @requests masks earlier declaration in same statement at 
./nudice-01c line 197.
"my" variable $requestNumber masks earlier declaration in same 
statement at ./nudice-01c line 197.
syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 305, near "sub rollRequest"
syntax error at ./nudice-01c line 325, near "while @rawRollArray"
syntax error at ./nudice-01c line 457, near "}"
Execution of ./nudice-01c aborted due to compilation errors.

to the more modest:
chris% ./nudice-01c
syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 189, near "sub rollRequest"
syntax error at ./nudice-01c line 209, near "while @rawRollArray"
syntax error at ./nudice-01c line 341, near "}"
Execution of ./nudice-01c aborted due to compilation errors.

So, now that I know all the variable problems are in displayResults 
despite the line numbers being off, I can start looking outside 
displayResults for the other errors.  I note in passing that I can't 
find a bunch of "my labelThrow" masking one another, as in 
displayResults I make the label for each throw using:
   my $labelThrow; # Identifies throw type for table readers
   # Calculates Label for "Throw"
$labelThrow .= $requests[$requestNumber]{"numDicePerThrow"} if 
$requests[$requestNumber]{"numDicePerThrow"} > 1; # Puts numDice in 
throw's label if > 1
$labelThrow .= "d" . $requests[$requestNumber]{"numSidesPerDie"}; # 
Puts Die size
$labelThrow .= $requests[$requestNumber]{numAddedToThrow} if 
$requests[$requestNumber]{numAddedToThrow};#Puts numAddedToThrow in 
throw's labal if nonzero

Does anyone spot what I'm doing wrong in trying to build a this label's 
contents in this way?

Note that I have no idea at all what I'm doing with these data 
structures, what's why it is "practice" :-)

Many thanks,
	Chris


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



Re: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Christopher D . Lewis) writes:
>
>On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:
>
>>
>> What line numbers do your text editors say the above statements are
>> actually on?
>>> the errors Perl coughs up end with:
>>>
>>> syntax error at ./nudice-01c line 187, near "sub displayResults "
>
>the text "sub displayResults " occurs on line 130, and its closing 
>bracket occurs in line 187.

Okay, this I could understand.

>>> syntax error at ./nudice-01c line 305, near "sub rollRequest"
>
>the text "sub rollRequest" occurs on line 189, and its closing bracket 
>occurs in line 267.
>
>>> syntax error at ./nudice-01c line 325, near "while @rawRollArray"
>
>occurs on line 199
>
>>> syntax error at ./nudice-01c line 457, near "}"
>
>this occurs quite a bit, but the last one is at line 304 (ending sub 
>printHelp).  The last "}" which closes a sub which likely contains an 
>error is on line 267.

This is weird.  You don't have any comments that look like "#line " do you?

>I've been given some instructions on following the errors in order ... 
>I will see if that helps ... I am thinking that if following the errors 
>in order is a problem I should post the error output and maybe even 
>embarrass myself with my horrible code ... since I'm trying to get used 
>to anonymous arrays and hashes, I have quite a bit of code that looks 
>out of place given the program is set up to iterate through each 
>element and doesn't really need to store the whole data set at once.  

Well, I would still like to see the thing in order to understand these
weird line numbers.  Sometimes the reported line number can be considerably
off, but I've a hard time figuring out how it can be hundreds of lines past
the end of the file.

-- 
Peter Scott
http://www.perldebugged.com

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




Re: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Christopher D . Lewis) writes:
>
>On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:
>
>>  [EMAIL PROTECTED] (Christopher D . Lewis) writes:
>>> My problem is that the errors Perl coughs up end with:
>>>
>>> syntax error at ./nudice-01c line 187, near "sub displayResults "
>>> syntax error at ./nudice-01c line 305, near "sub rollRequest"
>>> syntax error at ./nudice-01c line 325, near "while @rawRollArray"
>>> syntax error at ./nudice-01c line 457, near "}"
>>> Execution of ./nudice-01c aborted due to compilation errors.
>>>
>>> This would be all well and good, except that every text editor I point
>>> at my program agrees that the actual line count ends at 304.
>>>
>>> Ideas?
>>
>> What line numbers do your text editors say the above statements are
>> actually on?
>>
>> Sprinkle a few
>>
>>  print __LINE__;
>>
>> statements around and see what Perl thinks the line numbers are.
>
>I replaced the entirety of sub displayResults with:
>
>sub displayResults { print __line__ . "sub displayResults"; }

That needs to be __LINE__, not __line__.  The above is an error.
You do have -w and use strict in this program, right?

>(both to get Perl's idea of the line numbers, and to implement another 
>suggestion I replace contents of problem subroutines with simple code 
>to track down bugs)
>
>and my errors went from:
>chris% ./nudice-01c
>"my" variable $labelThrow masks earlier declaration in same scope at 
>./nudice-01c line 193.
>"my" variable @requests masks earlier declaration in same statement at 
>./nudice-01c line 193.
>"my" variable $requestNumber masks earlier declaration in same 
>statement at ./nudice-01c line 193.
>"my" variable $labelThrow masks earlier declaration in same scope at 
>./nudice-01c line 195.
>"my" variable @requests masks earlier declaration in same scope at 
>./nudice-01c line 195.
>"my" variable $requestNumber masks earlier declaration in same scope at 
>./nudice-01c line 195.
>"my" variable $labelThrow masks earlier declaration in same scope at 
>./nudice-01c line 197.
>"my" variable @requests masks earlier declaration in same scope at 
>./nudice-01c line 197.
>"my" variable $requestNumber masks earlier declaration in same scope at 
>./nudice-01c line 197.
>"my" variable @requests masks earlier declaration in same statement at 
>./nudice-01c line 197.
>"my" variable $requestNumber masks earlier declaration in same 
>statement at ./nudice-01c line 197.
>syntax error at ./nudice-01c line 187, near "sub displayResults "
>syntax error at ./nudice-01c line 305, near "sub rollRequest"
>syntax error at ./nudice-01c line 325, near "while @rawRollArray"
>syntax error at ./nudice-01c line 457, near "}"
>Execution of ./nudice-01c aborted due to compilation errors.
>
>to the more modest:
>chris% ./nudice-01c
>syntax error at ./nudice-01c line 187, near "sub displayResults "
>syntax error at ./nudice-01c line 189, near "sub rollRequest"
>syntax error at ./nudice-01c line 209, near "while @rawRollArray"
>syntax error at ./nudice-01c line 341, near "}"
>Execution of ./nudice-01c aborted due to compilation errors.

I've got this feeling that you've done something fundamentally wrong in
your program, like using Pascal's BEGIN and END instead of curly braces
for subroutine code blocks :-)

>So, now that I know all the variable problems are in displayResults 
>despite the line numbers being off, I can start looking outside 
>displayResults for the other errors.  I note in passing that I can't 
>find a bunch of "my labelThrow" masking one another, as in 
>displayResults I make the label for each throw using:
>my $labelThrow; # Identifies throw type for table readers
># Calculates Label for "Throw"
> $labelThrow .= $requests[$requestNumber]{"numDicePerThrow"} if 
>$requests[$requestNumber]{"numDicePerThrow"} > 1; # Puts numDice in 
>throw's label if > 1
> $labelThrow .= "d" . $requests[$requestNumber]{"numSidesPerDie"}; # 
>Puts Die size
> $labelThrow .= $requests[$requestNumber]{numAddedToThrow} if 
>$requests[$requestNumber]{numAddedToThrow};#Puts numAddedToThrow in 
>throw's labal if nonzero
>
>Does anyone spot what I'm doing wrong in trying to build a this label's 
>contents in this way?

Nothing.

Send us a URL to the file itself.  That'll avoid a large posting and also
line breaking issues.  I have a suspicion you are barking up the wrong tree.
Showing us the code should reveal the problem in a matter of seconds.

In general as I say in my book, when presented with a slew of
error messages, fix the first one and ignore the rest, since they are quite
possibly cascading and therefore will go away when the first one is fixed.
However, I still want to see how Perl gets these weird line numbers you
report.

-- 
Peter Scott
http://www.perldebugged.com



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




Re: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Rob Dixon
Hi Chris

Simplifying sub displayResults is a Good Thing. It should actually be:

sub displayResults { print __LINE__ . "sub displayResults\n"; }

but it should compile as it is, yet the parser's still complaining about it.
I would guess that there's something wrong with the lines immediately
preceding this subroutine.

Don't worry about anything but the first error. If you've got something like
a mismatched brace (and I believe you have because your final error is
'syntax error near "}"') this will throw the scoping out anyway and confound
the parser completely.

Cheers,

Rob



"Christopher D . Lewis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:
>
> >  [EMAIL PROTECTED] (Christopher D . Lewis) writes:
> >> My problem is that the errors Perl coughs up end with:
> >>
> >> syntax error at ./nudice-01c line 187, near "sub displayResults "
> >> syntax error at ./nudice-01c line 305, near "sub rollRequest"
> >> syntax error at ./nudice-01c line 325, near "while @rawRollArray"
> >> syntax error at ./nudice-01c line 457, near "}"
> >> Execution of ./nudice-01c aborted due to compilation errors.
> >>
> >> This would be all well and good, except that every text editor I point
> >> at my program agrees that the actual line count ends at 304.
> >>
> >> Ideas?
> >
> > What line numbers do your text editors say the above statements are
> > actually on?
> >
> > Sprinkle a few
> >
> > print __LINE__;
> >
> > statements around and see what Perl thinks the line numbers are.
>
> I replaced the entirety of sub displayResults with:
>
> sub displayResults { print __line__ . "sub displayResults"; }
>
> (both to get Perl's idea of the line numbers, and to implement another
> suggestion I replace contents of problem subroutines with simple code
> to track down bugs)
>
> and my errors went from:
> chris% ./nudice-01c
> "my" variable $labelThrow masks earlier declaration in same scope at
> ./nudice-01c line 193.
> "my" variable @requests masks earlier declaration in same statement at
> ./nudice-01c line 193.
> "my" variable $requestNumber masks earlier declaration in same
> statement at ./nudice-01c line 193.
> "my" variable $labelThrow masks earlier declaration in same scope at
> ./nudice-01c line 195.
> "my" variable @requests masks earlier declaration in same scope at
> ./nudice-01c line 195.
> "my" variable $requestNumber masks earlier declaration in same scope at
> ./nudice-01c line 195.
> "my" variable $labelThrow masks earlier declaration in same scope at
> ./nudice-01c line 197.
> "my" variable @requests masks earlier declaration in same scope at
> ./nudice-01c line 197.
> "my" variable $requestNumber masks earlier declaration in same scope at
> ./nudice-01c line 197.
> "my" variable @requests masks earlier declaration in same statement at
> ./nudice-01c line 197.
> "my" variable $requestNumber masks earlier declaration in same
> statement at ./nudice-01c line 197.
> syntax error at ./nudice-01c line 187, near "sub displayResults "
> syntax error at ./nudice-01c line 305, near "sub rollRequest"
> syntax error at ./nudice-01c line 325, near "while @rawRollArray"
> syntax error at ./nudice-01c line 457, near "}"
> Execution of ./nudice-01c aborted due to compilation errors.
>
> to the more modest:
> chris% ./nudice-01c
> syntax error at ./nudice-01c line 187, near "sub displayResults "
> syntax error at ./nudice-01c line 189, near "sub rollRequest"
> syntax error at ./nudice-01c line 209, near "while @rawRollArray"
> syntax error at ./nudice-01c line 341, near "}"
> Execution of ./nudice-01c aborted due to compilation errors.
>
> So, now that I know all the variable problems are in displayResults
> despite the line numbers being off, I can start looking outside
> displayResults for the other errors.  I note in passing that I can't
> find a bunch of "my labelThrow" masking one another, as in
> displayResults I make the label for each throw using:
> my $labelThrow; # Identifies throw type for table readers
> # Calculates Label for "Throw"
>  $labelThrow .= $requests[$requestNumber]{"numDicePerThrow"} if
> $requests[$requestNumber]{"numDicePerThrow"} > 1; # Puts numDice in
> throw's label if > 1
>  $labelThrow .= "d" . $requests[$requestNumber]{"numSidesPerDie"}; #
> Puts Die size
>  $labelThrow .= $requests[$requestNumber]{numAddedToThrow} if
> $requests[$requestNumber]{numAddedToThrow};#Puts numAddedToThrow in
> throw's labal if nonzero
>
> Does anyone spot what I'm doing wrong in trying to build a this label's
> contents in this way?
>
> Note that I have no idea at all what I'm doing with these data
> structures, what's why it is "practice" :-)
>
> Many thanks,
> Chris
>



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




command line not working

2003-01-07 Thread Patricia Hinman

The perl command works if I type set path=C:\Perl\bin
at the msdos after startup.

This is the autoexec file.
Is there a syntax error here that I don't see

set JAVA_HOME =C:\j2sdk1.4.1
set J2EE_HOME =C:\j2sdkee1.2.1
set ANT_HOME =C:\ant
set CATALINA_HOME =C:\Program Files\Apache
Group\Tomcat4.1


set
path=C:\Perl\bin\;C:\mysql\bin;%JAVA_HOME%\bin;%ANT_HOME%\bin;%CATALINA_HOME%\bin;
set
classpath=C:\Perl\bin;C:\mysql\bin;%CATALINA_HOME%\bin;%ANT_HOME%\bin;C:\Perl\site\lib\auto\DBD\mysql\;

C:\VIAUDIO\VIAUDIO.COM
SET BLASTER=A220 I5 D0 P300

I'm trying to get mysql installed  correctly so I can
start studying databases.  I installed it as a
separate package from the mysql site.  Does this matter?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




command line ok now thanks

2003-01-07 Thread Patricia Hinman
I'm not sure what I did to fix it.  I took out a call
to a file (not a directory) from the path variable.

Now all is fine.  

Thankyou for responding.



__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
I am running on a windows xp pro desktop with iis installed. I have
active state Perl installed and have been using it with out a problem. I
just started to play with cgi and I am having a lot of problems getting
it to work right. I have a static html form that's action calls the
following script. When it I hit submit all it does is display it as if
it was a text file. If I rename it to .pl then it tries to download it.
However if I have just call another test cgi script that displays some
html then it runs fine (also named .pl) with one exception it tells me
that it is to late to do -T.

So basically I need to find out how to call this script from my form and
have it execute.
Second I need to find out how to get .cgi scripts to load instead of
displaying or trying to download.
Third I need to know how to pass the -t to the compiler before my script
executes. (I am assuming this is a problem with Perl on windows not
using the shebang. Even though -w works odd.)

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

my $q=new CGI;
print $q->header ("text/plain");
print "These are the parameters I received:\n\n";

my ($name, $value);
foreach $name ($q->param){
  print "$name:\n";
  foreach $value ($q->param($name)){
print "\t$value\n";
  }
}


Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com


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


RE: Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
Correction inline

> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 3:02 PM
> To: Perl
> Subject: Cgi Win xp Perl
> 
> 
> I am running on a windows xp pro desktop with iis installed. 
> I have active state Perl installed and have been using it 
> with out a problem. I just started to play with cgi and I am 
> having a lot of problems getting it to work right. I have a 
> static html form that's action calls the following script. 
> When it I hit submit all it does is display it as if it was a 
> text file. If I rename it to .pl then it tries to download 
> it. 


> However if I have just call another test cgi script that 
> displays some html then it runs fine (also named .pl) with 
> one exception it tells me that it is to late to do -T.
> 
What I mean is if I run a cgi script that is not called from a form.
Then it seem to run fine.
But only if its name .pl. 


> So basically I need to find out how to call this script from 
> my form and have it execute. Second I need to find out how to 
> get .cgi scripts to load instead of displaying or trying to 
> download. Third I need to know how to pass the -t to the 
> compiler before my script executes. (I am assuming this is a 
> problem with Perl on windows not using the shebang. Even 
> though -w works odd.)
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> 
> my $q=new CGI;
> print $q->header ("text/plain");
> print "These are the parameters I received:\n\n";
> 
> my ($name, $value);
> foreach $name ($q->param){
>   print "$name:\n";
>   foreach $value ($q->param($name)){
> print "\t$value\n";
>   }
> }
> 
> 
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
> 
> 


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




RE: Cgi Win xp Perl

2003-01-07 Thread Ken Lehman
Try putting the -T after the -w at the top of your perl script, make sure
that your script ends in .cgi and your iis is setup to run scripts and
change 

print $q->header ("text/plain");

to 

print $q->header ("text/html");


-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 3:02 PM
To: Perl
Subject: Cgi Win xp Perl


I am running on a windows xp pro desktop with iis installed. I have
active state Perl installed and have been using it with out a problem. I
just started to play with cgi and I am having a lot of problems getting
it to work right. I have a static html form that's action calls the
following script. When it I hit submit all it does is display it as if
it was a text file. If I rename it to .pl then it tries to download it.
However if I have just call another test cgi script that displays some
html then it runs fine (also named .pl) with one exception it tells me
that it is to late to do -T.

So basically I need to find out how to call this script from my form and
have it execute.
Second I need to find out how to get .cgi scripts to load instead of
displaying or trying to download.
Third I need to know how to pass the -t to the compiler before my script
executes. (I am assuming this is a problem with Perl on windows not
using the shebang. Even though -w works odd.)

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

my $q=new CGI;
print $q->header ("text/plain");
print "These are the parameters I received:\n\n";

my ($name, $value);
foreach $name ($q->param){
  print "$name:\n";
  foreach $value ($q->param($name)){
print "\t$value\n";
  }
}


Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com




The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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




RE: Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
It still just displays the contents of my script rather then running it.

Do I need to some how associate .cgi with Perl?

> -Original Message-
> From: Ken Lehman [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 3:12 PM
> To: 'Paul Kraus'; Perl
> Subject: RE: Cgi Win xp Perl
> 
> 
> Try putting the -T after the -w at the top of your perl 
> script, make sure that your script ends in .cgi and your iis 
> is setup to run scripts and change 
> 
> print $q->header ("text/plain");
> 
> to 
> 
> print $q->header ("text/html");
> 
> 
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 3:02 PM
> To: Perl
> Subject: Cgi Win xp Perl
> 
> 
> I am running on a windows xp pro desktop with iis installed. 
> I have active state Perl installed and have been using it 
> with out a problem. I just started to play with cgi and I am 
> having a lot of problems getting it to work right. I have a 
> static html form that's action calls the following script. 
> When it I hit submit all it does is display it as if it was a 
> text file. If I rename it to .pl then it tries to download 
> it. However if I have just call another test cgi script that 
> displays some html then it runs fine (also named .pl) with 
> one exception it tells me that it is to late to do -T.
> 
> So basically I need to find out how to call this script from 
> my form and have it execute. Second I need to find out how to 
> get .cgi scripts to load instead of displaying or trying to 
> download. Third I need to know how to pass the -t to the 
> compiler before my script executes. (I am assuming this is a 
> problem with Perl on windows not using the shebang. Even 
> though -w works odd.)
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> 
> my $q=new CGI;
> print $q->header ("text/plain");
> print "These are the parameters I received:\n\n";
> 
> my ($name, $value);
> foreach $name ($q->param){
>   print "$name:\n";
>   foreach $value ($q->param($name)){
> print "\t$value\n";
>   }
> }
> 
> 
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
> 
> 
> --
> --
> 
> The views and opinions expressed in this email message are 
> the sender's own, and do not necessarily represent the views 
> and opinions of Summit Systems Inc.
> 
> 
> -- 
> 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: Debugging Problem: Phantom line numbers!

2003-01-07 Thread R. Joseph Newton
Good tip, Peter,

Joseph

Peter Scott wrote:

> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (Christopher D . Lewis) writes:
> >
> >On Tuesday, January 7, 2003, at 10:31  AM, Peter Scott wrote:
> >
> >>  [EMAIL PROTECTED] (Christopher D . Lewis) writes:
> >>> My problem is that the errors Perl coughs up end with:
> >>>
> >>> syntax error at ./nudice-01c line 187, near "sub displayResults "
> >>> syntax error at ./nudice-01c line 305, near "sub rollRequest"
> >>> syntax error at ./nudice-01c line 325, near "while @rawRollArray"
> >>> syntax error at ./nudice-01c line 457, near "}"
> >>> Execution of ./nudice-01c aborted due to compilation errors.
> >>>
> >>> This would be all well and good, except that every text editor I point
> >>> at my program agrees that the actual line count ends at 304.
> >>>
> >>> Ideas?
> >>
> >> What line numbers do your text editors say the above statements are
> >> actually on?
> >>
> >> Sprinkle a few
> >>
> >>  print __LINE__;
> >>
> >> statements around and see what Perl thinks the line numbers are.
> >
> >I replaced the entirety of sub displayResults with:
> >
> >sub displayResults { print __line__ . "sub displayResults"; }
>
> That needs to be __LINE__, not __line__.  The above is an error.
> You do have -w and use strict in this program, right?
>
> >(both to get Perl's idea of the line numbers, and to implement another
> >suggestion I replace contents of problem subroutines with simple code
> >to track down bugs)
> >
> >and my errors went from:
> >chris% ./nudice-01c
> >"my" variable $labelThrow masks earlier declaration in same scope at
> >./nudice-01c line 193.
> >"my" variable @requests masks earlier declaration in same statement at
> >./nudice-01c line 193.
> >"my" variable $requestNumber masks earlier declaration in same
> >statement at ./nudice-01c line 193.
> >"my" variable $labelThrow masks earlier declaration in same scope at
> >./nudice-01c line 195.
> >"my" variable @requests masks earlier declaration in same scope at
> >./nudice-01c line 195.
> >"my" variable $requestNumber masks earlier declaration in same scope at
> >./nudice-01c line 195.
> >"my" variable $labelThrow masks earlier declaration in same scope at
> >./nudice-01c line 197.
> >"my" variable @requests masks earlier declaration in same scope at
> >./nudice-01c line 197.
> >"my" variable $requestNumber masks earlier declaration in same scope at
> >./nudice-01c line 197.
> >"my" variable @requests masks earlier declaration in same statement at
> >./nudice-01c line 197.
> >"my" variable $requestNumber masks earlier declaration in same
> >statement at ./nudice-01c line 197.
> >syntax error at ./nudice-01c line 187, near "sub displayResults "
> >syntax error at ./nudice-01c line 305, near "sub rollRequest"
> >syntax error at ./nudice-01c line 325, near "while @rawRollArray"
> >syntax error at ./nudice-01c line 457, near "}"
> >Execution of ./nudice-01c aborted due to compilation errors.
> >
> >to the more modest:
> >chris% ./nudice-01c
> >syntax error at ./nudice-01c line 187, near "sub displayResults "
> >syntax error at ./nudice-01c line 189, near "sub rollRequest"
> >syntax error at ./nudice-01c line 209, near "while @rawRollArray"
> >syntax error at ./nudice-01c line 341, near "}"
> >Execution of ./nudice-01c aborted due to compilation errors.
>
> I've got this feeling that you've done something fundamentally wrong in
> your program, like using Pascal's BEGIN and END instead of curly braces
> for subroutine code blocks :-)
>
> >So, now that I know all the variable problems are in displayResults
> >despite the line numbers being off, I can start looking outside
> >displayResults for the other errors.  I note in passing that I can't
> >find a bunch of "my labelThrow" masking one another, as in
> >displayResults I make the label for each throw using:
> >my $labelThrow; # Identifies throw type for table readers
> ># Calculates Label for "Throw"
> > $labelThrow .= $requests[$requestNumber]{"numDicePerThrow"} if
> >$requests[$requestNumber]{"numDicePerThrow"} > 1; # Puts numDice in
> >throw's label if > 1
> > $labelThrow .= "d" . $requests[$requestNumber]{"numSidesPerDie"}; #
> >Puts Die size
> > $labelThrow .= $requests[$requestNumber]{numAddedToThrow} if
> >$requests[$requestNumber]{numAddedToThrow};#Puts numAddedToThrow in
> >throw's labal if nonzero
> >
> >Does anyone spot what I'm doing wrong in trying to build a this label's
> >contents in this way?
>
> Nothing.
>
> Send us a URL to the file itself.  That'll avoid a large posting and also
> line breaking issues.  I have a suspicion you are barking up the wrong tree.
> Showing us the code should reveal the problem in a matter of seconds.
>
> In general as I say in my book, when presented with a slew of
> error messages, fix the first one and ignore the rest, since they are quite
> possibly cascading and therefore will go away when the first one is fixed.
> However, I still want to see how Perl gets these weird line numb

Re: Get photos from an FTP site

2003-01-07 Thread R. Joseph Newton
Michael,

Escape the dot: "\."  That should do't.

Joseph

Michael Kramer wrote:

> I've been having some problems with this little code two major issues.
> What I'm tring to do is get Photos off an FTP site:
> I have a text file with about 4000 lines and on each line is an eight digit
> number "30635325".  I take all of the is an put it into an array.  Then I
> have to change the info to 30635325_0.jpg because on the FTP site that's how
> each one of the Photos are saved.  I'm getting weird output here the "." is
> not working example of the output "_0.jp 78".  Next assuming it works. I
> connect to the FTP site and get a list of what they have.  The fun thing is
> that the FTP site has most of the photos I need but they are separated in to
> different folders, so the file I need is "30635325_0.jpg" is located in
> first folder "30" second folder "635" then the file is "325_0.jpg".  I have
> written the code to do this but it take a long time and I wanted to know if
> this is the best way to do it.  If any one could please help me it would be
> greatly appreciated.
>
> Thanks
>
> #!/usr/local/bin/perl -w
> use strict;
>
> print "Step 1: Find the $file in $dir.\n";
> chdir($dir) or die "Can't open $dir: $!";
>
> print "Step 2: Open the $file.\n";
> open(FILE, $file) or die "Can't open $file: $!";
> @word = ;
> chomp @word;
> close(FILE);
>
> print "Step 3: Clean up our listings.\n";
> #I need to fix the listings from the text file to what they are on the FTP
> sit
> @correctedwords = ();
> foreach $item (@word) {
> if (substr($item,length($item) - 6, length($item)) ne 
>"_0.jpg"){
> $looking_for_listings{$item . "_0.jpg"} = 1;
> } else {
> $looking_for_listings{$item} = 1;
> }
> }
> 
> #once I do this I have been getting some funkey out put. "_0.jp 67"
> 
>
> #I need to see if they exist on the ftp site.
> print "Step 4: Start FTP.\n";
> use Net::FTP;
> #... connect to the FTP site.
>
> $ftp->cwd("$pin_folder")
> or $ftp->cwd("$pin_folder")
> or die "Couldn't change to dir $pin_folder. \n$!\n";
>
> print "Step 5: Get the list they have.\n";
> @first_folder = $ftp->ls()
> or die "Couldn't get a list of files. $!\n";
>
> foreach $myfolder (@first_folder) {
> $ftp->cwd("$myfolder")
> or die "Did not work $myfolder\n";
> @second_folder = $ftp->ls()
> or die "can't get list in $second_folder. \n";
> foreach $folder2 (@second_folder) {
> $ftp->cwd("$folder2")
> or die "did not work $folder2\n";
> @files = $ftp->ls()
> or die "can't get the list in $folder2";
> $ftp->cwd("../")
> or die "can't get the list in ../";
> foreach $file (@files) {
> if ($looking_for_listings{$myfolder . 
>$folder2 . $file}) {
> $seen{$myfolder . $folder2 . $file} 
>= 1;
> }
> }
> }
> $ftp->cwd("../")
> or die "can't get the list in ../";
> }
>
> print "Step 6: print the list they have and we want.\n";
> #I should get about 300 listings but I get nothing
> for $a ( keys %seen) {
> print "$a=$seen{$a}\n";
> }
>
> $ftp->quit();
>
> Michael Kramer
> [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: Cgi Win xp Perl

2003-01-07 Thread david
Paul Kraus wrote:

> It still just displays the contents of my script rather then running it.
> 

have you try the '?' trick? if no, try something like:

http://your.server/your.cgi-bin/your_script.pl?whatever

the '?whatever' portion might give enough a hint to IIS that the request is 
a CGI request. if that works, you can do the same thing with the form 
stuff. of course, it's better to actually fix IIS then going around the 
problem.

david

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




using taint and File::Find error

2003-01-07 Thread Patricia Hinman
I'm writing a CGI script that allows a user to create
directories and upload an html file.  I'm using this
at the beginning of the script

#!C:\Perl\bin\perl.exe -w -T 
#!/usr/bin/perl
use strict;
BEGIN{open(STDERR, ">./err.txt");}

the htmldir is read from a txt file and
untainted like this:

$htmldir =~ s@[^\w\-\\]@@g;

#and using find.pm in this manner:

sub allsubdir{
my$k=0;
my$root = "$ENV{'DOCUMENT_ROOT'}/$htmldir/";
find (\&do_this, $root);

sub do_this {
$_ = $File::Find::dir;
unless(/\.\w*$/){push(@subdir1,$_);}
}
return @subdir;
}

This is the only error I get.

Insecure dependency in chdir while running with -T
switch at C:/Perl/lib/File/Find.pm line 765, 
line 2.

How do I fix this?  I've downloaded the Safe module
but I'm not sure how to use it yet.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
same issues. If it's a pl file it tries to download. If its .cgi then it
just displays my code.

> -Original Message-
> From: david [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 4:39 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Cgi Win xp Perl
> 
> 
> Paul Kraus wrote:
> 
> > It still just displays the contents of my script rather 
> then running 
> > it.
> > 
> 
> have you try the '?' trick? if no, try something like:
> 
http://your.server/your.cgi-bin/your_script.pl?whatever

the '?whatever' portion might give enough a hint to IIS that the request
is 
a CGI request. if that works, you can do the same thing with the form 
stuff. of course, it's better to actually fix IIS then going around the 
problem.

david

-- 
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: Cgi Win xp Perl

2003-01-07 Thread Tucker, Ernie
I think I had to compile apahe for use with perl. I think in iis you need to specify 
how to deal with perl and cgi. Been a long time since I used iis.


-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 3:20 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Cgi Win xp Perl


same issues. If it's a pl file it tries to download. If its .cgi then it
just displays my code.

> -Original Message-
> From: david [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 4:39 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Cgi Win xp Perl
> 
> 
> Paul Kraus wrote:
> 
> > It still just displays the contents of my script rather 
> then running 
> > it.
> > 
> 
> have you try the '?' trick? if no, try something like:
> 
http://your.server/your.cgi-bin/your_script.pl?whatever

the '?whatever' portion might give enough a hint to IIS that the request
is 
a CGI request. if that works, you can do the same thing with the form 
stuff. of course, it's better to actually fix IIS then going around the 
problem.

david

-- 
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: Cgi Win xp Perl

2003-01-07 Thread david
Paul Kraus wrote:

> same issues. If it's a pl file it tries to download. If its .cgi then it
> just displays my code.
> 

what happen if you type your cgi_script.pl in the DOS prompt? does Windos 
complain about not able to execute the script? if so, Windos(as well as 
IIS) probably doesn't know how to execute your *.pl file. you probably have 
to associate *.pl with your Perl binary.

david

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




Re: How to substract words

2003-01-07 Thread R. Joseph Newton
Hi Alex,

Can you show or tell us what you have tried?  We could also help more if yoiu tell us 
a little about the subject matter you are covering in class.

Alex Demmler wrote:

> Hi folks!
>
> I have a problem with pattern matching.
> I want do find the difference between two words. I have tried, but donot get
> it work. Any tips?
>
> Example:
>
> 1. Word = helloRed
> 2. Word = hello
> ---
> Result = Red
>
> Thanks Alex
>
> --
> 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: How to substract words

2003-01-07 Thread R. Joseph Newton
Hi John,

Hmmm, I don't know about this handing ready-made code out, but--what the hell, the 
harms been done, so I';ll join the party:

#!/usr/bin/perl -w

use strict;
use warnings;

my $word1 = "Hello";
my $word2 = HelloWorld;

sub difference {
 my ($word1, $word2) = @_;
 if ($word1 =~ /.*$word2.*) {
   $result = ($word1 =~ s/(.*)$word2(.*)/$1$2/)
 } elsif ($word2 =~ /.*$word1.*) {
   $result = ($word2 =~ s/(.*)$word1(.*)/$1$2/)
 } else {
   $result = "";
 }
 return $result;
}

For the sake of comprehension.

Joseph

"John W. Krahn" wrote:

> Alex Demmler wrote:
> >
> > Hi folks!
>
> Hello,
>
> > I have a problem with pattern matching.
> > I want do find the difference between two words. I have tried, but donot get
> > it work. Any tips?
> >
> > Example:
> >
> > 1. Word = helloRed
> > 2. Word = hello
> > ---
> > Result = Red
>
> my $word1 = 'helloRed';
> my $word2 = 'hello';
>
> # make sure that $word1 is longer than word2
> ( $word1, $word2 ) = ( $word2, $word1 ) if length( $word1 ) < length( $word2 );
>
> ( my $result = $word1 ) =~ s/\Q$word2//;
>
> print "$result\n";
>
> John
> --
> use Perl;
> program
> fulfillment
>
> --
> 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: Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
nope that's the stumper. I use Perl all the time for business and just
to play around I wanted to mess with cgi. The non cgi stuff works fine.
Actually I can ran the cgi stuff from the command line just fine to.

> -Original Message-
> From: david [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 4:49 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Cgi Win xp Perl
> 
> 
> Paul Kraus wrote:
> 
> > same issues. If it's a pl file it tries to download. If its 
> .cgi then 
> > it just displays my code.
> > 
> 
> what happen if you type your cgi_script.pl in the DOS prompt? 
> does Windos 
> complain about not able to execute the script? if so, 
> Windos(as well as 
> IIS) probably doesn't know how to execute your *.pl file. you 
> probably have 
> to associate *.pl with your Perl binary.
> 
> david
> 
> -- 
> 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: How to substract words

2003-01-07 Thread R. Joseph Newton
With a minor correction: [or three or four--that was definitely posted in haste] so 
that it runs:
#!/usr/bin/perl -w

use strict;
use warnings;

my $word1 = "Hello";
my $word2 = "Othello's World";
my $result = difference($word1, $word2);
print "$result\n";

sub difference {
 my ($word1, $word2) = @_;
 if ($word1 =~ /.*$word2.*/i) {
   $word1 =~ s/(.*)$word2(.*)/$1$2/i;
   return $word1;
 } elsif ($word2 =~ /.*$word1.*/i) {
   $word2 =~ s/(.*)$word1(.*)/$1$2/i;
   return $word2;
 }
}

E:\d_drive\perlStuff\guests>StringDifference.pl
Ot's World

"R. Joseph Newton" wrote:

> Hi John,
>
> Hmmm, I don't know about this handing ready-made code out, but--what the hell, the 
>harms been done, so I';ll join the party:
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> my $word1 = "Hello";
> my $word2 = "HelloWorld";
>
> sub difference {
>  my ($word1, $word2) = @_;
>  if ($word1 =~ /.*$word2.*) {
>$result = ($word1 =~ s/(.*)$word2(.*)/$1$2/)
>  } elsif ($word2 =~ /.*$word1.*) {
>$result = ($word2 =~ s/(.*)$word1(.*)/$1$2/)
>  } else {
>$result = "";
>  }
>  return $result;
> }
>
> For the sake of comprehension.
>
> Joseph
>
> "John W. Krahn" wrote:
>
> > Alex Demmler wrote:
> > >
> > > Hi folks!
> >
> > Hello,
> >
> > > I have a problem with pattern matching.
> > > I want do find the difference between two words. I have tried, but donot get
> > > it work. Any tips?
> > >
> > > Example:
> > >
> > > 1. Word = helloRed
> > > 2. Word = hello
> > > ---
> > > Result = Red
> >
> > my $word1 = 'helloRed';
> > my $word2 = 'hello';
> >
> > # make sure that $word1 is longer than word2
> > ( $word1, $word2 ) = ( $word2, $word1 ) if length( $word1 ) < length( $word2 );
> >
> > ( my $result = $word1 ) =~ s/\Q$word2//;
> >
> > print "$result\n";
> >
> > John
> > --
> > use Perl;
> > program
> > fulfillment
> >
> > --
> > 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: Q : How to resume an ftp session + RE: Timeout at C:/Perl/lib/Net /FTP.pm line 741

2003-01-07 Thread John W. Krahn
Aman Thind wrote:
> 
> As it turned out there was some problem with the file I was trying to
> transfer.
> I could not transfer it even using an ftp client.
> The ftp client also aborts with a time out.
> 
> Another question.
> How can I use the *Resume* facility provided by an ftp server???
> Currently on error I restart the process again.
> I go back to the start of the script - match the sizes of the file to upload
> and the one present - if different then upload - else go to next file.
> The incompletely transferred file is overwritten and the transfer is not
> resumed from where it aborted.

perldoc Net::FTP
[snip]
   get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
   Get `REMOTE_FILE' from the server and store locally.
   `LOCAL_FILE' may be a filename or a filehandle. If not
   specified the the file will be stored in the current
   directory with the same leafname as the remote file.

   If `WHERE' is given then the first `WHERE' bytes of
   the file will not be transfered, and the remaining
   bytes will be appended to the local file if it already
   exists.


So set the third argument of get() to the current size of the file to
get the rest of the file.

my $remote_file = 'something.zip';
my $local_file  = 'something.zip';
my $size = -s $local_file;

$ftp->get( $remote_file, $local_file, $size );



John
-- 
use Perl;
program
fulfillment

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




RE: Cgi Win xp Perl

2003-01-07 Thread david
Paul Kraus wrote:

> nope that's the stumper. I use Perl all the time for business and just
> to play around I wanted to mess with cgi. The non cgi stuff works fine.
> Actually I can ran the cgi stuff from the command line just fine to.

let me get that straight:

if the script has a .pl extension, your browser tries to download it even 
with the '?whatever' portion append at the end

if the script has a .cgi extension, the source code of the script is 
displayed even with the '?whatever' portion append at the end

if you run your scripts in a DOS windows with just its name like:

c:\whatever>your_script.pl

or:

c:\whatever>your_script.cgi

both runs fine. correct?

david

> 
>> -Original Message-
>> From: david [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, January 07, 2003 4:49 PM
>> To: [EMAIL PROTECTED]
>> Subject: RE: Cgi Win xp Perl
>> 
>> 
>> Paul Kraus wrote:
>> 
>> > same issues. If it's a pl file it tries to download. If its
>> .cgi then
>> > it just displays my code.
>> > 
>> 
>> what happen if you type your cgi_script.pl in the DOS prompt?
>> does Windos
>> complain about not able to execute the script? if so,
>> Windos(as well as
>> IIS) probably doesn't know how to execute your *.pl file. you
>> probably have
>> to associate *.pl with your Perl binary.
>> 
>> david
>> 
>> --
>> 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: using taint and File::Find error

2003-01-07 Thread John W. Krahn
Patricia Hinman wrote:
> 
> I'm writing a CGI script that allows a user to create
> directories and upload an html file.  I'm using this
> at the beginning of the script
> 
> #!C:\Perl\bin\perl.exe -w -T
> #!/usr/bin/perl
> use strict;
> BEGIN{open(STDERR, ">./err.txt");}
> 
> the htmldir is read from a txt file and
> untainted like this:
> 
> $htmldir =~ s@[^\w\-\\]@@g;
> 
> #and using find.pm in this manner:
> 
> sub allsubdir{
> my$k=0;
> my$root = "$ENV{'DOCUMENT_ROOT'}/$htmldir/";
> find (\&do_this, $root);
> 
> sub do_this {
> $_ = $File::Find::dir;
> unless(/\.\w*$/){push(@subdir1,$_);}
> }
> return @subdir;
> }
> 
> This is the only error I get.
> 
> Insecure dependency in chdir while running with -T
> switch at C:/Perl/lib/File/Find.pm line 765, 
> line 2.
> 
> How do I fix this?  I've downloaded the Safe module
> but I'm not sure how to use it yet.

Try running File::Find with the no_chdir option.

find( { wanted => \&do_this, no_chdir => 1 }, $root );




John
-- 
use Perl;
program
fulfillment

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




Re: Cgi Win xp Perl

2003-01-07 Thread R. Joseph Newton
Do you have method=POST in the action call?  Without that, many web servers will 
assume GET.

Joseph

Paul Kraus wrote:

> It still just displays the contents of my script rather then running it.
>
> Do I need to some how associate .cgi with Perl?
>
> > -Original Message-
> > From: Ken Lehman [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:12 PM
> > To: 'Paul Kraus'; Perl
> > Subject: RE: Cgi Win xp Perl
> >
> >
> > Try putting the -T after the -w at the top of your perl
> > script, make sure that your script ends in .cgi and your iis
> > is setup to run scripts and change
> >
> > print $q->header ("text/plain");
> >
> > to
> >
> > print $q->header ("text/html");
> >
> >
> > -Original Message-
> > From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:02 PM
> > To: Perl
> > Subject: Cgi Win xp Perl
> >
> >
> > I am running on a windows xp pro desktop with iis installed.
> > I have active state Perl installed and have been using it
> > with out a problem. I just started to play with cgi and I am
> > having a lot of problems getting it to work right. I have a
> > static html form that's action calls the following script.
> > When it I hit submit all it does is display it as if it was a
> > text file. If I rename it to .pl then it tries to download
> > it. However if I have just call another test cgi script that
> > displays some html then it runs fine (also named .pl) with
> > one exception it tells me that it is to late to do -T.
> >
> > So basically I need to find out how to call this script from
> > my form and have it execute. Second I need to find out how to
> > get .cgi scripts to load instead of displaying or trying to
> > download. Third I need to know how to pass the -t to the
> > compiler before my script executes. (I am assuming this is a
> > problem with Perl on windows not using the shebang. Even
> > though -w works odd.)
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use CGI;
> >
> > my $q=new CGI;
> > print $q->header ("text/plain");
> > print "These are the parameters I received:\n\n";
> >
> > my ($name, $value);
> > foreach $name ($q->param){
> >   print "$name:\n";
> >   foreach $value ($q->param($name)){
> > print "\t$value\n";
> >   }
> > }
> >
> >
> > Paul Kraus
> > Network Administrator
> > PEL Supply Company
> > 216.267.5775 Voice
> > 216-267-6176 Fax
> > www.pelsupply.com
> >
> >
> > --
> > --
> > 
> > The views and opinions expressed in this email message are
> > the sender's own, and do not necessarily represent the views
> > and opinions of Summit Systems Inc.
> >
> >
> > --
> > 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: Debugging Problem: Phantom line numbers!

2003-01-07 Thread Peter Scott
At 06:16 PM 1/7/03 -0600, Christopher D. Lewis wrote:
>On Tuesday, January 7, 2003, at 11:19  AM, Peter Scott wrote:
>
>>[responding to replacement of sub displayResults with {print __LINE__ 
>>. " sub displayResults";}]
>>That needs to be __LINE__, not __line__.  The above is an error.
>>You do have -w and use strict in this program, right?
>
>When I use "__LINE__, "... in a test script[1] I get:
>No comma allowed after filehandle at print_line.pl line 5.
>
>When I use "__LINE__ . "... in a test script[2] I get:
>__line__ sub displayResults

Well, you've got something weird going on in any case.  I'll get to it.

>(I had imagined __LINE__ might have been intended to print the line 
>number in which Perl thought the line occurred,

Correct, it does.

>but then, I am not familiar with "__" in Perl ...)

There are three special tokens, the __ is part of them.  They are 
__LINE__, __FILE__, and __PACKAGE__.  See perldata.  But I digress.

>I had "-w" in use in my original scrips, but not "use strict";  adding 
>"use strict" to the script with sub displayResults disemboweled reveals:
>  chris% dice/nudice-01c
>Global symbol "$request" requires explicit package name at 
>dice/nudice-01c line 32.
>Global symbol "@input" requires explicit package name at 
>dice/nudice-01c line 41.

[snip many errors]

You made a false economy by not using strict.  Yes, you would have to 
fix those errors - mostly due to not declaring *everything* with 
'my'.  But to leave it out is to shoot yourself in the foot.

You have managed to blow your whole leg off with a .22.

>... and I have no idea what an explicit package name is :-)  At your 
>request, I have placed the whole, ugly thing at 
>www.PuckU.org/misc/nudice-01c for inspection of why Perl thinks the 
>line numbers are as it reports ...

And here's where.  At the end of the definition of processArgs you have 
an extra character after the block end:

 }s

That one character causes Perl to think that you are introducing a 
substitution operator, which happens to find in your next non-blank line:

 sub parseArg {  # Parses request ...

text to allow it to close the substitution and think that the modifiers 
for it are 'e' and 's'.  Thereby creating an evaluating substitution 
whose evaluation code contains unbalanced braces and a comment... I do 
not know how this results in the line numbers getting screwed up, but 
the fact is that after that statement, Perl starts counting TWO lines 
for every one in your source.  It is possible to see the effect with a 
'program' as small as this:

 #!/usr/bin/perl -w
 s
 sas{#se
 BEGIN{print STDERR __LINE__,"\n" }
 BEGIN{print STDERR __LINE__,"\n" }
 BEGIN{print STDERR __LINE__,"\n" }

To call this bizarre would be an understatement.  I will post this 
snippet to perl5-porters to see if anyone can tell me why the line 
numbers get screwed, although since this is a syntactically invalid 
program anyway it may not get much attention.

Head swimming yet?  Then consider this: if you had been using strict, 
and ensuring that you had no errors, you would have found the problem a 
lot faster.  I wish I could say that it would have told you "additional 
characters after subroutine definition", but it's not that 
simple.  However, you would have seen a lot of error messages for 
things happening after that line that on closer inspection would have 
appeared impossible, thereby prompting you to start searching backwards 
from that point.  Fortunately, you indented well, so it wasn't hard to find.

But you did get quite unlucky, nonetheless.  But use strict - it is your
friend!

-- 
Peter Scott
http://www.perldebugged.com

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




taint, safe, mkpath trouble

2003-01-07 Thread Patricia Hinman
I'm trying to use taint, strict and Safe in all my
files.   I'm new to the Safe module and unsure about
this code.


#!C:\Perl\bin\perl.exe -w -T 
#!/usr/bin/perl -w -T 
use strict;

if($q->param("add_a_dir")){
my$newdir = $q->param("add_a_dir");
$newdir =~ s/[^\w\-\.]//g;
$dirext .= $newdir;
push(@message, "found param add_a_dir");

#my$mkpathsafe = new Safe();

#this doesn't go inside the sub add_a_dir
#$mkpathsafe->share('&add_a_dir');

#this goes inside add_a_dir but throws a taint error
&add_a_dir;

sub add_a_dir{
push(@message, "in param add_a_dir");
unless(-e "$ENV{'DOCUMENT_ROOT'}/$htmldir/$dirext"){
eval {mkpath("$ENV{'DOCUMENT_ROOT'}/$htmldir/$dirext",
0,0755)};
  if ($@) {
push(@message,"Couldn't Make Directory:\n
$ENV{'DOCUMENT_ROOT'}/$htmldir/$dirext, $@");
  }else{push(@message,"Made Directory:\n
$ENV{'DOCUMENT_ROOT'}/$htmldir/$dirext")}
}
}
}

Error:
 Couldn't Make Directory:
 C:/Apache2/htdocs/hayfork/group, Insecure dependency
in mkdir while running with -T switch at
C:/Perl/lib/File/Path.pm line 147,  line 2.

Can someone tell me how to use mkpath with taint and
Safe?

Thankyou so much for your time.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: Cgi Win xp Perl

2003-01-07 Thread R. Joseph Newton
Hi Ken,

The ActiveState installation on Windows totally ignores the Unix command, treeating it 
as a comment.

Joseph

Ken Lehman wrote:

> Is this path right? This looks like a unix path and your trying this on
> windows right?
> > #!/usr/bin/perl -w
>
> Anyway I setup my XP box to run perl, I am sorry to say I forget exactly
> what I did but I know I had to set something up in IIS settings.
> Sorry, you might get faster help from the cgi mailing list.
> -Ken
>
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 3:11 PM
> To: 'Ken Lehman'; 'Perl'
> Subject: RE: Cgi Win xp Perl
>
> It still just displays the contents of my script rather then running it.
>
> Do I need to some how associate .cgi with Perl?
>
> > -Original Message-
> > From: Ken Lehman [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:12 PM
> > To: 'Paul Kraus'; Perl
> > Subject: RE: Cgi Win xp Perl
> >
> >
> > Try putting the -T after the -w at the top of your perl
> > script, make sure that your script ends in .cgi and your iis
> > is setup to run scripts and change
> >
> > print $q->header ("text/plain");
> >
> > to
> >
> > print $q->header ("text/html");
> >
> >
> > -Original Message-
> > From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:02 PM
> > To: Perl
> > Subject: Cgi Win xp Perl
> >
> >
> > I am running on a windows xp pro desktop with iis installed.
> > I have active state Perl installed and have been using it
> > with out a problem. I just started to play with cgi and I am
> > having a lot of problems getting it to work right. I have a
> > static html form that's action calls the following script.
> > When it I hit submit all it does is display it as if it was a
> > text file. If I rename it to .pl then it tries to download
> > it. However if I have just call another test cgi script that
> > displays some html then it runs fine (also named .pl) with
> > one exception it tells me that it is to late to do -T.
> >
> > So basically I need to find out how to call this script from
> > my form and have it execute. Second I need to find out how to
> > get .cgi scripts to load instead of displaying or trying to
> > download. Third I need to know how to pass the -t to the
> > compiler before my script executes. (I am assuming this is a
> > problem with Perl on windows not using the shebang. Even
> > though -w works odd.)
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use CGI;
> >
> > my $q=new CGI;
> > print $q->header ("text/plain");
> > print "These are the parameters I received:\n\n";
> >
> > my ($name, $value);
> > foreach $name ($q->param){
> >   print "$name:\n";
> >   foreach $value ($q->param($name)){
> > print "\t$value\n";
> >   }
> > }
> >
> >
> > Paul Kraus
> > Network Administrator
> > PEL Supply Company
> > 216.267.5775 Voice
> > 216-267-6176 Fax
> > www.pelsupply.com
> >
> >
> > --
> > --
> > 
> > The views and opinions expressed in this email message are
> > the sender's own, and do not necessarily represent the views
> > and opinions of Summit Systems Inc.
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> 
> 
> The views and opinions expressed in this email message are the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
>
> --
> 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: Cgi Win xp Perl

2003-01-07 Thread R. Joseph Newton
Hi Paul,

Did you set up IIS for the virtual directory?  You need top add a virtual directory 
for each location you'll be serving these scripts up from.  File-system opening will 
not work as it does with static HTML.
1.  Create a virtual directory in IIS
2  Right-click on it, and choose properties
3. Click configure
4. Make sure that *.pl and *.cgi are listed as file types for the server to handle.  
The path to the executable should be followed by " %s %s", like:
f:\Perl\bin\perl.exe %s %s
5. Hake sure All Verbs is selected
6. Use the http://localhost/path URL format to access your script

Joseph


Paul Kraus wrote:

> nope that's the stumper. I use Perl all the time for business and just
> to play around I wanted to mess with cgi. The non cgi stuff works fine.
> Actually I can ran the cgi stuff from the command line just fine to.
>
> > -Original Message-
> > From: david [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 4:49 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Cgi Win xp Perl
> >
> >
> > Paul Kraus wrote:
> >
> > > same issues. If it's a pl file it tries to download. If its
> > .cgi then
> > > it just displays my code.
> > >
> >
> > what happen if you type your cgi_script.pl in the DOS prompt?
> > does Windos
> > complain about not able to execute the script? if so,
> > Windos(as well as
> > IIS) probably doesn't know how to execute your *.pl file. you
> > probably have
> > to associate *.pl with your Perl binary.
> >
> > david
> >
> > --
> > 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: Cgi Win xp Perl

2003-01-07 Thread Ken Lehman
Is this path right? This looks like a unix path and your trying this on
windows right?
> #!/usr/bin/perl -w

Anyway I setup my XP box to run perl, I am sorry to say I forget exactly
what I did but I know I had to set something up in IIS settings. 
Sorry, you might get faster help from the cgi mailing list.
-Ken

-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 3:11 PM
To: 'Ken Lehman'; 'Perl'
Subject: RE: Cgi Win xp Perl


It still just displays the contents of my script rather then running it.

Do I need to some how associate .cgi with Perl?

> -Original Message-
> From: Ken Lehman [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 3:12 PM
> To: 'Paul Kraus'; Perl
> Subject: RE: Cgi Win xp Perl
> 
> 
> Try putting the -T after the -w at the top of your perl 
> script, make sure that your script ends in .cgi and your iis 
> is setup to run scripts and change 
> 
> print $q->header ("text/plain");
> 
> to 
> 
> print $q->header ("text/html");
> 
> 
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 3:02 PM
> To: Perl
> Subject: Cgi Win xp Perl
> 
> 
> I am running on a windows xp pro desktop with iis installed. 
> I have active state Perl installed and have been using it 
> with out a problem. I just started to play with cgi and I am 
> having a lot of problems getting it to work right. I have a 
> static html form that's action calls the following script. 
> When it I hit submit all it does is display it as if it was a 
> text file. If I rename it to .pl then it tries to download 
> it. However if I have just call another test cgi script that 
> displays some html then it runs fine (also named .pl) with 
> one exception it tells me that it is to late to do -T.
> 
> So basically I need to find out how to call this script from 
> my form and have it execute. Second I need to find out how to 
> get .cgi scripts to load instead of displaying or trying to 
> download. Third I need to know how to pass the -t to the 
> compiler before my script executes. (I am assuming this is a 
> problem with Perl on windows not using the shebang. Even 
> though -w works odd.)
> 
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> 
> my $q=new CGI;
> print $q->header ("text/plain");
> print "These are the parameters I received:\n\n";
> 
> my ($name, $value);
> foreach $name ($q->param){
>   print "$name:\n";
>   foreach $value ($q->param($name)){
> print "\t$value\n";
>   }
> }
> 
> 
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
> 
> 
> --
> --
> 
> The views and opinions expressed in this email message are 
> the sender's own, and do not necessarily represent the views 
> and opinions of Summit Systems Inc.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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




RE: Cgi Win xp Perl

2003-01-07 Thread Paul Kraus
NP Thanks anyways The cgi mailing list is where?

> -Original Message-
> From: Ken Lehman [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, January 07, 2003 3:30 PM
> To: 'Paul Kraus'; 'Perl'
> Subject: RE: Cgi Win xp Perl
> 
> 
> Is this path right? This looks like a unix path and your 
> trying this on windows right?
> > #!/usr/bin/perl -w
> 
> Anyway I setup my XP box to run perl, I am sorry to say I 
> forget exactly what I did but I know I had to set something 
> up in IIS settings. 
> Sorry, you might get faster help from the cgi mailing list. -Ken
> 
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 3:11 PM
> To: 'Ken Lehman'; 'Perl'
> Subject: RE: Cgi Win xp Perl
> 
> 
> It still just displays the contents of my script rather then 
> running it.
> 
> Do I need to some how associate .cgi with Perl?
> 
> > -Original Message-
> > From: Ken Lehman [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:12 PM
> > To: 'Paul Kraus'; Perl
> > Subject: RE: Cgi Win xp Perl
> > 
> > 
> > Try putting the -T after the -w at the top of your perl
> > script, make sure that your script ends in .cgi and your iis 
> > is setup to run scripts and change 
> > 
> > print $q->header ("text/plain");
> > 
> > to
> > 
> > print $q->header ("text/html");
> > 
> > 
> > -Original Message-
> > From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 3:02 PM
> > To: Perl
> > Subject: Cgi Win xp Perl
> > 
> > 
> > I am running on a windows xp pro desktop with iis installed.
> > I have active state Perl installed and have been using it 
> > with out a problem. I just started to play with cgi and I am 
> > having a lot of problems getting it to work right. I have a 
> > static html form that's action calls the following script. 
> > When it I hit submit all it does is display it as if it was a 
> > text file. If I rename it to .pl then it tries to download 
> > it. However if I have just call another test cgi script that 
> > displays some html then it runs fine (also named .pl) with 
> > one exception it tells me that it is to late to do -T.
> > 
> > So basically I need to find out how to call this script from
> > my form and have it execute. Second I need to find out how to 
> > get .cgi scripts to load instead of displaying or trying to 
> > download. Third I need to know how to pass the -t to the 
> > compiler before my script executes. (I am assuming this is a 
> > problem with Perl on windows not using the shebang. Even 
> > though -w works odd.)
> > 
> > #!/usr/bin/perl -w
> > use strict;
> > use CGI;
> > 
> > my $q=new CGI;
> > print $q->header ("text/plain");
> > print "These are the parameters I received:\n\n";
> > 
> > my ($name, $value);
> > foreach $name ($q->param){
> >   print "$name:\n";
> >   foreach $value ($q->param($name)){
> > print "\t$value\n";
> >   }
> > }
> > 
> > 
> > Paul Kraus
> > Network Administrator
> > PEL Supply Company
> > 216.267.5775 Voice
> > 216-267-6176 Fax
> > www.pelsupply.com
> > 
> > 
> > --
> > --
> > 
> > The views and opinions expressed in this email message are
> > the sender's own, and do not necessarily represent the views 
> > and opinions of Summit Systems Inc.
> > 
> > 
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> --
> --
> 
> The views and opinions expressed in this email message are 
> the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
> 


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