Re: REQUEST_METHOD

2004-03-16 Thread Mike Ni

--- Wiggins d'Anconia <[EMAIL PROTECTED]> wrote:
> Please bottom post...
> 
> Mike Ni wrote:
> > Thanks for the resoponse,
> > 
> > It was written by a person who left already. 
> > Now, I need to find out how his code work. 
>  
> 
> This should get you going:
>
http://httpd.apache.org/docs/howto/cgi.html#environmentvariables
> 
> http://danconia.org
> 
 
Thanks a lot. Very helpful

MIke


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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




RE: lexis nexis search module or script?

2004-03-16 Thread Toby Stuart
WWW::Mechanize will do most if not all of what you need.

> -Original Message-
> From: Stuart White [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 17, 2004 8:06 AM
> To: [EMAIL PROTECTED]
> Subject: lexis nexis search module or script?
> 
> 
> I need to search a web database that has several
> databases within it, and has to be searched on about
> 50 terms.  The process goes something like this:
> 
> 1: go to website
> 2: login
> 3: enter second login
> 4: click on link that shows databases
> 5: click on one database link
> 6: enter search term
> 7: if results are more than 100, click on FOCUS link
> and go to original search box.  
> 8: add or subtract proscribed keywords
> 9: click Search
> 10: if results less than 15, click on each result link
> ll: grab each individual result page
> 12: dump data within MSWord document
> 13: else collect listed results 
> 14: dump results into MSWord document
> 
> Manually, i wouldn't dump the results, I would just
> examine them and print the applicable ones.  Here, I
> dump them because I can't figure out how to manually
> get the search to only give me what I want, so I
> wouldn't leave that to a program. 
> I certainly could do it manually, but was curious if
> a) it had already been done and there was an available
> tool, or b) something I could write that would be
> faster than searching manually.
> 
> I checked cpan.org for Lexis or Lexis Nexis to no
> avail.  Methinks that this process is similar to a
> Google search with the added bonus of a login, so it
> might be that the LWP module would have what I need. 
> The point is, I don't know, and would be very grateful
> if someone could tell me if a) this sort of module or
> script exists and is freely available, and/or b)
> writing a program like this is not terribly difficult
> for a novice.  I can't really show you the website as
> it's password protected, but hopefully that
> description is enough.  
> I'm sure that this would be a program that is over my
> head right now, which is why I'm hoping that there is
> something out there that I could adapt for my own use.
> Any suggestions?  Thanks, -stu
> 

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




Re: traps in perl

2004-03-16 Thread John W. Krahn
Jayakumar Rajagopal wrote:
>
> From: John W. Krahn [mailto:[EMAIL PROTECTED]
>
> Jayakumar Rajagopal wrote:
> > $|=1;
> >
> > $SIG{INT} = sub { print "tamizh vaazhga\n": };
> >
> > $SIG{USR1} = sub { print " vennai\n"; };
> >
> > $SIG{TSTP} = sub { print "poda maanga\n"; };
> >
> > while(1)
> >
> > {
> >
> > print "...";
> >
> > `sleep 1`;
>
> Why are you running an external program to do something that perl
> provides a function for?
>
> perldoc -f sleep
>
> > }
> >
> > __END__;
> 
> Sorry for using shell. I am good in shell,

No need to apologize.  :-)

> but do not know most  of
> perl. ( O Reilly says you can code perl very well if you know just
> 10% of it)

Yes, Perl is good that way.

> I am a poor person without perldoc.

If you have Perl installed on your computer then you should have the
documentation installed as well.  If not and if you have web access you
can use http://perldoc.com/

> Also I am new to perl.
> ;-(... Anyway I would try better.


John
-- 
use Perl;
program
fulfillment

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




Re: VbScript -> PerlScript

2004-03-16 Thread Clinton
Thanks Randy
woke from a deep sleep
this is OLE on Windoze
I think my confusion was re properties & methods.
Property:
$theDoc->{FontSize} = '96';
Methods
$theDoc->AddText('Hello World');
$theDoc->Save('c:\hworld.pdf');
and it works as advertised.
Thanks a million
CJ

- Original Message - 
From: "Randy W. Sims" <[EMAIL PROTECTED]>
To: "Clinton" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 2:01 PM
Subject: Re: VbScript -> PerlScript


On 3/16/2004 10:00 PM, Clinton wrote:

> Hi
> Could I have a hint on converting
> theDoc.FontSize = 96
> theDoc.AddText "Hello World"
> theDoc.Save "c:\hworld.pdf"
> I'm able to create an object with
> my $theDoc = $Server->CreateObject("obj.doc");
> I tried
> $theDoc->{FontSize} = 96;
> $theDoc->{AddText} = "Hello World";
> $theDoc->{Save } ="c:\hworld.pdf";

What type of object is $thedoc? What type of object is $Server? I can 
infer the platform your working on only because I'm familiar with 
Windows. Is this OLE or a pdf writing module that you are using? We need 
much more context information.

Randy.



-- 
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: VbScript -> PerlScript

2004-03-16 Thread Randy W. Sims
On 3/16/2004 10:00 PM, Clinton wrote:

Hi
Could I have a hint on converting
theDoc.FontSize = 96
theDoc.AddText "Hello World"
theDoc.Save "c:\hworld.pdf"
I'm able to create an object with
my $theDoc = $Server->CreateObject("obj.doc");
I tried
$theDoc->{FontSize} = 96;
$theDoc->{AddText} = "Hello World";
$theDoc->{Save } ="c:\hworld.pdf";
What type of object is $thedoc? What type of object is $Server? I can 
infer the platform your working on only because I'm familiar with 
Windows. Is this OLE or a pdf writing module that you are using? We need 
much more context information.

Randy.



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



VbScript -> PerlScript

2004-03-16 Thread Clinton
Hi
Could I have a hint on converting
theDoc.FontSize = 96
theDoc.AddText "Hello World"
theDoc.Save "c:\hworld.pdf"
I'm able to create an object with
my $theDoc = $Server->CreateObject("obj.doc");
I tried
$theDoc->{FontSize} = 96;
$theDoc->{AddText} = "Hello World";
$theDoc->{Save } ="c:\hworld.pdf";

with no success.
Grateful for any suggestions
CJ

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




Re: Modifying STDIN

2004-03-16 Thread Randy W. Sims
Try this:

#!/usr/bin/perl

package MySTDIN;

use strict;
use warnings;
use Tie::Handle;
our @ISA = qw(Tie::Handle);
Actually, you can remove the above two lines.

You just need to tie STDIN before it gets used, and alter the code in 
READLINE to alter the lines. Note you have to handle both scalar and 
array contexts.

I'm not completely sure of the correctness of the above. Use at your own 
risk.
And I think I've convinced myself that it is correct; anyone else?

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



Re: REQUEST_METHOD

2004-03-16 Thread Wiggins d'Anconia
Please bottom post...

Mike Ni wrote:
Thanks for the resoponse,

It was written by a person who left already. 
Now, I need to find out how his code work. 

Do you happen to know where I can find out
more about such %ENV? is there a web site or
man page? 

I "google" "ww.apache.org", yet no luck. 
Pretty odd! I really have a hard time with
www.apache.org/ 

This should get you going:
http://httpd.apache.org/docs/howto/cgi.html#environmentvariables
http://danconia.org

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



Re: REQUEST_METHOD

2004-03-16 Thread Mike Ni

Thanks for the resoponse,

It was written by a person who left already. 
Now, I need to find out how his code work. 

Do you happen to know where I can find out
more about such %ENV? is there a web site or
man page? 

I "google" "ww.apache.org", yet no luck. 
Pretty odd! I really have a hard time with
www.apache.org/ 

Mike

--- Wiggins d'Anconia <[EMAIL PROTECTED]> wrote:
> Mike Ni wrote:
> > Hey everyone, 
> > 
> > 
> > While tracing through the perl script file, I kept
> 
> > running into environment variable
> "REQUEST_METHOD".
> > 
> 
> Which is a little suspect, because you should be
> using CGI.pm or 
> something better (not just similar) to hide the
> wrangling of the 
> REQUEST_METHOD, etc.
> 
> > 
> > I looked for where it was defined, yet no luck.
> > However, it works. 
> > 
> > I think I am missing somethign here. 
> > I am guessing this variable is defined by
> > the Apache web server. Yet, I am not sure. 
> > 
> 
> Nope not missing anything, you are correct Apache
> sets a number of 
> environment variables that CGI programs can then
> wrangle however they so 
> choose. The nice thing about CGI.pm is that it does
> this for you and 
> provides a very clean Perl interface to it all.
> 
> > Anyone see the same things? 
> 
> This does depend on the server implementation..
> 
> http://danconia.org
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> 
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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




Re: REQUEST_METHOD

2004-03-16 Thread Wiggins d'Anconia
Mike Ni wrote:
Hey everyone, 

While tracing through the perl script file, I kept 
running into environment variable "REQUEST_METHOD".

Which is a little suspect, because you should be using CGI.pm or 
something better (not just similar) to hide the wrangling of the 
REQUEST_METHOD, etc.

I looked for where it was defined, yet no luck.
However, it works. 

I think I am missing somethign here. 
I am guessing this variable is defined by
the Apache web server. Yet, I am not sure. 

Nope not missing anything, you are correct Apache sets a number of 
environment variables that CGI programs can then wrangle however they so 
choose. The nice thing about CGI.pm is that it does this for you and 
provides a very clean Perl interface to it all.

Anyone see the same things? 
This does depend on the server implementation..

http://danconia.org

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



REQUEST_METHOD

2004-03-16 Thread Mike Ni
Hey everyone, 


While tracing through the perl script file, I kept 
running into environment variable "REQUEST_METHOD".


I looked for where it was defined, yet no luck.
However, it works. 

I think I am missing somethign here. 
I am guessing this variable is defined by
the Apache web server. Yet, I am not sure. 

Anyone see the same things? 
Thnaks
Mike

__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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




Re: Passing array references around

2004-03-16 Thread Robin Sheat
On Tue, Mar 16, 2004 at 08:36:39PM -0500, Wiggins d'Anconia wrote:
> Because you are passing in references you want to catch them into 
> scalars, then to update the values of the references you dereference 
> them in your push, so...
> my ($potUp, $potDn) = @_;
Had tried this...

> push @$potUp, [$layer, $src, $dst];
> push @$potDn, [$layer, $src, $dst];
...but not in conjunction with this. That makes all the difference, 
thanks!

> However I am curious if this is really doing what you want, as this adds 
> a new anonymous array reference to the original array rather than adding 
> the three values onto the end of the array, so you may need to switch 
> the square brackets to parentheses, or drop the grouping completely.
No, what I have is what I wanted. It is adding a triplet to the array, 
making a 2D array.

> Of course there is the whole notion of updating the external version of 
> the variable from within the sub in this manner, but I trust you know 
> what you are doing, and that you got $layer, $src, and $dst from 
> acceptable sources
Yes, it offends my programming sensibilities a little too, however this
function is coming from a configuration file (because I need dozens of
slightly different functions, they are auto-generated by another
program), and so it is 'safe' for it to modify the arrays directly. 
There is the potential for them to get large and I wouldn't want to
create new ones, copy existing items, etc as it risks slowing my program 
down significantly for virtually no gain. (To get a feel for the 
trickyness of this, the program requires some form of programability in 
its configuration system, so Perl just 'do's the file, loading up 
appropriate variables with values)

> HTH,
It helps good, thanks :)

-- 
Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0x776DB663 Fingerprint=DD10 5C62 1E29 A385 9866 0853 CD38 E07A 776D B663


pgp0.pgp
Description: PGP signature


Re: Passing array references around

2004-03-16 Thread Wiggins d'Anconia
Robin Sheat wrote:
Hey, I have a problem that I know is possible, because I have solved it 
before. However, the computer died and I lost my solution, and can't 
work it out again :)

What I want to do is pass a couple of array references into a function
and have it modify the contents of the reference.
What I have is (copied directly from my code, hence the odd seeming 
names etc):

main perl file:
$setupPotWeights->([EMAIL PROTECTED],[EMAIL PROTECTED]);
print "C: Pot Up: "[EMAIL PROTECTED]"   Pot Dn: "[EMAIL PROTECTED]"\n";
the sub:
sub doRandomPotentiation {
my @potUp = @{$_[0]};
my @potDn = @{$_[1]};
Because you are passing in references you want to catch them into 
scalars, then to update the values of the references you dereference 
them in your push, so...

my ($potUp, $potDn) = @_;

...(operate on these, eg:)
push @potUp, [$layer,$src,$dst];
...
push @potDn, [$layer,$src,$dst];
...
In the above statements you are manipulating the local versions of two 
entirely new arrays, rather than the referenced versions

push @$potUp, [$layer, $src, $dst];
push @$potDn, [$layer, $src, $dst];
However I am curious if this is really doing what you want, as this adds 
a new anonymous array reference to the original array rather than adding 
the three values onto the end of the array, so you may need to switch 
the square brackets to parentheses, or drop the grouping completely.

}

because I'm only dealing with references, I would expect the stuff that
is added inside the sub to end up in @potUpWeights and @potDnWeights in
the main file, however this isn't happening. A print at the bottom of
the sub tells me the data is going in, but it appears to be a different
reference than the main file is using as the print in it tells me the
arrays are size zero. Thoughts? I know I'm missing something really
basic, but damned if I can put a finger on it.
Of course there is the whole notion of updating the external version of 
the variable from within the sub in this manner, but I trust you know 
what you are doing, and that you got $layer, $src, and $dst from 
acceptable sources

HTH,

http://danconia.org

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



Re: Modifying STDIN

2004-03-16 Thread Randy W. Sims
On 3/16/2004 3:59 AM, James Taylor wrote:

I actually can't do it that way, this is a part of a custom perl module 
that someone wrote, and those are just 2 lines from the module.

On 03/16/04 00:06, James Taylor wrote:

I'm modifying a script someone wrote that basically reads a file file 
into STDIN, and I was curious if there was anyway of modifying the 
stdin value without having to first open the file, modify it, close 
the file, and then open it into stdin.
Ok, I think I see what you want:  black magic

Try this:

#!/usr/bin/perl

package MySTDIN;

use strict;
use warnings;
use Tie::Handle;
our @ISA = qw(Tie::Handle);
sub TIEHANDLE {
  my $class = shift;
  open my $fh, '-';
  bless $fh, $class;
}
sub READLINE {
  my $self = shift;
  if (wantarray) {
my @input;
while (my $input = <$self>) {
  push @input, sprintf( "%3s %s", $., $input);
}
return @input;
  } else {
my $input = <$self>;
return undef unless defined $input;
return sprintf( "%3s %s", $., $input);
  }
}
package main;

use strict;
use warnings;
tie *STDIN, 'MySTDIN';
print ;
__END__

You just need to tie STDIN before it gets used, and alter the code in 
READLINE to alter the lines. Note you have to handle both scalar and 
array contexts.

I'm not completely sure of the correctness of the above. Use at your own 
risk.

Regards,
Randy.


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



Passing array references around

2004-03-16 Thread Robin Sheat
Hey, I have a problem that I know is possible, because I have solved it 
before. However, the computer died and I lost my solution, and can't 
work it out again :)

What I want to do is pass a couple of array references into a function
and have it modify the contents of the reference.

What I have is (copied directly from my code, hence the odd seeming 
names etc):

main perl file:
$setupPotWeights->([EMAIL PROTECTED],[EMAIL PROTECTED]);
print "C: Pot Up: "[EMAIL PROTECTED]"   Pot Dn: "[EMAIL PROTECTED]"\n";

the sub:
sub doRandomPotentiation {
my @potUp = @{$_[0]};
my @potDn = @{$_[1]};
...(operate on these, eg:)
push @potUp, [$layer,$src,$dst];
...
push @potDn, [$layer,$src,$dst];
...
}

because I'm only dealing with references, I would expect the stuff that
is added inside the sub to end up in @potUpWeights and @potDnWeights in
the main file, however this isn't happening. A print at the bottom of
the sub tells me the data is going in, but it appears to be a different
reference than the main file is using as the print in it tells me the
arrays are size zero. Thoughts? I know I'm missing something really
basic, but damned if I can put a finger on it.

-- 
Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0x776DB663 Fingerprint=DD10 5C62 1E29 A385 9866 0853 CD38 E07A 776D B663


pgp0.pgp
Description: PGP signature


Re: Modifying STDIN

2004-03-16 Thread John McKown
On Mon, 15 Mar 2004, James Taylor wrote:

> I'm modifying a script someone wrote that basically reads a file file 
> into STDIN, and I was curious if there was anyway of modifying the 
> stdin value without having to first open the file, modify it, close the 
> file, and then open it into stdin.
> 
> Basically, looks like:
> 
> open(STDIN,$filename) || die "whatever\n";
> close(STDOUT);
> 
> Well, I need to to a search/replace on STDIN, something like:
> 
> open(STDIN,$filename) || die "blah\n";
> STDIN =~ s/one/two/g;
> close(STDOUT);
> 
> Line 2 isn't intended to work, it's just there to show you what i'm 
> trying to accomplish.
> 
> Thanks for your help!
> 

>From reading some of the other replies, I gather what you'd like to do is 
modify the STDIN going into another, unmodifiable, script/program. 
Correct? One possibility is:

myscript input.file | oldscript

Where "myscript" is:

#!/usr/bin/perl
while(<>) {
s/one/two/g;
print;
}

This reads "input.file" and changes all occurrances of "one" to "two" and 
prints them to STDOUT. The pipe then sends this data on to "oldscript".
Another possibility:

#!/usr/bin/perl
open(fh,"|oldscript") or die "Cannot open pipe to oldscript: $!";
while (<>) {
s/one/two/g;
print fh;
}

You'd then invoke this as:

myscript input.file

Is this what you wanted?

--
Maranatha!
John McKown


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




RE: Folder Clean-up

2004-03-16 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Norman Zhang wrote:
> Hi,
> 
> Randy W. Sims wrote:
>> Here is a routine I wrote a while back originally for scanning
>> plugins. I've pruned it down (It could probably be much simpler as
>> this routine does a breadth first scan which requires more
>> bookkeeping, but I'm too lazy to fix it...), and it appears to work
>> with directories containing spaces. Let me know if this gets you any
>> closer to a solution. 
> 
> Thanks. Your script prints out everything in the current folder
> including spaces. May I how to incorporate this into checking/deleting
> files/folders with mtime +30? BTW, is it possible to skip the first
> level of the sub_folders/ under the share_folder/.
> 
> e.g.,
> 
> /share_folder/user_a
> /share_folder/user_b
> ...
> 
> As user_x are created 30 days ago. Can I subsititute something for
> the . in scan_dir('.')?
> 
> Regards,
> Norman
If I understand you, you are asking to leave files at user_a or _b and but any 
subdirs under that then delete the files at that level and higher.  That is:
> /share_folder/user_a
/share_folder/user_a/txt1
/share_folder/user_a/txt2
/share_folder/user_a/dir1/txt1
/share_folder/user_a/dir1/txt2
/share_folder/user_a/dir2/txt3
/share_folder/user_a/dir2/txt4

In this case only those files located at dir1 or dir2 would be eligible for 
removing. 

Another point is you state files/folders. What I have seen so far only handles 
the files.  You would ave to either keep a count of number of entries under a 
directory and subtract out when you delete a file. It becomes even more convoluted 
when you could have another subdirectory under a subdirectory.

Here is the basic script already done, but I attempted to handle level of the 
delete using 'tr' and counting the number of separators in your base and then if the 
total number ws greater than 2 then the file could be deleted if > 30 days and 
separator count greater 2.  So here is one way to give it a shot. I am running under 
xp prof. Without the tests, I had 625 files to delete while with the test that the 
number of slashes had to be greater than 2, then dropped to 423.

Note: Does not address empty subdirectories!!

use strict;
use warnings;

use File::Spec;

my @dirstack;
my $MyDir ;
my $MyFilesToDel = 0;
my $MyBaseSep = 0;

while ( defined $ARGV[0] ) {
$MyDir = $ARGV[0];
$MyBaseSep = ($MyDir =~ tr!\\!! );

scan_dir($MyDir);
shift(@ARGV);
 }
printf "Files to Delete: %6d\n",
$MyFilesToDel;
#
##
### Start of Subroutines
##
#

sub scan_dir {
  my $dir = shift;
  return unless -d $dir;

  my @subdirs;
  printf "MyBaseSep: %2d\n",
  $MyBaseSep;

  opendir DIR, $dir or die "Can't open directory ($dir): $!\n";
  my $MyModTime;
  my $MyTotSlashes ;
  while (my $file = readdir DIR) {
next if $file eq File::Spec->curdir()
 or $file eq File::Spec->updir();

my $path = File::Spec->catfile($dir, $file);
if (-d $path) {
  push @subdirs, $file;
  next;
} else {
  $MyModTime = -M $path;
  $MyTotSlashes = ( $path =~ tr/\\// );
  
  $MyTotSlashes -= $MyBaseSep;
  if ( ($MyModTime > 30) && ($MyTotSlashes > 2) ) {
  printf "%5.1f: %s\n", 
$MyModTime
$path;
  
#
# Here is where a delete would go, but you had better understand what is happening 
before it is tried.
#
  if ( ! unlink($path) ) {
 printf "Unable to delete file $path\n";
   }else {
  $MyFilesToDel++;
   }
   }
}
  }
  closedir DIR;

  foreach my $subdir (@subdirs) {
push @dirstack, $subdir;
scan_dir(File::Spec->catdir($dir, $subdir));
pop  @dirstack;
  }
}

  Thanks.

Wags ;)
Int: 9-8-002-2224
Ext: 408-323-4225x2224



**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



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




Re: traps in perl

2004-03-16 Thread John W. Krahn
Jayakumar Rajagopal wrote:
> 
> $|=1;
> 
> $SIG{INT} = sub { print "tamizh vaazhga\n": };
> 
> $SIG{USR1} = sub { print " vennai\n"; };
> 
> $SIG{TSTP} = sub { print "poda maanga\n"; };
> 
> while(1)
> 
> {
> 
> print "...";
> 
> `sleep 1`;

Why are you running an external program to do something that perl
provides a function for?

perldoc -f sleep


> }
> 
> __END__;


John
-- 
use Perl;
program
fulfillment

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




Re: Folder Clean-up

2004-03-16 Thread Norman Zhang
Hi,

Randy W. Sims wrote:
Here is a routine I wrote a while back originally for scanning plugins. 
I've pruned it down (It could probably be much simpler as this routine 
does a breadth first scan which requires more bookkeeping, but I'm too 
lazy to fix it...), and it appears to work with directories containing 
spaces. Let me know if this gets you any closer to a solution.
Thanks. Your script prints out everything in the current folder 
including spaces. May I how to incorporate this into checking/deleting 
files/folders with mtime +30? BTW, is it possible to skip the first 
level of the sub_folders/ under the share_folder/.

e.g.,

/share_folder/user_a
/share_folder/user_b
...
As user_x are created 30 days ago. Can I subsititute something for the . 
in scan_dir('.')?

Regards,
Norman
#!/usr/bin/perl

use strict;
use warnings;
use File::Spec;

my @dirstack;

scan_dir('.');

sub scan_dir {
  my $dir = shift;
  return unless -d $dir;
  my @subdirs;

  opendir DIR, $dir or die "Can't open directory ($dir): $!\n";
  while (my $file = readdir DIR) {
next if $file eq File::Spec->curdir()
 or $file eq File::Spec->updir();
my $path = File::Spec->catfile($dir, $file);
if (-d $path) {
  push @subdirs, $file;
  next;
} else {
  print "$path\n";
}
  }
  closedir DIR;
  foreach my $subdir (@subdirs) {
push @dirstack, $subdir;
scan_dir(File::Spec->catdir($dir, $subdir));
pop  @dirstack;
  }
}


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



Re: Folder Clean-up

2004-03-16 Thread Norman Zhang
Hi,

Randy W. Sims wrote:
Here is a routine I wrote a while back originally for scanning plugins. 
I've pruned it down (It could probably be much simpler as this routine 
does a breadth first scan which requires more bookkeeping, but I'm too 
lazy to fix it...), and it appears to work with directories containing 
spaces. Let me know if this gets you any closer to a solution.
Thanks. Your script prints out everything in the current folder 
including spaces. May I how to incorporate this into checking/deleting 
files/folders with mtime +30?

Regards,
Norman
#!/usr/bin/perl

use strict;
use warnings;
use File::Spec;

my @dirstack;

scan_dir('.');

sub scan_dir {
  my $dir = shift;
  return unless -d $dir;
  my @subdirs;

  opendir DIR, $dir or die "Can't open directory ($dir): $!\n";
  while (my $file = readdir DIR) {
next if $file eq File::Spec->curdir()
 or $file eq File::Spec->updir();
my $path = File::Spec->catfile($dir, $file);
if (-d $path) {
  push @subdirs, $file;
  next;
} else {
  print "$path\n";
}
  }
  closedir DIR;
  foreach my $subdir (@subdirs) {
push @dirstack, $subdir;
scan_dir(File::Spec->catdir($dir, $subdir));
pop  @dirstack;
  }
}


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



RE: %ENV?

2004-03-16 Thread Mike Ni

I didn't get the chance to verify it. 
However, I think the %ENV will conver every single 
environment variables that have been defined 
by the users. 


You can write a small testing perl and 
dump out the %env.

Hope this will help. 

Mike 

--- Roberts Mr Richard L <[EMAIL PROTECTED]>
wrote:
> is there any 'refresh' (in the browser) variable set
> in the ENV hash? 
> 
> sierrasurf
> 
> -Original Message-
> From: Randy W. Sims
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 15, 2004 10:56 PM
> To: Mike Ni
> Cc: [EMAIL PROTECTED]
> Subject: Re: %ENV?
> 
> 
> On 03/15/04 22:25, Mike Ni wrote:
> > Hey Randy, 
> > 
> > Am I right to think that each hasing pair are made
> of 
> > "name of environment variable" such as "PATH" 
> > and the "value" of the env variable?
> 
> Yes, the environment variable names are the keys in
> the hash, and the 
> value of each hash element is the value of the
> respective environment 
> variable. You can change the environment by changing
> the hash, but the 
> changes can only be seen in the current process and
> any child processes.
> 
> Randy.
> 
> 
> -- 
> 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]
> 
> 
> 
> 


__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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




lexis nexis search module or script?

2004-03-16 Thread Stuart White
I need to search a web database that has several
databases within it, and has to be searched on about
50 terms.  The process goes something like this:

1: go to website
2: login
3: enter second login
4: click on link that shows databases
5: click on one database link
6: enter search term
7: if results are more than 100, click on FOCUS link
and go to original search box.  
8: add or subtract proscribed keywords
9: click Search
10: if results less than 15, click on each result link
ll: grab each individual result page
12: dump data within MSWord document
13: else collect listed results 
14: dump results into MSWord document

Manually, i wouldn't dump the results, I would just
examine them and print the applicable ones.  Here, I
dump them because I can't figure out how to manually
get the search to only give me what I want, so I
wouldn't leave that to a program. 
I certainly could do it manually, but was curious if
a) it had already been done and there was an available
tool, or b) something I could write that would be
faster than searching manually.

I checked cpan.org for Lexis or Lexis Nexis to no
avail.  Methinks that this process is similar to a
Google search with the added bonus of a login, so it
might be that the LWP module would have what I need. 
The point is, I don't know, and would be very grateful
if someone could tell me if a) this sort of module or
script exists and is freely available, and/or b)
writing a program like this is not terribly difficult
for a novice.  I can't really show you the website as
it's password protected, but hopefully that
description is enough.  
I'm sure that this would be a program that is over my
head right now, which is why I'm hoping that there is
something out there that I could adapt for my own use.
Any suggestions?  Thanks, -stu

__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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




RE: ActiveState Win32 MCPAN install problem

2004-03-16 Thread Jenda Krynicky
From: "Michael Weber" <[EMAIL PROTECTED]>
> > Good morning!
> > 
> > I am running ActiveState Perl, latest and greatest, on a Win2000
> > box.
> 
> > When I try to install modules from CPAN, I get the following error:
> > 
> > G:\>perl -MCPAN -e "install Mail::Sender"
> > CPAN: Storable loaded ok
> > Going to read \.cpan\Metadata
> >   Database was generated on Tue, 16 Mar 2004 02:50:36 GMT
> > Running install for module Mail::Sender
> > 
> > 
> >   CPAN.pm: Going to build J/JE/JENDA/Mail-Sender-0.8.10.tar.gz
> > 
> > Checking if your kit is complete...
> > Looks good
> > Writing Makefile for Mail::Sender
> > -- OK
> > Running make test
> > 'test' is not recognized as an internal or external command,
> > operable program or batch file.
> >test -- NOT OK
> > Running make install
> >   make test had returned bad status, won't install without force

Seems to me like you have something misconfigured.

What kind of make are you using? (make, nmake, dmake)
Does CPAN and Config.pm agree on the type of make?

Could you mail me the Makefile created during this process?

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




RE: ActiveState Win32 MCPAN install problem

2004-03-16 Thread Michael Weber
Same result.  Any other ideas?

Thanx!

>>> "Rajesh Dorairajan" <[EMAIL PROTECTED]> 03/16/04
12:27PM >>>
Try perl -MCPAN -e "force install Mail::Sender" 

Rajesh

> -Original Message-
> From: Michael Weber [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 16, 2004 9:28 AM
> To: [EMAIL PROTECTED] 
> Subject: ActiveState Win32 MCPAN install problem
> 
> 
> Good morning!
> 
> I am running ActiveState Perl, latest and greatest, on a Win2000 box.

> When I try to install modules from CPAN, I get the following error:
> 
> G:\>perl -MCPAN -e "install Mail::Sender"
> CPAN: Storable loaded ok
> Going to read \.cpan\Metadata
>   Database was generated on Tue, 16 Mar 2004 02:50:36 GMT
> Running install for module Mail::Sender
> 
> 
>   CPAN.pm: Going to build J/JE/JENDA/Mail-Sender-0.8.10.tar.gz
> 
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Mail::Sender
> -- OK
> Running make test
> 'test' is not recognized as an internal or external command,
> operable program or batch file.
>test -- NOT OK
> Running make install
>   make test had returned bad status, won't install without force
> 
> Without the "test" file/program/shortcut/whatever, nothing installs.
> 
> What am I missing?  I tried upgrading the CPAN bundle, but it won't
> install either for the same reason.
> 
> Thanx!
> 
> -Michael
> 
> -- 
> 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: traps in perl

2004-03-16 Thread Jayakumar Rajagopal
$|=1;

$SIG{INT} = sub { print "tamizh vaazhga\n": };

$SIG{USR1} = sub { print " vennai\n"; };

$SIG{TSTP} = sub { print "poda maanga\n"; };

while(1)

{

print "...";

`sleep 1`;

}

__END__;

 

 try running above, send intterupt like ^c or ^z or USR1.. you can understand..

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 11:57 AM
To: Jayakumar Rajagopal
Cc: [EMAIL PROTECTED]
Subject: RE: traps in perl



thanks for the quick response! 
but could you give me an example of what syntax goes in {  something  } ; 

so 


trap { ... example ... }   so SIGNAL(s) would be inside the curly braces? 


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams





"Jayakumar Rajagopal" <[EMAIL PROTECTED]> 


03/16/2004 10:38 AM 



To:<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> 
cc: 
Subject:RE: traps in perl



Try :

$SIG{SIGTERM} = sub { ..something..} ;  #-- in perl

this is equivalent to trap '... something...' SIGTERM 
thanks,
Jay

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 10:29 AM
To: [EMAIL PROTECTED]
Subject: traps in perl


All, 

Is there a method or module that allows you to create a trap?  For 
instance, in ksh or any shell I can create a system trap that will 
disallow any keystroke, other than the expected user input specifically 
cntrl C, D, \ or U.  All of these are mapped to a SIGNAL in 
/usr/include/sys/signal.h.

thanks

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145






Re: FW: Installing module.

2004-03-16 Thread Daniel T. Staal
--As of Tuesday, March 16, 2004 6:14 PM +0530, Nilay   Puri, Noida is 
alleged to have said:

1. What to make out from the error ?
2. After make test failed , I ran make install(though I should not have).
It installed the GD module. What to make out of it ?  has it been
installed, or will it give error when some one will try to use this
module.
--As for the rest, it is mine.

Well, I'm not a Guru who can tell you what the error means, but I can say 
that it probably installed the module, but any attempt to actually use the 
module is likely to fail.  The error will *not* be that the module can't be 
found; it will probably have to do with how the module itself failed...

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: ActiveState Win32 MCPAN install problem

2004-03-16 Thread Rajesh Dorairajan
Try perl -MCPAN -e "force install Mail::Sender" 

Rajesh

> -Original Message-
> From: Michael Weber [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 16, 2004 9:28 AM
> To: [EMAIL PROTECTED]
> Subject: ActiveState Win32 MCPAN install problem
> 
> 
> Good morning!
> 
> I am running ActiveState Perl, latest and greatest, on a Win2000 box. 
> When I try to install modules from CPAN, I get the following error:
> 
> G:\>perl -MCPAN -e "install Mail::Sender"
> CPAN: Storable loaded ok
> Going to read \.cpan\Metadata
>   Database was generated on Tue, 16 Mar 2004 02:50:36 GMT
> Running install for module Mail::Sender
> 
> 
>   CPAN.pm: Going to build J/JE/JENDA/Mail-Sender-0.8.10.tar.gz
> 
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Mail::Sender
> -- OK
> Running make test
> 'test' is not recognized as an internal or external command,
> operable program or batch file.
>test -- NOT OK
> Running make install
>   make test had returned bad status, won't install without force
> 
> Without the "test" file/program/shortcut/whatever, nothing installs.
> 
> What am I missing?  I tried upgrading the CPAN bundle, but it won't
> install either for the same reason.
> 
> Thanx!
> 
> -Michael
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 
> 


Re: error during installing Crypt::Idea 1.02

2004-03-16 Thread david
Nilay Puri wrote:

> 
> Make test is failing during installation of module Crypt::Idea 1.02
> 
>  make test
> gcc -c   -D_REENTRANT -fno-strict-aliasing -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"1.02\" -DXS_VERSION=\"1.02\" -fPIC
> "-I/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/CORE"   IDEA.c
> In file included from IDEA.xs:10:
> idea.h:5: error: parse error before "idea_cblock"
> idea.h:5: warning: data definition has no type or storage class

this doesn't look right. make test is not suppose to need to compile 
anything. are you sure you have followed the correct installation procedure 
for the module? generally speaking, you need:

perl Makefile.PL
make 
make test
make install

make does the actual compilation and linking, make test simply runs the 
testing script against blib/* and make install pushs the module out to the 
right place. 

david
-- 
s$s*$+/http://learn.perl.org/> 




ActiveState Win32 MCPAN install problem

2004-03-16 Thread Michael Weber
Good morning!

I am running ActiveState Perl, latest and greatest, on a Win2000 box. 
When I try to install modules from CPAN, I get the following error:

G:\>perl -MCPAN -e "install Mail::Sender"
CPAN: Storable loaded ok
Going to read \.cpan\Metadata
  Database was generated on Tue, 16 Mar 2004 02:50:36 GMT
Running install for module Mail::Sender


  CPAN.pm: Going to build J/JE/JENDA/Mail-Sender-0.8.10.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Mail::Sender
-- OK
Running make test
'test' is not recognized as an internal or external command,
operable program or batch file.
   test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

Without the "test" file/program/shortcut/whatever, nothing installs.

What am I missing?  I tried upgrading the CPAN bundle, but it won't
install either for the same reason.

Thanx!

-Michael

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




RE: traps in perl

2004-03-16 Thread DBSMITH
thanks for the quick response!
but could you give me an example of what syntax goes in {  something 
 } ;

so 


trap { ... example ... }   so SIGNAL(s) would be inside the curly braces?


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams






"Jayakumar Rajagopal" <[EMAIL PROTECTED]>
03/16/2004 10:38 AM

 
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc: 
Subject:RE: traps in perl


Try :

$SIG{SIGTERM} = sub { ..something..} ;  #-- in perl

this is equivalent to trap '... something...' SIGTERM 
thanks,
Jay

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 10:29 AM
To: [EMAIL PROTECTED]
Subject: traps in perl


All, 
 
Is there a method or module that allows you to create a trap?  For 
instance, in ksh or any shell I can create a system trap that will 
disallow any keystroke, other than the expected user input specifically 
cntrl C, D, \ or U.  All of these are mapped to a SIGNAL in 
/usr/include/sys/signal.h.
 
thanks

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145




Re: generate array of arrays from file

2004-03-16 Thread Wiggins d Anconia


> following the example in the perldsc (data structures cookbook), i
wrote this 
> piece of code to create an array of arrays from a data file :  
> 
> 
> #!/usr/bin/perl -w
> use strict ;
> 
> my @AofA ; # array of arrays of file contents
> open (fh1, " while () {
> push @AofA, (split /\t/) ;

Your split is pushing the list that it generates onto the end of the
array, rather than pushing a single element (an anonymous array
reference onto the array).  So you need,

push @AofA, [ split /\t/ ];

Square brackets declare an anonymous array reference.  In addition to
perldsc you may want to read through

perldoc perllol
perldoc perlreftut
perldoc perlref

http://danconia.org

> }
> 
> close (fh1) ;
> 
> print $AofA[0] ; 
> print "\n" ;
> # this gives me "cho" when what i wanted was "cho   249   837"
> # later, i was hoping to use $AofA[0][0] to access "cho"
> 
> an example of the file follows (fields are separated by tabs in "real
life")
> cho 249837
> abc 123456
> abc 984235
> nurb246973
> 
> 
> it appears the problem is where i am doing the "push" while reading
the file.
> 
> suggestions?
> 


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




Re: generate array of arrays from file

2004-03-16 Thread James Edward Gray II
On Mar 16, 2004, at 10:13 AM, Joseph Paish wrote:

following the example in the perldsc (data structures cookbook), i 
wrote this
piece of code to create an array of arrays from a data file :

#!/usr/bin/perl -w
use strict ;
my @AofA ; # array of arrays of file contents
open (fh1, ") {
push @AofA, (split /\t/) ;
That line should read:

push @AofA, [ split m/\t/ ];  # brackets, not parens

The brackets create an array reference to be pushed onto the original 
array.

}

close (fh1) ;

print $AofA[0] ;
print "\n" ;
Two arrays means two dimensions or two indexes:

print "$AofA[0][0]\n";  # the first column of the first row

# or for all elements

foreach (@AofA) {
print "@$_\n";
}
Hope that helps.

James

# this gives me "cho" when what i wanted was "cho   249   837"
# later, i was hoping to use $AofA[0][0] to access "cho"
an example of the file follows (fields are separated by tabs in "real 
life")
cho 249837
abc 123456
abc 984235
nurb246973

it appears the problem is where i am doing the "push" while reading 
the file.

suggestions?

thanks

joe

--
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]
 



generate array of arrays from file

2004-03-16 Thread Joseph Paish
following the example in the perldsc (data structures cookbook), i wrote this 
piece of code to create an array of arrays from a data file :  


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

my @AofA ; # array of arrays of file contents
open (fh1, ") {
push @AofA, (split /\t/) ;
}

close (fh1) ;

print $AofA[0] ; 
print "\n" ;
# this gives me "cho" when what i wanted was "cho   249   837"
# later, i was hoping to use $AofA[0][0] to access "cho"

an example of the file follows (fields are separated by tabs in "real life")
cho 249837
abc 123456
abc 984235
nurb246973


it appears the problem is where i am doing the "push" while reading the file.

suggestions?

thanks

joe


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




RE: traps in perl

2004-03-16 Thread Jayakumar Rajagopal
Try :

$SIG{SIGTERM} = sub { ..something..} ;  #-- in perl

this is equivalent to trap '... something...' SIGTERM 
thanks,
Jay

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 16, 2004 10:29 AM
To: [EMAIL PROTECTED]
Subject: traps in perl


All, 
 
Is there a method or module that allows you to create a trap?  For 
instance, in ksh or any shell I can create a system trap that will 
disallow any keystroke, other than the expected user input specifically 
cntrl C, D, \ or U.  All of these are mapped to a SIGNAL in 
/usr/include/sys/signal.h.
 
thanks

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145

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




traps in perl

2004-03-16 Thread DBSMITH
All, 
 
Is there a method or module that allows you to create a trap?  For 
instance, in ksh or any shell I can create a system trap that will 
disallow any keystroke, other than the expected user input specifically 
cntrl C, D, \ or U.  All of these are mapped to a SIGNAL in 
/usr/include/sys/signal.h.
 
thanks

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


Re: Perl -d

2004-03-16 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Mike Ni) writes:
>While I was playing with perl's built-in debuger 
>(perl -d),  I notice that  debugger doesn't seem
>care too much about whether a variable is declared?
>
>For example, I would get response of "empty hash" if 
>I do a "x \%dummy" regardless dummy hasn't been
>delcared yet. 
>
>The same response "empty hash" if I dump a declred
>hash before it is initialize. 
>
>It is as if there isn't too much difference between an
>undeclared variable & unitialized variable? 
>
>Is this the way it is ? Or I am not doing right? 

That is the way it is.  The debugger evaluates your
commands in a lexical scope within which "use strict"
has not been declared.  You can't make it be strict
without editing the debugger (perl5db.pl).  This is
just as well, the debugger is a sandbox.

The same goes for use warnings, but if you use the -w
or -W flags instead, they are non-lexical and will
extend to the debugger.  Try the p command on an
undefined value some time with -w enabled and you'll
see a quite verbose and annoying message.  One reason
to use warnings instead of -w is to avoid that spew
when debugging.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/

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




Re: %ENV?

2004-03-16 Thread Wiggins d Anconia
Please bottom post and group reply so everyone can help and be helped...

> 
> I see what you mean.
> However, where do they get the "key" for the hasing?
> 

Generally you will know the key you want because it will be part of the
spec of the design, aka it should be documented.  For instance Apache
always uses very specific environment variables for the query string and
referrer in a web request, they have simply become conventions. 

In your case if you are asking how to get all of them, then the 'keys'
function will help you with that...

perldoc -f keys

http://danconia.org

> 
> 
> --- Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
> > > Hey friends,
> > > 
> > > Could anyone tell me where to
> > > find the man page for the "%ENV"? 
> > > 
> > > I didn't have too muck luck on www.perl.org
> > > nor with  CPAN site. Perhaps I got the wrong ideal
> > 
> > > about perl's man page.  Yet, I just can't seem
> > > to find the man page about "%ENV". 
> > > 
> > > I need to finut what are included by the %ENV.
> > > 
> > 
> > Don't know of a specific page for ENV. 
> > 
> > perldoc perlvar
> > 
> > Will describe it very very basically. ENV is just a
> > normal hash where
> > the inherited environment is stored, so its contents
> > are very very
> > system and runtime dependent.  If you want to see
> > what a process has in
> > the environment, you can use a simple loop or the
> > data dumper to see:
> > 
> > use Data::Dumper;
> > print Dumper(\%ENV);
> > 
> > HTH,
> > 
> > http://danconia.org
> > 


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




RE: %ENV?

2004-03-16 Thread Roberts Mr Richard L
is there any 'refresh' (in the browser) variable set in the ENV hash? 

sierrasurf

-Original Message-
From: Randy W. Sims [mailto:[EMAIL PROTECTED]
Sent: Monday, March 15, 2004 10:56 PM
To: Mike Ni
Cc: [EMAIL PROTECTED]
Subject: Re: %ENV?


On 03/15/04 22:25, Mike Ni wrote:
> Hey Randy, 
> 
> Am I right to think that each hasing pair are made of 
> "name of environment variable" such as "PATH" 
> and the "value" of the env variable?

Yes, the environment variable names are the keys in the hash, and the 
value of each hash element is the value of the respective environment 
variable. You can change the environment by changing the hash, but the 
changes can only be seen in the current process and any child processes.

Randy.


-- 
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]
 




error during installing Crypt::Idea 1.02

2004-03-16 Thread Nilay Puri, Noida

Hi all,

Make test is failing during installation of module Crypt::Idea 1.02


 make test
gcc -c   -D_REENTRANT -fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"1.02\" -DXS_VERSION=\"1.02\" -fPIC
"-I/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/CORE"   IDEA.c
In file included from IDEA.xs:10:
idea.h:5: error: parse error before "idea_cblock"
idea.h:5: warning: data definition has no type or storage class
idea.h:6: error: parse error before "idea_user_key"
idea.h:6: warning: data definition has no type or storage class
idea.h:7: error: parse error before "idea_ks"
idea.h:7: warning: data definition has no type or storage class
idea.h:9: error: parse error before "in"
idea.h:10: error: parse error before "key"
idea.h:11: error: parse error before "userKey"
IDEA.xs: In function `XS_Crypt__IDEA_expand_key':
IDEA.xs:24: error: parse error before "ks"
IDEA.xs:30: error: `u_int16_t' undeclared (first use in this function)
IDEA.xs:30: error: (Each undeclared identifier is reported only once
IDEA.xs:30: error: for each function it appears in.)
IDEA.xs:30: error: parse error before ')' token
IDEA.xs:32: error: `ks' undeclared (first use in this function)
IDEA.xs: In function `XS_Crypt__IDEA_invert_key':
IDEA.xs:41: error: `u_int16_t' undeclared (first use in this function)
IDEA.xs:41: error: parse error before "iks"
IDEA.xs:47: error: parse error before ')' token
IDEA.xs:49: error: `iks' undeclared (first use in this function)
IDEA.xs: In function `XS_Crypt__IDEA_crypt':
IDEA.xs:77: error: `u_int16_t' undeclared (first use in this function)
IDEA.xs:77: error: parse error before ')' token
make: *** [IDEA.o] Error 1


Can any one help.


Thanks.

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




FW: Installing module.

2004-03-16 Thread Nilay Puri, Noida

I am installing on sun os.
perl versions is 5.8


While installing GD 1.19 module.
I got error on running "make test" : 


make[1]: Leaving directory `/nilay/tars/GD-1.19/libgd'
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harne
ss(0, 'blib/lib', 'blib/arch')" t/*.t
t/GDbrush is not of type GD::Image at t/GD.t line 64.
t/GDdubious
Test returned status 0 (wstat 139, 0x8b)
FAILED--1 test script could be run, alas--no output ever seen
make: *** [test_dynamic] Error 2




1. What to make out from the error ?
2. After make test failed , I ran make install(though I should not have). It
installed the GD module. What to make out of it ?  has it been installed, or
will it give error when some one will try to use this module.

Thanks,
Nilay

-- 
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]
 




FW: error in installing Inline::CPP

2004-03-16 Thread Nilay Puri, Noida


>  
> 
> While installing Inlin:CPP 0.24 on sunOS solaris m/c
> 
> I get this error during make test
> 
> bash-2.03# make test
> make[1]: Entering directory `/nilay/tars/Inline-CPP-0.24/grammar'
> make[1]: Leaving directory `/nilay/tars/Inline-CPP-0.24/grammar'
> PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
> "test_harne
> ss(0, 'blib/lib', 'blib/arch')" t/*.t
> t/01basic.Can't use an undefined value as an ARRAY reference at (eval
> 69) li
> ne 7973.
> BEGIN failed--compilation aborted at t/01basic.t line 64.
> t/01basic.dubious
> Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED tests 1-10
> Failed 10/10 tests, 0.00% okay
> t/02prefixCan't use an undefined value as an ARRAY reference at (eval
> 69) li
> ne 7973.
> INIT failed--call queue aborted.
> t/02prefixdubious
> Test returned status 255 (wstat 65280, 0xff00)
> DIED. FAILED tests 1-4
> Failed 4/4 tests, 0.00% okay
> Failed Test  Stat Wstat Total Fail  Failed  List of Failed
> --
> -
> t/01basic.t   255 6528010   10 100.00%  1-10
> t/02prefix.t  255 65280 44 100.00%  1-4
> Failed 2/2 test scripts, 0.00% okay. 14/14 subtests failed, 0.00% okay.
> make: *** [test_dynamic] Error 2
> 
> Can anyone help in uderstanding the cause ?
> 
> Inline 0.44 is already installed.
> And I have specified  g++ compiler.
> 
> Thanks in advance.

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




Re: Modifying STDIN

2004-03-16 Thread John W. Krahn
James Taylor wrote:
> 
> I'm modifying a script someone wrote that basically reads a file file
> into STDIN, and I was curious if there was anyway of modifying the
> stdin value without having to first open the file, modify it, close the
> file, and then open it into stdin.
> 
> Basically, looks like:
> 
> open(STDIN,$filename) || die "whatever\n";
> close(STDOUT);
> 
> Well, I need to to a search/replace on STDIN, something like:
> 
> open(STDIN,$filename) || die "blah\n";
> STDIN =~ s/one/two/g;
> close(STDOUT);
> 
> Line 2 isn't intended to work, it's just there to show you what i'm
> trying to accomplish.

STDIN, STDOUT and STDERR are just file handles like any other file
handles.  The only difference is that the system opens them and connects
them to a tty when the process starts.  They don't have any "special"
powers to edit a file in-place like you seem to think they do.  The
usual Perl idiom to do in-place editing is to use the -i command line
switch or the $^I variable in a program.

perl -i -pe's/one/two/g' filename

Or:

#!/usr/bin/perl

{   local ( $^I, @ARGV ) = ( '', 'filename' );
s/one/two/g while <>;
}

__END__


John
-- 
use Perl;
program
fulfillment

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




Re: chown-ing symlink

2004-03-16 Thread Ohad Ohad
'He' wants to do it because it needs to be done.
When a user of the system owns a link he enjoys seeing he's username next to 
it when ls-ing, else he complains (a lot !!!) then 'His' boss complains and 
'he' needs to explain that Perl can't do it, then the boss gets mad cause' 
he not know what "Perl" even means, then 'he' goes home  . .

Ein avada, ein safa, kashe kashe :)


From: Kenton Brede <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: chown-ing symlink
Date: Mon, 15 Mar 2004 15:14:04 -0600
On Mon, Mar 15, 2004 at 12:57:08PM -0800, John W. Krahn ([EMAIL PROTECTED]) 
wrote:
> Wiggins D'Anconia wrote:
> >
> > What is the OP really doing?  Why the need to change the ownership of 
a
> > link, and why wasn't it created with the "correct" ownership to begin 
with?
>
> The ownership on a symlink should be irrelevant because the permissions
> are set to rwxrwxrwx by default.  Just to speculate, the OP may be doing
> something based on the ownership of the file and using lstat() instead
> of stat() which returns the owner of the symlink instead.

He referenced the "-h" option for "chown" which would allow this.  From
the chown manpage on my Debian system -
-h, --no-dereference affect symbolic links instead of any referenced
file (available only on sys­tems that can change the ownership of a 
symlink)

Why exactly he would want to do this I'm not sure either.  It would be nice
if he would enlighten us, hint... hint OP.  I'm curious :)
Kent
--
"Efficiency is intelligent laziness."
  -David Dunham
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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



Installing module.

2004-03-16 Thread Nilay Puri, Noida
While installing GD 1.19 module.
I got error on running "make test" : 


make[1]: Leaving directory `/nilay/tars/GD-1.19/libgd'
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harne
ss(0, 'blib/lib', 'blib/arch')" t/*.t
t/GDbrush is not of type GD::Image at t/GD.t line 64.
t/GDdubious
Test returned status 0 (wstat 139, 0x8b)
FAILED--1 test script could be run, alas--no output ever seen
make: *** [test_dynamic] Error 2




1. What to make out from the error ?
2. After make test failed , I ran make install(though I should not have). It
installed the GD module. What to make out of it ?  has it been installed, or
will it give error when some one will try to use this module.

Thanks,
Nilay

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




Re: DBI, DBD question

2004-03-16 Thread Mark Martin
Pretty new to PPM myself but I have gotten DBD and DBI working fine on
ActiveState for windows through it. PPM does take a bit of tricking around
and I've found you are much better off creating local repositories. Here's
'tips n tricks' sheet that may help.

- Original Message - 
From: "Randy W. Sims" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, March 16, 2004 4:11 AM
Subject: Re: DBI, DBD question


> Please post to the list when possible so others can contribute/benefit.
> Thanks. Comments inline below:
>
> On 03/15/04 22:56, [EMAIL PROTECTED] wrote:
> > I tried running the install commands in PPM and got this:
> >
> > 'Retrieving package 'DBD'...
> > Error installing package 'DBD' : Could not locate a PPD file for package
DBD'
>
> There is no package for DBD (I think).
>
> > I get the same thing when I try running the 'install DBD-ODBC'.
>
> Hmm, that should work. What do you get when you 'search DBD-ODBC'?
> What about 'install DBI'?
>
> >  The version of PERL I have is 2.1.
>
> That can't be right. What is the output of 'perl -v'?
>
> If I didn't mention it before, you can find the latest ActiveState Perl
> release at .
>
> > I'm not sure how I can get them installed. If you have
> > any suggestions I sure could use them.  I hope I'm not taking up too
much of
> > your time, I appreciate the help.
>
> Not sure how much I can help as I don't really use ppm myself (I have
> compilers and build my modules manually). You might want find someone
> better suited to helping on the ppm mailing-list
>  (There are some other good
> lists on that page too), but I'll try to help here if I can.
>
> > P.S - If this helps at all this is the first error message I got when I
tried
> > running the program the first time:
> >
> > 'Can't locate DBI.pm in @INC <@INC contains: C:/Perl/lib
C:/Perl/site/lib .>
> > at addCustomersWeb.pl line 12.
> > BEGIN failed--compilation aborted at addCustomersWeb.pl line 12.'
>
> That does confirm that DBI is not installed.
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
The Programmer's Package Manager (PPM) handles the installation of modules. However by 
default it attempts to do so from ActiveState's on line repository. This can be 
tricky, especially when going through a proxy server (in fact it won't work). The best 
approach is to download the module in zip format and create a local repository. Follow 
the steps below :

Download your zipped module for 5.6.1 from here and save to a local directory e.g. 
c:\temp. Uncompress using winzip.

Start PPM from the command prompt c:\> ppm3

To see the default repositories type repository. you will likely get the following :

Repositories:
[1] ActiveState PPM2 Repository
[2] ActiveState Package Repository

Establish a local repository in the directory you saved the zip file to :

repository add temp C:\temp

repository should now give you :

Repositories:
[1] ActiveState PPM2 Repository
[2] ActiveState Package Repository
[3] temp

Make that repository the primary by :

repository up 3
repository up 2

repository should now give you :

Repositories:
[1] temp
[2] ActiveState PPM2 Repository
[3] ActiveState Package Repository

search  will list the module downloaded to the local directory

install  will install it

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


Re: Folder Clean-up

2004-03-16 Thread Norman Zhang
Randy W. Sims wrote:
On 03/15/04 14:24, Norman Zhang wrote:
I've /share_folder with many user folders.

e.g.,

/share_folder/user_a
/share_folder/user_b
...
I would like to scan all user folders for files that are older than 
30 days and delete them. Is this doable with Perl?
What do you mean by "older than 30 days"?
I mean files that were created 30 days ago. I disabled atime on my 
share_folder/ partition for faster access.

/dev/scsi/host0/bus1/target2/lun0/part1 /usrswap xfs 
rw,noatime,usrquota,grpquota 0 0

Thus, is it safe to assume the following script won't work?
You can only base it on properties stored by the filesystem. Maybe 
-mtime (last modified time) is close enough?

Is there a specific reason you're using perl for this task? You can 
accomplish the same with:

find /share_folder -mtime +30 | xargs rm

but you should probably verify the correctness of the command first with

find /share_folder -mtime +30 | xargs ls
Thank you so much. Your simple script does pretty much what I needed. 
However, find doesn't seem to be able to traverse sub folders with 
spaces in between.

[EMAIL PROTECTED] transfer]# find nzhang/ -mtime +30 | xargs ls
ls: nzhang/arkon: No such file or directory
[EMAIL PROTECTED] transfer]# ls -l nzhang
total 8916
drwxrwxrwx2 nzhang   Domain Users 4096 Feb 11 13:27 arkon icon/
Is there a way that I can go around this? Perhaps I need Perl for the 
more advance searching?

Best Regards,
Norman


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



Re: Modifying STDIN

2004-03-16 Thread James Taylor
I actually can't do it that way, this is a part of a custom perl module 
that someone wrote, and those are just 2 lines from the module.

On Mar 15, 2004, at 11:01 PM, Randy W. Sims wrote:

On 03/16/04 00:06, James Taylor wrote:
I'm modifying a script someone wrote that basically reads a file file 
into STDIN, and I was curious if there was anyway of modifying the 
stdin value without having to first open the file, modify it, close 
the file, and then open it into stdin.
I think what you want is a traditional filter:

=== myfilter.pl ===
#!/usr/bin/perl
use strict;
use warnings;
while (my $line = <>) {
  chomp($line);
  $line =~ s/^/sprintf("%3s ", $.)/e;
  print "$line\n";
}
__END__

piping it to its own STDIN produces

cat myfilter.pl | perl myfilter.pl

  1 #!/usr/bin/perl
  2
  3 use strict;
  4 use warnings;
  5
  6 while (my $line = <>) {
  7   chomp($line);
  8   $line =~ s/^/sprintf("%3s ", $.)/e;
  9   print "$line\n";
 10 }
See perldoc perlopentut, section "Filters"

Regards,
Randy.


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