Re: Punishing Your Server With Perl

2003-03-13 Thread eric-perl
On Thu, 13 Mar 2003 [EMAIL PROTECTED] wrote: > A couple of years ago there was a great article by the title of "Punishing > Your Server With Perl". (I believe that either Randal Schwartz or Ruben > Lerner wrote the article.) Anyhow, I can't find it. I've checked Google > but found nothing. > >

Punishing Your Server With Perl

2003-03-13 Thread eric-perl
Hello, All: A couple of years ago there was a great article by the title of "Punishing Your Server With Perl". (I believe that either Randal Schwartz or Ruben Lerner wrote the article.) Anyhow, I can't find it. I've checked Google but found nothing. Where oh where did it go? -- Eric P. Sunny

Re: Using CPAN.pm to Install Modules

2002-10-24 Thread eric-perl
On Thu, 24 Oct 2002, Jenda Krynicky wrote: > Maybe you should try a different mirror. Is there a command to update my urllist *interactively* (just like during the initial configuration)? If not: Where can I find a list of mirrors? -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL P

Re: Using CPAN.pm to Install Modules

2002-10-23 Thread eric-perl
On Wed, 23 Oct 2002, Jenda Krynicky wrote: > > I'm confounded by CPAN.pm's documentation. I've already configured the > > module but can't figure out how to 'install' a module. e.g., > > MIME::Lite. > > Try > cpan> install MIME::Lite That was the first thing that I tried. CPAN complained tha

Using CPAN.pm to Install Modules

2002-10-23 Thread eric-perl
Hello, All: I'm confounded by CPAN.pm's documentation. I've already configured the module but can't figure out how to 'install' a module. e.g., MIME::Lite. Starting with... %> perl -MCPAN -e shell cpan> i MIME/Lite tells me that there's a distribution called MIME/Lite BUT... cpan> install

Re: Condition Evaluation

2002-10-14 Thread eric-perl
On Tue, 1 Oct 2002, Michael Fowler wrote: > While this works, typically the way I do it is something along the lines of: > > usage("Specify a directory to scan ...\n") unless defined $directory; > usage("Provide a comment for the ...\n") unless defined $comment; > > and so on, where us

PerlMagick: Errors and Set(compression, comment) (fwd)

2002-10-10 Thread eric-perl
Hello, All: I've been playin' around with IM for a few weeks now and am a bit confused. I've installed ImageMagick and PerlMagick from RPM (ImageMagick-5.2.7-2) on my RedHat Linux 7.1 machine and I'm attempting to read, modify, and save JPEG files but am having trouble with this series of command

WHO IS NAVER-MAILER@naver.com ???

2002-10-03 Thread eric-perl
Hello, All: Every time I send a message to this list, I receive a message from [EMAIL PROTECTED] immediately afterwards. It appears to be garbage (lots of screwy characters...). Where is this coming from? Am I the only one receiving these? -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mai

Using map

2002-10-03 Thread eric-perl
Hello, All: I'm having a difficult time understanding the map function. I've got an array of file names that all end in 'jpg' or 'gif'. I'd like to create a parallel array of file names that end in 'html'. I'm creating the array this way... @new_names = map { ($x = $_) =~ s/(jpg|gif)$/html/i;

Re: Comparison: finding if a value is gt some value AND lt another

2002-09-30 Thread eric-perl
On Fri, 27 Sep 2002, Jeff 'japhy' Pinyan wrote: > On Sep 27, [EMAIL PROTECTED] said: > >Is there a simple way to find if a variable's value is within a range? > > if (1 < $x < 5) { print 'foo'; } > >...or do I have to join two separate comparisons using the logical AND > >operator? e.g., > > if

Re: Condition Evaluation

2002-09-30 Thread eric-perl
I found my mistake: I misread the line number in the error message. DOH!!! The complaints were related to the block that prints individualized error messages: unless (defined $directory && defined $comment && defined $max_rows && defined $max_cols && defined $lg_dim && $lg_dim =~ m/[1-9][0-9]?/

Re: Condition Evaluation

2002-09-30 Thread eric-perl
On Mon, 30 Sep 2002, Michael Fowler wrote: > I cannot duplicate your problem. Given the code: > > perl -wle 'print "hi" if defined $bar && (!defined $foo || abs($foo) >< 100)' > > I see no 'Use of uninitialized value' warnings, and no print. Are you > certain the code you posted is

Condition Evaluation

2002-09-30 Thread eric-perl
Hello, All: I'm testing to determine that a list of variables has been set and am baffled by how this conditional is evaluating: CODE SNIPPET: GetOptions( 'comment=s' => \$comment, # Req'd arg 'directory=s' => \$directory, # Req'd arg 'rows=i'

foreach() and while()

2002-09-27 Thread eric-perl
Hello, All: When using foreach or while() on an array, how can I access the index of the list that foreach()/while() is working upon? Is there an internal variable that stores this info like PHP's current()? -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

Comparison: finding if a value is gt some value AND lt another

2002-09-27 Thread eric-perl
Hello, All: Is there a simple way to find if a variable's value is within a range? e.g., if (1 < $x < 5) { print 'foo'; } or do I have to join two separate comparisons using the logical AND operator? e.g., if (1 < $x and $x < 5) { print 'foo'; } -- Eric P. Sunnyvale, CA -- To un

Looping through readdir()

2002-09-25 Thread eric-perl
Hello, All: When using... while ($x = readdir(DH)) { # What came before $x? # What will come after $x? } How can I look at the next item in the directory? -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

Re: Removing a directory

2002-09-24 Thread eric-perl
On Tue, 24 Sep 2002, Michael Fowler wrote: > On Tue, Sep 24, 2002 at 10:38:59AM +0800, [EMAIL PROTECTED] wrote: > > What's the simplest method to remove a directory *and* it's contents? > > (rmdir only works on empty directories.) > > I'm somewhat surprised by the advice given so far (rm -rf an

Removing a directory

2002-09-24 Thread eric-perl
Hello, All: What's the simplest method to remove a directory *and* it's contents? (rmdir only works on empty directories.) -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: converting a list into array

2002-09-11 Thread eric-perl
On Wed, 4 Sep 2002, Bob Showalter wrote: >chomp(@list = ); >print join(',', map "'$_'", @list), "\n"; >__DATA__ >AAPL >AMCO >IBM >ORCL What is the __DATA__? Please explain. -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Regular Expressions: Grouping and backreferences...

2002-09-10 Thread eric-perl
Hello, All: How can I capture all the words that contain 'at' in the string 'A fat cat sat on my hat.'? Any pointers? $sentence = 'A fat cat sat on my hat.' $sentence =~ m/(\wat)/; returns: $1 = 'fat' -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

Regex: Matching URL's

2002-09-10 Thread eric-perl
Hello, All: I'm curious about the behavior of backreferences in a regular expression that I've created: $url = m|^(http://)?((\.?[a-z0-9][a-z0-9\-]+)+(\.[a-z0-9]){2,3})/| What's unusual about this regex is that the backreferences for any sub-domains (i.e., www, ftp, &c.) are not caputured. e.g

Re: shell command

2002-09-03 Thread eric-perl
On Tue, 3 Sep 2002, David T-G wrote: > % all im trying to do is run the shell command: > % > % convert -quality 40 image.jpg resampled_image.jpg > > Better yet, you should grab the PerlMagick module and just run the > commands from within your perl script and forget the system call (or > backti

Checking for .jpg/.gif/.png files

2002-08-27 Thread eric-perl
Hello, All: I need to check files to make sure that they are .gif, .jpg, or .png graphic files before processing them. How can I verify that? e.g., In unix, the 'type' command returns the file's type. -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Displaying Problems

2002-06-26 Thread eric-perl
On Tue, 25 Jun 2002 [EMAIL PROTECTED] wrote: > Well, I still can't get my page to display. kb: Much earlier in this thread, I think, the fundamental point got lost: CGI.pm is an added layer of abstraction that creates an additional opportunity for users to wreak havoc. When scipting Web ap

Re: HTML::Template

2002-06-26 Thread eric-perl
On Sun, 23 Jun 2002, Shawn Bower wrote: > <--> > my $template = HTML::Template->new(filename=>'weather.html'); > $template->param('CurrTime', $currTime); > $template->param('CurrTemp', $currTemp); > $template->param('HiTemp', $hiTemp); > $template->param('LoTemp', $loTe

CPAN: install Bundle::CPAN

2002-06-25 Thread eric-perl
Hello, All: This is my first time using the CPAN module. While using CPAN to download/install a module, CPAN reported that I should run 'install Bundle::CPAN' to get the latest stuff. When I entered 'install Bundle::CPAN' it went about it's business getting and make'ing and started asking abou

RE: Initializing CPAN

2002-06-25 Thread eric-perl
On Tue, 25 Jun 2002, Fontenot, Paul wrote: > Let it have 20 and 21 for ftp I poked a hole in the firewall to accept all related/established packets coming *from* ports 20 & 21 but that didn't work. I seem to recall that ftp actually uses two different ports for the same dialogue. Can anyone refr

Initializing CPAN

2002-06-25 Thread eric-perl
Hello, All: Does CPAN use http? I'm using it on a machine that has all ports except smtp/ssh/http/https blocked. (i.e., ports 22/25/80/443 are the only open ports) I've just started using the CPAN module for the first time and am having some trouble during initialization: The process dies after

Re: DB_file help.

2002-05-31 Thread eric-perl
On 31 May 2002, Postman Pat wrote: > I am trying to create a small database... > > How would I go about storing and retrieving this information? Any examples > please?? Pat: If you haven't already: Read "Programming the Perl DBI". It's actually a quick read and does a great job of introducing

SQL: Insert column?

2002-05-20 Thread eric-perl
Hello, All: I'm using DBI.pm to interact with flat-file database and want to add a new column to the database. Is there an SQL statement for such a task or do I need to transfer the contents of the file to another file and insert the column during the transfer? -- Eric P. Los Gatos, CA --

Re: Looping through variables

2002-05-18 Thread eric-perl
FWIW: This is the solution that I finally settled upon (in full context): $column_names = "COMPANY_NAME,JOB_TITLE,JOB_ID,URL,MAIL_TO,ATTACH,DATE"; foreach (qw(company_name job_title job_id url mail_to attach)), time) { # Append the quote'd parameter-value || the time-value in the list $new_va

Re: Looping through variables

2002-05-18 Thread eric-perl
On Sat, 18 May 2002, Michael Fowler wrote: > Given your code above, that isn't the problem. Where they're declared has > no effect on the definedness; it does, however, cause compile-time errors > when use strict is in effect. That is not the problem you were > encountering, though. The variabl

RE: Looping through variables

2002-05-17 Thread eric-perl
On Fri, 17 May 2002, Mark Anderson wrote: > It works for me (using perl 5.6.1), what seems to be the problem? > Why do you want to do this instead of just having three print statements? > Are you sure that you have data in the thre variables? FWIW: Looking back at my original script, I had decl

Looping through variables

2002-05-17 Thread eric-perl
Hello, All: I'm trying to loop through a list of variables and print their values. e.g., print $name, $age, $phone. What's the best way to do this? I've tried foreach (qw(name age phone)) { print ${$_}; } but that doesn't seem to work. -- Eric P. Los Gato

Re: [ Something Funnie to Read ;) ]

2002-05-16 Thread eric-perl
On Thu, 16 May 2002, Bob wrote: > What could a url do, it isn't a document, just a link. Two words: Code Red. -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Script execution via email

2002-05-16 Thread eric-perl
On Thu, 16 May 2002, Dan Fish wrote: > What I'd *like* to do is be able to generate these reports "on-demand" from > remote locations by setting up some sort of email trigger that will run the > script when an email is sent to specially designated address and then return > the results via email D

Looping through elements of an anonymous array

2002-05-10 Thread eric-perl
Hello, All: I have an unusual question: If I have an anonymous array stored in a hash, is there a more graceful way of iterating through each item in the anonymous array than using a counter? i.e., @all_records{q} = [1, 2, 3] $j = 0; while ($all_records{q}->[$j]) { print $all_records{$

Global Variables: 'my' vs 'use vars'

2002-03-28 Thread eric-perl
Hello, All: I've never been very good at scoping so it it's no surprise that this confuses me: When declaring variables at the beginning of a script, what is the difference between 'my' and 'use vars'? -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

RE: Testing for filehandles

2002-03-28 Thread eric-perl
On Thu, 28 Mar 2002, Bob Showalter wrote: > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Thanks, Bob! After reading the IO::Handle man page, I decided > > to distill this approach a bit further: > > > > print F if fileno(F); > > Of course, that's even simpler! Just to be nitpicky,

Quieting 'Name "main::foo" only used once..."

2002-03-27 Thread eric-perl
Hello, All: Is there a simple way to stop perl from complaining that a variable is only used once (possible typo at...)? e.g., #! /usr/bin/perl -w use Getopts::Std; getopts('d'); print "foo" if ($opt_d); If I use 'my()' perl complains that the variable is used in a void context. Sin

RE: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Bob Showalter wrote: > You can pass a filehandle glob to IO::Handle::opened(): Thanks, Bob! After reading the IO::Handle man page, I decided to distill this approach a bit further: print F if fileno(F); -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTE

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Agustin Rivera wrote: > Ok, I've tried it both ways and it returns 1 (true) as the value. What am I > doing wrong? Agustin: 1. What *exactly* do you mean "both" ways? 2. References... >From the Getopt::Std man page: getopt('oDI'); # -o, -D & -I take arg. Sets o

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On 27 Mar 2002, Chas Owens wrote: > Getopt::Std creates the $opt_n variables. To use it with use strict; in > place you must use the use vars ($opt_n); pragma as well. or just use > the getopts('n', \%opts); call. Then you can say $opts{n}. Agustin: Also from the Getopt::Std man page:

Re: Testing for filehandles

2002-03-27 Thread eric-perl
On Wed, 27 Mar 2002, Agustin Rivera wrote: > How would that work with use strict;? I tried it once and when I declared my > $opt_n before using getopts, it wouldn't work. Agustin: >From the Getopt::Std man page: Note that, if your code is running under the recommended `use strict

RE: Testing for filehandles

2002-03-27 Thread eric-perl
Tim: I know, I know: I excluded the "or die" portion for readability/simplicity. On Wed, 27 Mar 2002, Timothy Johnson wrote: > You'd probably have better luck testing for the open() command's success I wrote: >> use Getopts::Std; >> getopts("n"); >> open(OPT_LOG,">/tmp/foo.txt") if ($opt_n); >

Testing for filehandles

2002-03-27 Thread eric-perl
Hello, All: I've looked around for an answer to this (The Camel Book, The Ram Book, perldoc, google.com, etc.) but can't find a thing: Is it possible to test for the existence of a filehandle? I've got a small script that opens a filehandle. If that filehandle exists, I'd like to print to it