Re: unsatisfied configure_requires in perl 5.12.3?

2014-04-22 Thread Daniel Staal
--As of April 22, 2014 9:23:28 AM -0400, David Golden is alleged to have 
said:



On Tue, Apr 22, 2014 at 8:03 AM, David Cantrell 
wrote:

toolchain, including CPAN clients.  Testing whether something can pass
tests on a bog-standard ancient Perl is not really useful data for
maintainers because for a long, long time, the answer to "I can't
install" is "upgrade your toolchain".


It is, however, useful for people wanting to use modules.


Not really.  They can't easily differentiate between problems that
could be fixed if they upgraded their toolchain and problems inherent
to the module itself.  Showing that "PASS" is possible (if only they
upgraded their toolchain) would seem to be much more useful as it
indicates that using a module is achievable.


--As for the rest, it is mine.

I saw my point as completely orthogonal to the reports, actually.

CPAN collects reports from Perl users to see if modules pass their tests - 
whether those users are running the smoke toolchain is unknown.  Most 
probably are, but you can send in a report anytime you are using CPAN, if 
you wish.  I actually expect most smokers to be running a fairly recent 
perl, just because it's the type of place where it's usually good to run 
updates.  The ancient versions of perl are probably running on secured 
isolated boxes where upgrading is procedurally impossible.  Either way, the 
point of the reports is present a sampling of perl installs and how well 
they fare with each module.


The prereqs are the lists of modules and versions the author lists as 
necessary for the proper operation of the module.  You can check them 
against your local install however you wish - CPAN will do it for you, if 
you happen to be using CPAN, but they are available for your use however 
you need to use them.


Anyone can send a CPAN test report, and anyone can install a module without 
CPAN.  Therefore, I don't think the prereq list (for install) should take 
into account the CPAN smoke test infrastructure (a subset of the CPAN 
testers).  Changing the CPAN Smoke Test architecture in an effort to 
present a 'modern' Perl to module authors only encourages them to rely on 
that modern Perl without asking for it - which will cause surprise and 
problems when they don't get it for some case, for both the author and the 
user of the module.  We have an explicit prereq system.  Use it.  It will 
help both author and user.  *Let me see what you are relying on, don't just 
expect it to be available.*  That includes the toolchain: if you need a 
modern toolchain, say so.


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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: unsatisfied configure_requires in perl 5.12.3?

2014-04-22 Thread Daniel Staal
--As of April 22, 2014 9:46:26 AM -0700, Karen Etheridge is alleged to have 
said:



On Mon, Apr 21, 2014 at 11:25:48PM -0400, Daniel Staal wrote:

If you truly need a minimum version of CPAN, declare it.  You can set
a version of CPAN in the prereqs like you can set any other module.


No specific CPAN client is needed to install any distribution. However, if
configure_requires prereqs are not going to be detected and fulfilled, the
installation will fail.


I get what you are saying (CPAN is *never* needed, I get that), but if you 
really feel that way why are we having this discussion?  You suggested the 
solution to some failures was to upgrade a module to a more recent version 
- My point is that if you think that's necessary, why not say so in your 
module?  (Where others can see that requirement, and fulfil it on a 
case-by-case basis, instead of a large scale toolchain modification for all 
users.)


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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: OT: RE: ATTACK TO MY SYSTEM

2003-09-23 Thread Daniel Staal
--On Tuesday, September 23, 2003 16:32 +0200 german aracil boned 
<[EMAIL PROTECTED]> wrote:

Perl is the solution ;)

I build an automatic system. This read mails from spam folder of my
client, update a list with bad ip's (spamers) and update firewall
with new ips. Now the attack to my system is very small. I have
more of 1000 senders checked and with reyect connections to port 25.
thanks to Perl !
Um, please don't do this.  If this were regular spam we were talking 
about that would be a good idea, but the current deluge is from a 
virus.  If you are creating the blacklist you say you are then you 
are blocking people *who you have emailed in the past.*  Or, at least 
people who have your email address on their machine somewhere, due to 
mailing lists, address books, web pages they've viewed, etc.

In other words, you are blocking you friends.  (Admittedly, friends 
who can't run a virus checker, but it is still people who know you.)

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-running Perl's configure script.

2003-09-23 Thread Daniel Staal
Is there a way to re-run Perl's configure script (the one that runs 
when you install Perl?)

Here's what I've got: A program I'm working on suddenly stopped 
working (meaning: a known working version stopped working) with the 
error 'Can't locate I18N/Langinfo.pm in @INC' after I installed some 
modules that that I am going to need from CPAN.  In the course of 
that, I also upgraded CPAN on my machine.

Now, I can find the folder named 'I18N'.  It contains the files: 
'Collate.pm' and 'LangTags.pm', as well as the folder 'LangTags'. 
I'm leaving those alone.

A search of the possible referencing files (I don't reference it 
directly, I don't even know for sure what it is supposed to do) 
reveals that they all check for the exsistance of I18N/Langinfo.pm 
before requiring it.  Further inquriery turned up the file 
'Config.pm' contains a line reporting that I have the offending file. 
Config.pm says that it was built automatiacly as part of the Perl 
install.  So what I'm really looking for is the best way to re-create 
that file.  (I always assume that if there is one problem in such a 
file there may be others.)

In case it matters I'm running Perl 5.8.0 under Mac OS X. (versions: 
10.2.6 and 10.2.8.  Apple released an update last night.)  That is 
upgraded from the standard Apple install.

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: GetOpts: boolean and argument value combos

2003-09-23 Thread Daniel Staal
--On Tuesday, September 23, 2003 18:10 -0700 Trina Espinoza 
<[EMAIL PROTECTED]> wrote:

Hey Perl Peps,

I am stuck in the mudd and hoping someone can give me a few clues
that will help get me back on track.
I want to submit some arguments like so:
./script1.pl -book  -title HP3 -chapter 04
 NOTE: -book does not have an argument
Now I have been using GetOpt::Long and everything works except the
first value -book. Since I want to treat -book like a boolean, I do
not give it value, which causes problems because I guess it needs
to receive some sort of value in it's current format. This is
causing problems where the value of the second argument -title does
not show. Is there a syntactical form I can follow to treat -book
like a boolean and feed the other arguments values? Can I continue
to use Getopt::Long?
Sure.  There are two ways to do this, depending on whether you want 
'--nobook' to set 'book' to false or not.  "book" by itself does the 
plain version: false if not present, true if present.  "book=!" does 
false if not present, true if present and not followed by '--nobook'. 
(If nobook found afterward the book value will be set to false.)

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: OT: Can anyone recommend a good list where CSS talk would be acceptable

2003-09-24 Thread Daniel Staal


--On Wednesday, September 24, 2003 20:45 -0400 Dan Anderson 
<[EMAIL PROTECTED]> wrote:

I have some CSS questions.  Can anyone recommend a good mailing
list?
CSS-Discuss, you can subscribe at:
http://www.css-discuss.org/mailman/listinfo/css-d
Beware.  It makes this list look slow.

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: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Daniel Staal
--On Thursday, September 25, 2003 20:40 -0400 Dan Anderson 
<[EMAIL PROTECTED]> wrote:

First, thank you for your help.  Second, please bear with me as
I'm a perl noob.
	I assume that $_ is the last thing gotten by .
Nope. ;-)  $_, in the context listed in his example, is the value of 
the current element of the array the loop is looping over.  The array 
just happens to be .

will regexes always default to using $_?  I think that's right, but
when I try:
Yes, regexes always default to $_.

while (!( =~ /QUIT/))
{ push @stack, $_; }
print @stack;
it doesn't print anything (although it compiles).
You are now using a boolean value for the test in the while loop. 
(Eg: whether the test was successful.) Therefore the $_ trickery 
doesn't apply, and $_ stays whatever it was before the loop.  (I 
think.  Regardless it is no longer the last line read from .)

So I typed use warnings; at the top and I get a lot of errors about
using an uninitialized variable (@stack).  Now I assume that @stack
comes into scope as local to that while loop, but typing:
Actually, it would come into scope as a global.

my @stack;
our @stack;
local @stack;
Before the loop do nothing.  Am I missing something?
Should they do anything?  (Besides define @stack, and disabling the 
warning since you have now defined it explicitly.)  All they say is 
to define @stack in a smaller scope than global.

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: Is -w deprecated?

2003-09-26 Thread Daniel Staal
--On Friday, September 26, 2003 20:29 -0400 David Wall 
<[EMAIL PROTECTED]> wrote:


In the book I bought, Programming Perl, by O'Reilly they say I
should use warnings instead of -w after the shebang and the perl
path because -w is deprecated.
Is this true?  Also, will use warnings; work on versions of perl
< 5.8?
My copy of the Camel is at work, but if it says -w is deprecated,
I'm inclined to believe it. :-)
Just checked my copies of both the Camel and the Lama.  Both say 'use 
warnings' is preferred over '-w' because it gives finer grained 
control.  Neither, as far as I can tell, says that '-w' is actually 
deprecated.

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: building module/package

2003-09-29 Thread Daniel Staal


--On Monday, September 29, 2003 19:04 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

test.pl
---
use mystuff;
print mystuff::trim($username);

mystuff.pm
--
# do i need any declaration line here
# is sub here or what?
# and where do i put this pm file?
sub trim
{ my $z = $_[0];
  $z =~ s/^\s+//;
  $z =~ s/\s+$//;
  return $z;
}
You're almost good.  Add '1;' to the end of mystuff.pm, just to 
return a true value when it compiles, and 'package mystuff;' to the 
beginning of the same so Perl knows it is a package.  Also 'use 
warnings' and 'use strict' would be good in both...

As for where you put it: wherever you want.  Just make sure that it 
gets included in the @INC path.  The easiest is in the same folder as 
test.pl (assuming you always run test.pl from there), since the 
current folder is in the path.

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: building module/package

2003-09-30 Thread Daniel Staal


--On Monday, September 29, 2003 23:53 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

-I've sent this to the mod_perl list but there seems to be no
response.
I got the module working in the current directory executing on the
command line. But I have a problem calling a module in my mod_perl
dir using apache on redhat 9. I have a mystuff.pm in the same
directory as the calling perl program. I got it working running on
the command line but in apache mod_perl, it can't find the module.
Ok, I know nothing about mod_perl, but let's see what I can do. 
First guess: mod_perl considers that 'the current directory' is 
either itself or insecure.  (Probably the latter: it is in this 
context.)

Questions:
 - Where should the mystuff.pm be located in?
 - The only place i know about mod_perl configuration file is:
/etc/httpd/conf.d/perl.conf. This contains the Alias and Directory
directive.
Error message:
Can't locate mystuff.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .)
Hmm.  So it does seem to contain the current directory...  (That 
would be the '.' at the end.)  Doesn't help much: We still don't know 
*which* directory is the current directory.

There are two or three things you could do here.  First off, you 
could put 'mystuff.pm' in one of the above directories.  Don't really 
recommend that, it confuses the user on what is written on your end 
and what isn't, but it is possible.

Secondly, you could see if there is a way to add to the @INC array in 
mod_perl's config.  I would assume so, but I have no clue...

Third, you could add to @INC in your program file.  The best way to 
do this is to use the 'use lib' pragma.  Syntax: 'use lib "$lib";' 
where $lib is any perl expression that can be expanded into the 
directory.  (That means you can use variables, but only ones that 
will have a value without running any of your program code...)  Put 
that in your program before you 'use' your module.

To simplify: put 'use lib "/path/to/module";' before 'use module;' in 
your main program and it should work. ;-)

Any help would be great.
By the way, I just getting started with perl.
-rkl
Hey, I haven't even completed my first perl program yet.  It just 
happens that my first program is best written with three modules...

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: vaiables global and local

2003-09-30 Thread Daniel Staal


--On Tuesday, September 30, 2003 11:31 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

How do you declare a var global versus local? It seems variables a
local and not static as in shell. That is, the sub does not see the
vars from the calling part. So, can someone modify the snipet to
make it work?
Varibles are by default global, and variable...

a.pl
--
# my $x; any diff from the next line?
$x="abc";
doMe

sub doMe
{ $x="xyz";
  print $x; #will print out xyz
  How can I get the "$x=abc" here w/o passing as an arg?
}
You want the sub to see the $x from outside?  Easy: just don't change 
$x's value...

What you've done here is declare a variable $x, assign it the value 
"abc", then assign it the value "xyz" and print it out.  If you 
wanted "abc" you shouldn't have assigned it "xyz".

Varibles vary in perl.  Don't expect them not to.  (You can create a 
constant at compile time, but that is not a variable.)

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: using 3 arrays

2003-10-02 Thread Daniel Staal
--On Thursday, October 2, 2003 14:31 -0700 A L <[EMAIL PROTECTED]> 
wrote:

@1@2@3
item1aitem1bitem1c
item2aitem2bitem2c
. .  .
. .  .
. .  .
They all have an equal number of items. I think there is a function
I could use.  Can you tell me what it is called and I can look up
the information.  Thanks for your help.
Ok, if you can guarantee that each array has the same number of 
items, here is what you want: (There are more Perlish ways to do 
this, but this way is clear on what is happening.)

for ( $i = 0; $i < @1; $i++; )
{
   print "$1[$i]\t$2[$i]\t$3[$i]\n";
}
What we are doing here is stepping through the arrays simultaneously, 
starting at the bottom.  We assume all the arrays are exactly as long 
as @1.  (Um, you do have better names in the real code, right?)  $i 
is the index of our current place in all the arrays, and will cycle 
from 0 to the length of @1 minus 1.

You didn't need all the .'s and "'s, so I left them out. ;-)

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: How do I RegExp Match a ? without using \X{3F}?

2003-10-02 Thread Daniel Staal
--On Thursday, October 2, 2003 17:54 -0400 Dan Anderson 
<[EMAIL PROTECTED]> wrote:

Is there a way to match a question mark using a regular expression
without looking for a \X{3F} ?
Just escape it: \?

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: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 16:43 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

rules:
starts with alphanumeric
3 chars long
Note, so we are not confused: you mean _at least_ 3 chars long.  (Not 
_only_ 3 chars long.)

require ONLY one period
require alpha after the period
Ok, what exactly do you mean here?  Is this:
a. Require _only_ alpha after the period?
b. Require _the next char_ to be alpha?
Either one is possible from your description, and could be a big 
difference.

/^[a-zA-Z0-9][\w-].[a-zA-z]/ #but now working

sub validate {
local $_ = shift;
return( length >= 3 and
tr/.// == 1 and
/^[[:alpha:]]/ and
   /[a-zA-Z0-9].[a-zA-Z]/ ); #added here still not working
}
That last line says: Match one character (alpha or numeric only) then 
any character, then a single alpha character.

If you want the _next_ character to be alpha, the following should 
work:
/\.[[:alpha:]]/

If you want _only_ (and at least one) alpha after the period, you 
need this:
/\.[[:alpha:]]+$/

Hope this helps.

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: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 17:45 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

start with [a-zA-Z0-9]
chars following is [\w-] BUT IS OPTIONAL
/^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/

I think the regex is not doing the option \w part.
Correct, it isn't.  You haven't asked it to...  To make it optional 
you need to follow the [\w-] with a count which says it is optional. 
The count would be in this form: {$min,$max}, where $min and $max are 
the minimum and maximum counts, respectively.  You can leave out $max 
if there is no maximum count.  (But you still need the comma; without 
it you have an _exact_ count.)  So for zero or more times you need 
the quantifier: {0,}.

There are also three shortcut quantifiers: '*', '+', '?'.  (Without 
the quotes.)  Their meanings are:
* = {0,}
+ = {1,}
? = {0,1}

Note that all the quantifiers are 'greedy'[1]: they match the longest 
string of characters they possibly can.

Ok, now that we've got that over with, why aren't you using the 
'validate' sub?  It is likely to be faster than the above regrex...

Daniel T. Staal

[1] Well, there is a way around this.  But that's another lesson.

---
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: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 18:21 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

So, would this be it for the optional?

/^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/

thanks
Yep, that should work for you.

Daniel T. Staal

(By the way: Don't reply to me *and* the list.  I've set up my email 
client so that replying to me (when I'm sending to this list) sets my 
reply address as the list.  Adding the list again just sends a dupe. 
Some people like off-list replies.  I don't.)

---
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: regex require a period

2003-10-11 Thread Daniel Staal
--On Friday, October 10, 2003 18:21 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

So, would this be it for the optional?

/^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/

thanks
Yep.

Though you can always try for yourself...

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: DBI::XBase not finding table files

2003-10-13 Thread Daniel Staal
--On Monday, October 13, 2003 17:37 +0100 Gary Stainburn 
<[EMAIL PROTECTED]> wrote:

Hi folks,
 I've got the code below, which is suposed to be showing me the
contents of a  .dbf file.  However, whenever I try to run the
program it fails to open the  file.
Can anyone tell me what I'm missing please (I've tried appending
the .dbf but  it made no difference).
[EMAIL PROTECTED] data]$ cat ~/t1
# !/usr/bin/perl -w
use DBI;
select(STDERR); $|=1;
select(STDOUT); $|=1;
my $dbh=DBI->connect("DBI:XBase:") || die "cannot connect:
$DBI::errstr";
I think your problem is right here.  I'm not familiar with 
DBD::XBase, but for most of the DBI modules you have to tell it what 
file/database to connect to in the connect string.  You've only told 
it which database program/protocol to use, not where the actual 
database is.  Have you tried appending the full path to the file? 
(That appears to be what it asks for, according to the docs.)

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: Help w/Class::Date Date.xs

2003-10-14 Thread Daniel Staal
--On Tuesday, October 14, 2003 15:49 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

I downloaded the tar file. But I couldn't find out how to install
it from the README. From the various info in the readme I was able
to install the .pm files but not the xs. The Date class look like
it's working but it keeps showing the message about the XS part
warning. The Date.xs is sitting in my tmp dir. I looks like a C
type of file.
So, please tell me how to install it.
Sounds like it could be a C library that is being used.  There might 
be instructions with it on how to install, otherwise read on.

fyi, I've never installed a cpan or any perl package, if there is
such a thing.
CPAN is Perl's package manager (among other things).  It is the 
absolute easiest way to install a Perl module.  I would suggest you 
type at the command line (you may need root/sudo access):

perl -MCPAN -e 'install Class::Date'

CPAN will probably ask all kinds of questions to set up initially. 
Answer as best you can.  Then it will go get the current version of 
the module, check to see if you have any dependencies, then 
compile/install as needed and appropriate.

Then you don't have to worry about all this.

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: clean up sub?

2003-10-14 Thread Daniel Staal
--On Tuesday, October 14, 2003 15:59 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

Can someone shorten this upper routine?

sub toUpper
{ my $z = shift;
 $z =~ tr/a-z/A-Z/;
 return $z;
}
Sure:
sub toUpper { $_[0] =~ tr/a-z/A-Z/; }
or
sub toUpper { "\U$_[0]"; }
I wouldn't write a function for this myself, I'd just use the 
uppercase shortcut to oneline it:

$var = "\U$var";

Also in a slightly different scenario, how can i change the value
of the parameter itself with a sub.
$a="ca";
toUpper($a);  #change the $a value itself
print $a;  #I want it to print "CA"
Ok, I'll assume this is a made-up example...  (Since it would just be 
easy to write 'print toUpper($a);', using the return value.)

The way to do this would be to pass references to the parameters. 
You would have to pass the references, and work with them.  So, the 
function call would become:

toUpper(\$a);

The sub would be:

sub toUpper { return "\U$$_[0]"; }  # (Hey, we have linenoise!)

In general, this is to be avoided, just because it makes things more 
complicated than they really need to be (and it breeds linenoise). 
There is little you can do this way that you can't with return values 
anyway.

Also, may I suggest picking up a copy of "Learning Perl"?  It's a 
short book, available in all the better bookstores, and goes over 
most of these questions in an easy to read and use manner.

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]


Persistant Filehandles.

2003-10-17 Thread Daniel Staal
Ok, I'm writing an apxl to html converter and I have one little 
problem: I need to open a filehandle in one sub, use it in several 
others, and then close it in a different sub yet.  I'd pass it as a 
parameter, but all the subs are actually called by XML::Parser, so I 
don't get to choose the parameter list.  Therefore I'm trying to keep 
it in a 'global' (package-level) variable, but I can't seem to get it 
to work.  ;-)

Here's what I'm trying at the moment:
-
my $curFile;# The current output file.
my $html;   # The HTML Stream.
# Some code

# The start of a slide.
sub slide
{
	# Open/create the file.
	$slideNum++;			# Incriment the slide number.
	open CURFILE, "> slide$slideNum.html" or warn "Could not open 
slide$slideNum.html: $!";
	
	$curFile = \*CURFILE;
	
	$html = new HTML::Stream($curFile);

# More code...  (All from HTML::Stream)
}
# The end of a slide.
sub slide_
{
# Closing code...

# Close the file.
close $curFile;
}
---

This goes through with no warnings or errors, but the code in 
slide_() does not have access to the file opened in slide().  (It 
does get run, I tested that.)  Anyone have any ideas (other than 
re-opening it in every sub, which I could probably do as a last 
resort...)?

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: Persistant Filehandles.

2003-10-17 Thread Daniel Staal
--On Friday, October 17, 2003 13:54 -0400 Steve Grazzini 
<[EMAIL PROTECTED]> wrote:

You could use a lexically-scoped filehandle.

  {
 my $fh;
 sub do_open   { open $fh   }
 sub do_append { print $fh  }
 sub do_close  { close $fh  }
  }


I actually tried that, using the following code:
--
my $curFile;# The current output file.
my $html;   # The HTML Stream.
# Some code

# The start of a slide.
sub slide
{
	# Open/create the file.
	$slideNum++;			# Incriment the slide number.
	open $curFile, "> slide$slideNum.html" or warn "Could not open 
slide$slideNum.html: $!";

	$html = new HTML::Stream($curFile);

# More code...  (All from HTML::Stream)
}
# The end of a slide.
sub slide_
{
# Closing code...

# Close the file.
close $curFile;
}


But that doesn't seem to work either.  (I've tried re-creating the 
HTML::Stream too, or just using the 'global' version.)  This actually 
was my first try at it.  Again, slide() works fine, but slide_() 
doesn't, even though it gets called.  Any ideas what I'm doing wrong?

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: Persistant Filehandles.

2003-10-17 Thread Daniel Staal
--On Friday, October 17, 2003 13:46 -0500 "Charles K. Clarkson" 
<[EMAIL PROTECTED]> wrote:

:  (I've tried re-creating the
: HTML::Stream too, or just using the 'global' version.)
: This actually was my first try at it.  Again, slide()
: works fine, but slide_() doesn't, even though it gets
: called.  Any ideas what I'm doing wrong?
It worked for me. Perhaps something else is wrong:
(This is version 2 of this reply.)

In writing my reply to this, I managed to find my error.  I had a 
typo in one of my calls to HTML::Stream that didn't flag as either a 
warning or an error (and didn't stop anything but HTML::Stream 
either).  (And yes, I'm using warnings and strict.)  Fixed the typo 
and everything works.

Don't you hate it when you stare at a line of code for two days and 
only find the error after you point someone else at it?  ;-)

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: Problem in Mail::Bulkmail 3.09 module

2003-10-17 Thread Daniel Staal
--On Friday, October 17, 2003 11:28 -0700 Chinku Simon 
<[EMAIL PROTECTED]> wrote:

However, the number of mails that are being sent is pretty huge --
around 2000 mails in a span of 30 minutes.
The perl program crashes after sending around 700 mails with the
Bulk mail error log giving the following error.
error: Could not make socket for 10.10.54.160, Socket error (Too
many open files)code : MBS002 error: Could not make socket for
10.10.54.160, Socket error (Too many open files)code : MBS002
error: Could not make socket for 10.10.54.160, Socket error (Too
many open files)code : MBS002 error: Could not make socket for
10.10.54.160, Socket error (Too many open files)code : MBS002
error: Could not make socket for 10.10.54.160, Socket error (Too
many open files)code : MBS002
Please let me know if anyone has come across the same situation and
if so please advice as to what a good solution to this would be.
Well, I was hoping that someone who actually knew what they were 
doing would try to answer you, but since no one seems to have stepped 
up...

That said, what it sounds like is that you have a smtp server that 
can't handle the number of connections that Mail::Bulkmail generates. 
The first thing to check is to see if you can scale back the number 
of connections.  Given that, a perusal of the docs turns up a few 
possibilities for this; the most immediately relevant is the option 
'max_messages_while_awake' coupled with 'sleep_length'. (Both 
documented in the Mail::Bulkmail::Server docs.)  Try setting the 
first to, oh say 650 or so, and the second to 30-60 seconds (it is in 
seconds) to start with, and play from there.  It'll take a little 
longer to send all the emails, but hopefully it won't overwhelm the 
server.

Hope that helps.  If your problem is something else, come on back 
with whatever info you've got from this.  ;-)

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: what is time?

2003-10-17 Thread Daniel Staal
--On Friday, October 17, 2003 19:08 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

How can I convert it to a readable date?

$now=time;

print $now return 1066442632
Time is normally given as the epoch time: the number of seconds since 
the beginning of the clock under UNIX (Jan 1, 1970).

To change to a more human-readable date, search CPAN.  There's 
modules that can convert that into almost any time format you can 
think off... (And some you can't.)

I personally have found Time::Format easy to use, but that's just a 
personal opinion.

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: More what is time?

2003-10-17 Thread Daniel Staal
--On Friday, October 17, 2003 20:38 -0700 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

I know about localtime(time); But I was wondering if there was a
formula out there like 1066442632/60/60/24 that will say today is
say 2003 10 17.

Gee, I don't know what you're asking for here.  I mean, if I wanted 
to do that I'd use localtime, or I'd use one of the CPAN modules that 
you've been pointed to.  What aren't they doing for you that you need 
done?  I've got a program that outputs time in ISO, english, 
Discordian, babytalk, Roman, Japanese, French Revolution, Shire, 
Amerian, European...  All off the resources you've already got. 
Several of those I could have done multiple ways.

If there's any reason they can't do what you want, just say so, and 
we'll find a way around it.  What's the problem?

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: PostgreSQL and Customer Database

2003-10-18 Thread Daniel Staal
--On Saturday, October 18, 2003 18:14 +0200 Desmond Coughlan 
<[EMAIL PROTECTED]> wrote:

OK, first question: is all the above possible ?  I think that I
know the answer, and that it's yes.
You guessed right there, I believe. ;-)

In which case, my second question is: where can I learn how to do
it ?  I have 'Introduction to Perl' translated, and the only
mention of databases is in telling me to use::DBI.  Fine, but ...
_how_ do I use DBI ?
Well, you could install the modules and read the manuals, FAQs, and 
other docs that come with them (or available on CPAN's web site)... 
(As well as the info on http://dbi.perl.org/ and other websites.) 
But that's not actually what I'd recommend.  (Though there is plenty 
of information that way.)

If you don't mind spending a little money, I would highly recommend 
'Programming the Perl DBI', also an O'Reilly book.  You still need to 
know SQL and your database, but it covers the rest of the DBI end.

After that, I need to swot up on CGI, which I've already touched
upon in writing a 'feedback' form for my webpage.
I can't help as much here...  Again, the docs online and with the CGI 
modules is enough to get you going if you want to go that route, or 
O'Reilly has a book dedicated to it.  There is also quite a bit of 
Perl subculture dedicated to this, so there are a *lot* of other web 
resources to work with.  (Including a 'beginners-cgi' email list like 
this one just for CGI.)

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]


Text encoding reversal.

2003-10-18 Thread Daniel Staal
Quick version:
Can anyone tell me what the text encoding is called that this 
filename is in?
Siham%2C%20Garden.png

Longer version:
I've got a minor snag in my conversion program: XML::Parser is 
encoding the attributes it returns to me.  This isn't a problem in 
most cases, but there is one case where I need to use that attribute 
value in a shell call, and I can't figure out a good way to 
de-convert it.  I know the encoding (well, mostly), but I don't know 
what it is called, so I can't find a converter.  (I don't want to 
write one myself, I'm sure I'd miss some character.  Besides, it is a 
common encoding, right?)

Any pointers towards relevant modules would be appreciated.  I just 
can't figure out a good search for them.

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: Text encoding reversal.

2003-10-18 Thread Daniel Staal
--On Saturday, October 18, 2003 16:29 -0500 Wiggins d'Anconia 
<[EMAIL PROTECTED]> wrote:

Well generally this is considered either HTML or URL escaping. So
depending on which context you are needing (the above looks like
URL) you may want to try the following two modules:
URI::Escape
HTML::Entities
Thanks, that got me going.  It happens the context was URI, so the 
URI::Escape was what I needed.

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: help with Very Small Perl?

2003-10-22 Thread Daniel Staal
--On Wednesday, October 22, 2003 16:24 -0600 "McMahon, Chris" 
<[EMAIL PROTECTED]> wrote:

Can anyone suggest either:  a way to make IO::Socket::INET work in
the simplest possible way on 5.005; or a way to install the
smallest possible 5.8; or something I haven't thought of?
Any suggestion (no matter how crazy!) is welcome...
-Chris
Ok, here's for the crazy class of suggestion...

How about compiling it on another machine, and *not* putting Perl on 
the space-limited system?  There are two (experimental, throughly 
test before actually using) 'modules' that generate C code: B::C and 
B::CC.  You call them as direct from the Perl command line:
perl -MO=C $perlscript

I have never had a need to use these, and they are listed as 
experimental, but they will save you a Perl install if they work.

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: Adding Double Quotes to variable

2003-10-25 Thread Daniel Staal
--On Saturday, October 25, 2003 20:48 -0400 Anthony J Segelhorst 
<[EMAIL PROTECTED]> wrote:

How can add double qoutes around "SNMP Service" to the variable
$servicename?
I have tried $doubleqoutes_servicename =  "$servicename";

This does not work though.

Any ideas?
Either of the following should work:

$doubleqoutes_servicename =  "\"$servicename\"";
$doubleqoutes_servicename =  '"'. $servicename .'"';
My preference is the latter, but only because I find it easier to 
read.  (And that is partly because of BBEdit's coloring system: the 
latter colors less ambiguously.)

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: creating a hash list from arrays

2003-10-27 Thread Daniel Staal
--On Monday, October 27, 2003 21:51 -0500 radhika sambamurti 
<[EMAIL PROTECTED]> wrote:

Hi,
As per the code below, I am trying to read from the database and
put the values into a hash list, so that I can retrieve the values
later. I have managed to put the values into arrays, but am not
able to put them into a hash. Any ideas how this can be
done/improved?
### code below##

while (my $res = $sth->fetchrow_hashref()) {
push(@menu_id, $res->{"menu_item_number"});
push(@menu_desc, $res->{"description"});
my $results_hash = ($res->{"menu_item_number"},
$res->{"description"}); }
Not too bad.  Though, by 'retrieve the values later' I assume you 
mean after the while loop, yes?  If so, it would be a good idea to 
change the scope of the hash to reflect that...

Try:

my $results_hash;
while (my $res = $sth->fetchrow_hashref()) {
  push(@menu_id, $res->{"menu_item_number"});
  push(@menu_desc, $res->{"description"});
  $results_hash = ($res->{"menu_item_number"},
   $res->{"description"});
}
Then the hash won't expire at the end of the loop.

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: creating a hash list from arrays

2003-10-27 Thread Daniel Staal
--On Monday, October 27, 2003 21:22 -0600 Daniel Staal 
<[EMAIL PROTECTED]> wrote:

my $results_hash;
Sorry, correction.  That should be:

my %results_hash;

while (my $res = $sth->fetchrow_hashref()) {
   push(@menu_id, $res->{"menu_item_number"});
   push(@menu_desc, $res->{"description"});
   $results_hash = ($res->{"menu_item_number"},
$res->{"description"});
}
Then the hash won't expire at the end of the loop.
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]


Image conversion modules?

2003-10-30 Thread Daniel Staal
Could someone recommend a good image file conversion/manipulation 
module?  I'm having trouble finding one that actually works...

Here are my requirements:
*Must run under Mac OS X (10.3, but if it tested to earlier it should 
be fine.)
*Must handle the following image formats: TIFF, PNG.
*Must be able to handle alpha channels.

Would be nice to haves are:
*Handle PDF, JPEG, GIF, PICT, BMP.
*Can do affine transformations.
I've tried Imager (Mac does not compile to needed formats) 
Image::Imlib2 (Does not compile on Mac) and Image::Magick (Won't 
install on Mac.)

I'm currently using ImageMagick directly, but it won't handle TIFF 
files on Mac.  If I can get something to convert them into something 
ImageMagick *can* handle then I can use it to do the rest.  Something 
that can handle alpha channels in PDF files would be good too. 
(ImageMagick won't.)

Any ideas?  I'm willing to do Mac-specific, if someone has a good way 
to access the QuickTime/Quartz API's through Perl.

(Oh, and Panther's 'sips' command-line program doesn't handle alpha 
channels.)

Any ideas?

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: printing: landscape instead of portrait

2003-10-31 Thread Daniel Staal
--On Friday, October 31, 2003 9:24 AM -0800 Gregg O'Donnell 
<[EMAIL PROTECTED]> wrote:

I'm using MIME::Lite to send a wide email, which is formatted as
HTML (could be formatted as text if needed, or as an attachment).
How do I control the printing to orient the email to an 11 X 8 1/2
(landscape/horizontal) style instead of 8 1/2 X 11
(portrait/vertical)?
In theory you could use CSS to format the HTML to be oriented to the 
landscape mode, but I don't know of any mail readers (or browsers for 
that matter) that would support it.

Short answer: you don't.  The user controls how an email/web page is 
printed.

If it really needs to be landscape when printed then the layout of 
the rest is likely important too.  For exact layouts like that I 
would use PDF.  HTML can come close, and is better in most cases, but 
if you need to specify how it prints exactly nothing matches PDF.

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: Top-posting

2003-11-05 Thread Daniel Staal
--On Wednesday, November 5, 2003 8:00 PM + Rob Dixon 
<[EMAIL PROTECTED]> wrote:

Alan Perry wrote:
Rob Dixon wrote:

I have taken to copying messages into my text editor as there is
no email client that I know that can do what I want. Until I
write it, that is :)
Someone has saved you the trouble...  There is a program called
Quotefix that will clean up your stuff and do the "bottom posting"
as so many seem to prefer here.  Seems to work very well for 99%
of the messages it encounters.
Thanks Alan. That sort of thing would be my goal, except that
'Quotefix' has a memory leak problem and crashes even Windows XP
after a few days' run. In W9x/ME it's fatal after only a few hours
because of the limited virtual address space.
Well, if that is what you are looking for, I would suggest you take a 
look at Mulberry.  It can shift, unquote, requote and rewrap lines 
for you.  (As well as my favorite 'paste quoted'.)  Just look under 
the 'Draft' menu.  Avalible for Mac, Unix(Linux and Solaris) and 
Windows.

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: not on topic but relevant to list

2003-11-13 Thread Daniel Staal
--On Wednesday, November 12, 2003 6:25 PM -0500 Casey West 
<[EMAIL PROTECTED]> wrote:

It was Wednesday, November 12, 2003 when [EMAIL PROTECTED] took the
soap box, saying:
: hum could we not get a nice topic prefix added to the list?
: it would make it a lot easy to make mail filters that could kill
: all mail going to this address, not from the list.?
No, we won't be doing that.

Use the headers.  Perhaps Delivered-To could help.
How about the RFC 2919 headers that this list thoughtfully includes 
(though it misses one...).

The following are included in every email from this list:

List-Post: 
List-Help: 
List-Unsubscribe: 
List-Subscribe: 
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: Threading In List Replies [Re: QUESTION]

2003-11-13 Thread Daniel Staal
--On Thursday, November 13, 2003 12:35 AM -0800 "[EMAIL PROTECTED]" 
<[EMAIL PROTECTED]> wrote:

Now that you explained all that, should I reply or reply all?

ie - this message does a reply all as:

  To: "R. Joseph Newton" <[EMAIL PROTECTED]>
  CC: Beginners--Perl <[EMAIL PROTECTED]>, Rob Dixon
<[EMAIL PROTECTED]>
Now that is a completely separate question.  An email client that 
generates a 'In-Reply-To' header for one will most likely generate it 
for the other.

To actually answer your question: who do you want to send the email 
to?  If you want to send it back to the list (usually best) you need 
to make sure that one of the addresses you are sending to is 
[EMAIL PROTECTED]  This list does not munge the Reply-To header 
(you can argue about if that is right...), so a 'reply' will not, by 
default, send to the list[1].  If you want to take a discussion 
offlist you only want to email the people involved, usually the 
person who wrote the email you are replying to, and then 'reply' is 
all you need.

Personally I just trim them all off and put [EMAIL PROTECTED] in the 
'To:' field.

Daniel T. Staal

[1] Unless the author, like me, changes their 'Reply-To' address to 
this list themselves.  Note that that isn't competely foolproof: some 
clients automatically reply to the 'From' address, which I leave 
alone.  (That behavior is just wrong, but anyway...)

---
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: first steps with perl, a log reader

2003-11-16 Thread Daniel Staal
--On Sunday, November 16, 2003 8:45 PM +0100 Guardian Angel 
<[EMAIL PROTECTED]> wrote:

  use strict;   # Always
  use warnings; # Usually (same as -w qualifier but portable)
i will do that, "use warnings;" gave me more (human readable)
errors, so better to understand for me.
Well, if it's human readable errors you want, try adding this line:

use diagnostics;

It can get a little wordy at times, but it's got guaranteed place in 
my under-development code.

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: File upload script

2003-11-16 Thread Daniel Staal
--As off Sunday, November 16, 2003 5:17 PM -0800, [EMAIL PROTECTED] 
is alleged to have said:

Can someone point the way to some file upload script for webserver
on unix/linux?
--As for the rest, it is mine.

Single file, batch, automated, manual, FTP, RCP, email, SCP, CVS, 
SFTP, remote, local, web-based, commandline, GUI, from Windows, from 
Mac, from UNIX?

Please, what is the problem you are trying to solve, and what have 
you tried?  Google only turns up around 167,000 hits for a search 
relating to this.  A little smaller problem-space would be useful...

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: mail auto delete from POP server

2003-11-19 Thread Daniel Staal
--As off Wednesday, November 19, 2003 7:42 PM +0530, Ramprasad A 
Padmanabhan is alleged to have said:

I would like to write a program that deletes all mails from my
popserver which are older than 'n' days
Is there a script available already. If I were to write a script
using   Mail::POP3Client , I would have to fetch the headers of all
mails and the parse mail headers
Is there no module that can return all mails recd before a
particular date
--As for the rest, it is mine.

What format is the mail stored in?  If it is Maildir, this is simple. 
(Depending on your needs I have a program, or you can use 'find'.) 
Other formats are harder, as they need something that can parse the 
mail format, or work through the POP interface.

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: Pointers

2003-11-20 Thread Daniel Staal
--As off Thursday, November 20, 2003 12:20 PM -0700, Eric Walker is 
alleged to have said:

ok why the $$ instead of the %$?

sorry confused.

On Thu, 2003-11-20 at 12:08, Paul Kraus wrote:
$$overdate{key}

Perldoc perlref
--As for the rest, it is mine.

$$ would get you the value of a certain value in the hash.  (The 
scalar value of the hash element.)  %$ would get you the entire hash.

Most often people want one value of the hash, not the whole hash, 
though both have their uses.

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: Rounding off

2003-11-22 Thread Daniel Staal
--As off Saturday, November 22, 2003 4:27 PM -0600, Mike Blezien is 
alleged to have said:

Hello,

I need the ability to round off dollar amounts to the nearest 100th
of a dollar amount, IE $14.9564 to $14.96 or $132.1123 to $113.11
what is the best way to accomplish this ??
--As for the rest, it is mine.

Best way?  Well, that depends...

A simple sprintf("%.2f", $num) will do initial rounding, but read 
'perldoc -f round' for issues.

Slightly more flexible (and possibly more precise) is Math::Round, 
which can handle rounding in several different formats.

The question is, how precise do those numbers need to be?  For a real 
financial application you probably need to write your own rounding 
routine, to be sure it acts exactly as you need it.  If you just need 
to print out a few dollar figures, either of the above will probably 
do.

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: Don't Send To Me!

2003-11-24 Thread Daniel Staal
--As off Monday, November 24, 2003 12:54 AM -0600, Jason Dusek is 
alleged to have said:

Is there some way to get people on this list to stop sending me two
emails at once?  I am on the beginner's list - so when you send
email to me and then cc to the list, I get two.  Which is annoying.
I suppose I could write some rules to kill duplicate messages, but
I have got stuff to do.  If I post to the list, I think it may be
safely assumed that I will read it to find out what people have to
say about my posting.
--As for the rest, it is mine.

My solution has been to change my reply-to address to the list. 
(Since that is what I want people to do, reply to the list.)

It looks like there should be a way to do this in Apple's Mail app. 
There is manually at least, so I bet you could AppleScript it.

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: Reply to the list WAS Yahoo! Getter

2003-11-26 Thread Daniel Staal
--As off Wednesday, November 26, 2003 9:37 PM +0100, Jerry Rocteur is 
alleged to have said:

I see this a lot of this on this list, Reply to the list, Reply to
the list, Reply to the list.
If it was the intention of the list manager for people to reply to
the list then a reply would go to the list, however, a reply goes
to the poster, not the list.
So who is right ?
--As for the rest, it is mine.

Actually, you've just stumbled into an old argument in mailing list 
circles.  It goes like this: Should $mailingList change the 
'Reply-To:' header to itself?

Arguments for:  It helps people reply to the list, which keeps the 
discussions on the list.

Arguments against: It destroys information.  'From' and 'Reply-To' do 
not have to be the same, people may want you to reply to them at a 
different address then the list.  Also, some people *want* offlist 
replies as well as/instead of on-list replies, for various different 
reasons.  (Best example is a digest subscriber who wants the reply 
immediately if it was in response to their post.)

At the end of the day, it is up to the list admin to decide which 
they want to do.  I'm on some lists that do each.  My personal 
solution has been to set the 'Reply-To' to where I want the reply 
actually sent.  Since I can do that easily for each mailing list, and 
can override at will, it works for me.

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: Glob and space in directory name

2003-11-26 Thread Daniel Staal
--As off Wednesday, November 26, 2003 3:58 PM -0500, Boris Shor is 
alleged to have said:

Why does the following work (eg, give me an array filled with
matching file names):
@filelist = glob("w:/stleg/Colorado/House_98/*.htm");

And when I rename the directory to "House 98" (space instead of
underscore), the following does not:
@filelist = glob("w:/stleg/Colorado/House 98/*.htm");
--As for the rest, it is mine.

(I'll assume you have both folders.)

Simple: glob is based on the shell behavior, and shell considers a 
space to be the end on argument.  So, in the latter you are telling 
it to open two different filename patterns.

Try this:
@filelist = glob("w:/stleg/Colorado/House\ 98/*.htm");
I think that should work...  (It escapes the space.)

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: problems with case insensitive tr/// regexp

2003-11-27 Thread Daniel Staal
--As off Thursday, November 27, 2003 7:42 PM -0500, Dan Anderson is 
alleged to have said:

So what am I doing wrong  and how do I make a case
insensitive tr/// regexp?
Thanks for your help,
--As for the rest, it is mine.

You can't make a case insensitive tr/// regexp: tr/// doesn't do 
regexp.  It does transliteration: it replaces the characters in the 
first part with the respective ones in the second part.

You want the s/// operator:
s/\//i
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: problems with case insensitive tr/// regexp

2003-11-27 Thread Daniel Staal
--As off Thursday, November 27, 2003 7:05 PM -0600, Perl Newbies is 
alleged to have said:

--As off Thursday, November 27, 2003 7:42 PM -0500, Dan Anderson is
alleged to have said:
So what am I doing wrong  and how do I make a case
insensitive tr/// regexp?
Thanks for your help,
--As for the rest, it is mine.

You can't make a case insensitive tr/// regexp: tr/// doesn't do
regexp.  It does transliteration: it replaces the characters in the
first part with the respective ones in the second part.
You want the s/// operator:
s/\//i
--As for the rest, it is mine.

Hold on one moment before you shoot yourself in the foot with that 
loaded gun I just gave you...

You definitely need the s/// operator, (unless you can use one of the 
HTML parsing modules).  But let's fix that regrexp first, shall we?

First off, you may have noticed I removed the first '.*' from your 
regrexp: that's because nothing is allowed between the opening '<' 
and the name of the element.  Unless, of course, it is a closing tag, 
in which case you have a '/' in there.  So, that would be:
s/\<\/?font.*\>//i

Just a moment, that's ugly.  Substitution allows different dividers, 
let's use something else.  I'll use '[' and ']'.  So, re-written that 
as:
s[\][]i
(Note that we've dropped the escape on the slash: it is no longer 
needed.)

Ok, let's try that.  Yikes!!!  It matches _everything_ after the 
first font tag!!  Um, that greedy '.*' needs to be fixed, to stop as 
soon as it can instead of matching as much as it can.  We do that by 
adding a '?' after it:
s[\][]i

There, that's better.  Oh, but there is one other problem:  '.*?' 
stops at a newline.  That may sound fine, but a newline is legal 
inside a HTML element tag...  We change this by adding a 's' with the 
'i' modifier:
s[\][]si

That should work.  Of course, it only changes the first font tag it 
finds...  To fix that we need another modifier: 'g'.  So the final 
pattern is:
s[\][]gsi

I think that covers everything...  And it is a quick lession is why 
we usually tell people not to try matching HTML with regrexps.

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: problems with case insensitive tr/// regexp

2003-11-28 Thread Daniel Staal
--As off Friday, November 28, 2003 1:08 PM -0800, R. Joseph Newton is 
alleged to have said:

s[\][]gsi

Cool!  Thanks, Daniel, that is very nice work.  I could feel myself
going back over those first steps in using regexes as I followed
your post.
--As for the rest, it is mine.

Heh, thanks.  I'm still on the first steps, most of the time...

Quick bonus question (which I won't be around to answer, most likely; 
I'm going to be offline for the next few days): Find me a valid HTML 
snippet that the above matches but it (probably) shouldn't.  I can 
think of at least one case...

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: Use DBI quote without creating an object

2003-12-11 Thread Daniel Staal
--As off Thursday, December 11, 2003 12:53 PM -0600, Dan Muey is 
alleged to have said:

I'd like to use DBI's quote function without having to
connect to a database and without having to create my own!
Is that possible?
--As for the rest, it is mine.

I would suspect it is not possible.  You have a simple problem here: 
what quote format does DBI need to use?  The purpose of the quote 
function is that each database needs a different quote format.  If 
you haven't connected to a database how can DBI know which you intend 
to use?

The only thing I would try yet at this point would be importing the 
DBD's (for your specific database) quote function (I'm assuming quote 
is implemented in the obvious way) and using it directly, but I 
wouldn't count on that working.

Either that or re-think your problem, so that you don't have to quote 
it until you actually know which database you are using...

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: Question for this Group ... dont flame me :)

2003-12-12 Thread Daniel Staal
--As off Friday, December 12, 2003 7:25 AM -0800, Jeff Westman is 
alleged to have said:

So, why is it that most of the solutions represented in this group
tend  to point to a CPAN module when the code for it isn't that
hard (usually) to write?  I'm not sure if using modules is a matter
of "convenience" or "necessity".  While the solutions shown here
will most often work, they aren't practical for Joe Programmer
working in the corporate world (don't flame me! LOL) who doesn't
have access to install as root or install on many many servers.
Convenience.  You could always write the code directly in assembly, 
if you really needed to, but just like it is usually easier and 
better to use Perl it is usually easier and better to use a module.

My point being, it might be helpful to provide a solution such as

 See xxx::yyy at CPAN or my solution below
Most modules are Open Source.  If you really can't install them, you 
could use their code directly, or indirectly through a rewrite.  (And 
don't tell me you would then have to give away your application: very 
few Open Source licences require you to give the code to anyone who 
is not using the program.  If it is in-house only you have the code.)

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: When to USE shift or @_

2003-12-19 Thread Daniel Staal
--As off Saturday, December 20, 2003 1:57 PM +1100, Colin Johnstone 
is alleged to have said:

Gidday all,

I want to pass a boolean value as a parameter to a subroutine what
should  I use shift or @_
and whats the difference please.

e.g

mySubRoutine(0);

sub mySubRoutine{
my $booleanParameter = @_;
return;
}
--As for the rest, it is mine.

All parameters to subroutines are found in the @_ array for that 
subroutine.  You can assign from that array using shift or directly. 
The above looks like it is trying to assign from it directly, but it 
fails slightly.  I think you ment this:
my $booleanParameter = $_[0];
(Though I could be wrong.  If you are checking whether a parameter 
was passed at all (or how many) the above could work.  Personally I'd 
prefer not to do that, except as a check to make sure the function 
was called correctly.)

The difference with using shift or assigning it directly is shift 
removes the value from the array, assigning it directly does not. 
This may not make much difference, but occasionally it does.

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: generating GIFs

2003-12-20 Thread Daniel Staal
--As off Saturday, December 20, 2003 2:23 PM -0600, Andrew Gaffney is 
alleged to have said:

I want to write a Perl program that will auto generate GIF images.
The images that I want to generate will be about 30x80. It will be
a black rectangle starting in the bottom-right with a few pixels
border on the top and left. There will be a light blue rectangle
starting in the top-left with a few pixels border on the bottom and
right. There will then be 6- or 8-point black bold centered text
that will be specified when the program is run. The background also
need to be transparent. Can anyone give me any pointers on writing
a Perl program that can do what I need? Links to examples are good
too. Thanks.
--As for the rest, it is mine.

I believe I would start by looking at the Imager module on CPAN. 
According to the docs it (and it's sub modules) can do all you want.

Sorry I can't help more.

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: generating GIFs

2003-12-21 Thread Daniel Staal
--As off Sunday, December 21, 2003 11:59 AM -0600, Robert Brown is 
alleged to have said:

Is there any alternative to gifs to make animated images?  Flash is
proprietary to macromedia, and gif to Unisys.  Is there such a thing
as an animated png?  How about a free (in the GPL sense) open
sourced alternative to Flash?
--As for the rest, it is mine.

There is an animated variant of png, mng.  I am not sure what the 
support level is (besides that Mozilla recently dropped it), but it 
doesn't sound to hard if the program already supports png...

Or there is SVG, which is closer to Flash than anything else. 
Browser support is limited though, at least without a plugin.  (Of 
course, Flash needs a plugin too...)

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: How to write a page break character.- one more question

2003-12-22 Thread Daniel Staal
--As off Monday, December 22, 2003 9:15 AM +0530, 
[EMAIL PROTECTED] is alleged to have said:

I have one more requirement, The last STATUS which occurs just
prior to the file end should not be followed by a page break
character. How can I code this in perl?
--As for the rest, it is mine.

Just to turn this on it's head: what follows the other status lines? 
(Besides the page break.)  Would it be possible to think of the page 
break being prior to it (and therefore not connected to the STATUS 
line)?

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: Hi & a question

2003-12-28 Thread Daniel Staal
--As off Friday, December 26, 2003 3:16 PM -0600, John McKown is 
alleged to have said:

Actually, I considered an "ini" or "cfg" file, but rejected it. I
was  wanting something more "standalone" in this case. First, it
seemed a bit  much for only 4 parms. Second, I didn't want to
maintain a separate file.  Third, I didn't want to parse an "ini"
file, although there is likely a  CPAN module around to do that.
And I already use LWP::UserAgent and  HTTP::Request::Common, so
requiring another CPAN modules is not really a  big deal. I really
appreciate CPAN!
--As for the rest, it is mine.

Personal opinion: A cfg file is much easier to update/maintain then 
environment variables, and a command line is easier to use for 
'variable' setups.  For a case like this I would probably want to use 
a combined commandline/config file setup.  Luckily, that only 
requires *one* CPAN module: AppConfig.  It will handle both, in 
either order.

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: Can I set '$!' ?

2003-12-29 Thread Daniel Staal
--As off Monday, December 29, 2003 12:54 PM -0600, Dan Muey is 
alleged to have said:

I want to be able to return a true or false value from a
function in a module and populate the $! variable with the
specific errors. Is this possible? Is there documentation on
how to do this? I can find docs on how to use $! but not how
to set it. Thanks for any help -Ken
Did anyone ever reply to this post?
I couldn't find it in the archives and I thinnk it's a pretty good
question.
There were several responses, I can forward them to you if you really 
want them.  Basically it boiled down to: "Read 'perldoc perlvar' for 
how and possible values.", and "Are you sure you want to do that?".

For instance would it be 'safe' and 'proper', and 'ok', etc... to
do somethign like:
sub whatever {
my $foo = shift;
undef $!;
if($foo eq 'bar') { return 1; }
else { $! = "Foo must equal bar";return 0; }
}
"Foo must equal bar" is not a valid value for $!, most likely. :-) 
For what you are doing here I would really prefer you either 'die' or 
'warn', depending on what severity you think the problem is.  (You 
could of course 'croak' or 'carp' instead, as applicable.)

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: My stupidity! (WAS RE: Mail::Sender weirdness)

2003-12-30 Thread Daniel Staal
--As off Tuesday, December 30, 2003 11:58 AM -0600, Dan Muey is 
alleged to have said:

So now it said "Connection not established" for
the local sending to remote, which I would think would
be the easiest one, especially since:
Local to local is ok.
Remote to local is ok.
I'm not doing any remote to remote.
But authentication made my mail servers start sending it but I'm
still not sure why my  mail server would insist on authentication
in one case but not the other.
--As for the rest, it is mine.

They are doing the Right Thing and not being an open relay. 
Basically the server says *one* of the persons involved has to be 
known to it.  If the email is for a local user it knows that person. 
If it isn't, you have to authenticate as someone it knows.  Otherwise 
Joe Spammer can come and ask the server to please deliver these 10k 
messages to random people.

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: My stupidity! (WAS RE: Mail::Sender weirdness)

2003-12-30 Thread Daniel Staal
--As off Tuesday, December 30, 2003 12:33 PM -0600, Dan Muey is 
alleged to have said:

They are doing the Right Thing and not being an open relay.
Basically the server says *one* of the persons involved has to be
In both cases one is always a local user. But only in one case is
authentication required.
Without authentication, if you are sending, the mail server can't 
tell a local from a remote user.  (It can always tell for receiving: 
it just checks its own delivery tables.)

(There are ways around this.  But they are fairly easy to spoof if 
the mail server is accessible from the internet, and do not work for 
roaming 'local' users or static IP addresses (well, static IPs could 
be used, with a lot of extra work).  Authenication is easier to set 
up and harder to spoof.)

I could spam all the local users as [EMAIL PROTECTED]
all day long without any knowledge of there settings.
So I guess, why not authenticate both ways? Just a pondering, no
big  deal since they'd have to get a scirpt on the server and
that'd  make them trackable pretty quick.
For remote to local: authenticate how?  You don't want to block mail 
coming in from random domains (since you don't know which are spam 
domains and which aren't), so you have to let random people send you 
email.  Otherwise the only email you can handle is local to local, 
and that just isn't very useful.  (Note: joemama is probably a 
registered, legit, and paid-in-full user of remotespamville.com , so 
you can't say people who aren't from that domain.  He *is* from that 
domain.)

And now we are well into anti-spam theology.  (There have been 
several complete systems proposed to handle the 'authenticated guest' 
problem here, none currently is in use.)  And out of Perl. ;-)

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: Help find info for CPAN update config questions

2004-01-03 Thread Daniel Staal
--As off Saturday, January 3, 2004 3:41 PM -0800, J Ingersoll is 
alleged to have said:  (Snipped)

As for my request for documentation, it was mainly for ---

Q: Should all FTP connections be passive (y|n) ?


One way visibility
   ... So for these types of firewall FTP connec-
   tions need to be done in a passive mode.
   ...
   IP Masquerade

- But I'm not doing IP Masquerading. Wondering whether this
applies.
--As for the rest, it is mine.

Well, if you are having problems I'd say yes.  ;-)

FTP has issues with firewalls.  (The design doesn't work well with 
them.)  If you are behind a firewall you probably only can do 
'passive' ftp.  Either that or you can do both passive and active, so 
if there is a question I'd set all to passive.  (Well, for user side 
anyway...)

I'm not sure I'm making sense (sleeep...), so here it is again: If 
you can do FTP you can do passive FTP (90% of time).  You may be able 
to do more, but doing only passive won't hurt you (at least not 
much).  When in doubt, just stick to passive.

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: help with "user vars qw"

2004-01-05 Thread Daniel Staal
--As off Monday, January 5, 2004 7:20 PM -0300, Ricardo Pichler is 
alleged to have said:

Hi,  I'm beginner in the perl world, I having see very files .pl to
learn and I  have one question... In this script, what do make the
parts in bold?
Umm, Bold?  You sent text/plain.  There is no bold.

# !/usr/bin/perl
use strict;
$|=0;
use vars qw(%WRRConf %DHCPDConf %IPTablesConf %GeneralConf
 %DBIConf %NetworkConf %IfCfgConf %WIPLConf
 %WANInitConf %LANInitConf
 %NetworkRemoteConf %WRRRemoteConf
%DHCPDRemoteConf  %IPTablesRemoteConf
%GeneralRemoteConf %SubnetRemoteConf
%AdmNetRemoteConf %VisitorSubnetRemoteConf
%BlockedSubnetRemoteConf %WANRemoteConf
%DCClientsMAC %DCClientsWeight %DCClientsIP
$dbh $Debug
);
I'll assume this line of code is what you meant.  (Everything from 
'use' to ';' is one line of code, to me.)

This file have various includes .pm after these lines, I believe
that this lines  in bold, export the variables declared to modules.
This is correct? This is an mode of making they to becoming
"global" to modules? Sorry my bad english.
If I'm reading my copy of the Camel right it is declaring them to be 
valid global variables.  Perl has a concept of exported varibles as 
well, but this is just listing them in the global namespace.

I am sure that I'm reading it right when it says that this is 
depreciated.  (Meaning: it still works, but don't do it anymore.)

I'll leave it to someone who knows what they are talking about to 
tell me if I'm right. ;)

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: OS X, cpan, libnet

2004-01-08 Thread Daniel Staal
--As off Thursday, January 8, 2004 1:18 AM -0600, Robert Citek is 
alleged to have said:

Hello all,

I have perl 5.6.0 on my Mac OS X.  I'd like to install libnet.
However, when I try to use cpan, it wants to automagically upgrade
my perl to 5.8.2.  All I really want is Net::FTP.  What is my best
course of action:
--As for the rest, it is mine.

My advice: (In order of preference,)

1. Upgrade to Panther. ;-)  It includes Perl 5.8, and plenty more.
2. Upgrade Perl following the directions at:
http://developer.apple.com/internet/macosx/perl.html
  This will get you the current version of Perl.
3. Install the latest version of libnet, from CPAN if it will let 
you, otherwise directly.  (You can download the package from CPAN's 
website.)

Hope that helps.

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: solved - OS X, cpan, libnet

2004-01-09 Thread Daniel Staal
--As off Friday, January 9, 2004 1:08 AM -0600, Robert Citek is 
alleged to have said:

On Thursday, January 8, 2004, at 08:22  AM, Daniel Staal wrote:
1. Upgrade to Panther. ;-)  It includes Perl 5.8, and plenty more.
In the queue to do.  Also, want to dual boot with Linux, but that's
for an other discussion forum. :)
2. Upgrade Perl following the directions at:
http://developer.apple.com/internet/macosx/perl.html
  This will get you the current version of Perl.
Right before doing #1.
--As for the rest, it is mine.

Don't bother doing both: it will just mean you have an extra copy of 
Perl on your system.  (And a non-standard one at that: Panther 
includes a normal Perl build, which you couldn't quite do under Jag.)

Upgrade Perl if you need the new version of Perl and don't plan on 
upgrading Mac OS X soon.  Otherwise, just take the standard build in 
Panther, which was up to date at the time of Panther's release.  (If 
you want to upgrade afterwards just use the normal Perl upgrade 
instructions.)

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]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Cobol format conversion

2004-01-10 Thread Daniel Staal
--As off Saturday, January 10, 2004 3:40 PM +0100, Olivier Wirz is 
alleged to have said:

Hello,

What is the best way to convert a numeric cobol format S9(09)V9(04)
in a more readable way.
For example:

 0100} will be -1000.
 0100{ will be  1000.
It works with substr and =~, but may be there is a module or
another better way.
--As for the rest, it is mine.

Well, it seems the module Convert::IBM390 may be able to do this, but 
substr would probably be enough.

Actually, Convert::IBM390 seems to be a little too specific for this: 
it would expect the file to be mainframe packed.  A more general 
COBOL reading module might be nice; it would help people stuck 
maintaining that beast work in a language that is actually fun to 
work in.

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: Cobol format conversion

2004-01-10 Thread Daniel Staal
--As off Saturday, January 10, 2004 11:53 AM -0800, R. Joseph Newton 
is alleged to have said:

Olivier Wirz wrote:

Hello,

What is the best way to convert a numeric cobol format
S9(09)V9(04) in a more readable way.
How would we know?  This is a Perl list.  To some people here, the
string above may be meaningful.  To most, it is line noise.
Try:
That's a signed number, with 9 digits before the decimal point and 4 
after.

For example:

 0100} will be -1000.
 0100{ will be  1000.
Gazing way deep in my crystal ball, I'm going to intuit that those
left and right braces are a COBOL signed value indicators.  The
problem is that you haven't said this.
Close: their the filesystem signed value indicators unpacked numeric 
records for COBOL files.  Or at least this format of COBOL files.

It works with substr and =~, but may be there is a module or
another better way.
Search CPAN using COBOL as a keyword, maybe.  It will do little
good to move code out of COBOL, though, if you carry COBOL thinking
with you.  Presuming that you know what the significance of place
value operators, etc. are for COBOL, you could:
Read the COBOL output as strings, interpreting each string to its
numerical value by the sysntactic rules you are familiar with.
Output the numbers in Perl, since Perl's default output format is
generally the natural expression of any numerical value.
Which is exactly what he is trying to do.  In fact, it sounds like he 
already has a way to do it.  He's just asking if there is a *better* 
way.

Practice thinking in full concepts, expressed in full words.  You
will get more long-term mileage out of this step than any code
solution could possibly provide.
Joseph
He did.  He's asking for semi-high level advice here: what is the 
*best* way to do a particular conversion.  Anyone who can answer the 
question probably has done the conversion themselves, and would 
understand the few things he left unexplained.  Anyone who couldn't 
understand what he left unexplained would have no answer; they've 
never done it.  He explained enough to be clear, but not enough to be 
redundant.  (Though I would like to know what system he is getting 
the file from, it could be pertinent.)

A search of CPAN for COBOL doesn't turn up anything particularly 
promising, but that is occasionally the case.  Modules are sometimes 
hard to find, and may not be under the obvious-at-the-time keywords.

This is a common question class on this list.  I see it often: some 
question that the details of make little or no sense to me, but does 
to people who know what the poster is talking about.  The general 
population of the list may or may not be able to answer, but the 
poster is looking for those few who *can* answer.  They provide 
enough for someone who knows the problem space can answer, but don't 
bother to define everything because it would bore people, and not get 
any better answers.

There are a few of us here who will admit to knowing COBOL.  We can 
answer the question as asked.  For those who don't, Oliver can 
probably do as good a job of coding a conversion routine as they can.

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: == eq > gt

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 10:34 AM -0500, Paul Kraus is 
alleged to have said:

I understand that the eq and gt are for string comparisons but why
not just use the mathematical ones of == or >. This goes for
functions open ... or compared to open .. ||
--As for the rest, it is mine.

Because a string isn't a number.

Sure, you can treat a string as a number, or a series of numbers, 
based on the ASCII values.  But that leads to weirdness and 
confusion.

For example: The best numeric representation of a string is a 
_series_ of (ASCII/UTF8/etc) numbers.  The numeric comparison 
operators work on  one number on each side.  So, how do you convert a 
string to a single number?  Do you add the array together, or work on 
the first only, or something else?

Ok, so your next objection is that the operator should just know 
which you mean (numeric or string) and compare using the correct 
metric.  Except, on occasion, you _want_ to compare two strings as if 
they were numbers.  Perl will let you do that.  (Even if 'use 
warnings' will tell you not to.)

As for or vs ||...  That is more of a precedence issue at the moment. 
Note that open ... or would _not_ do the same as open ... ||: The 
latter would do the comparison before the open.  This could be 
useful: you could make the choice of what to open right then.  But it 
wouldn't be the open ... or die trick we all know and love: for that 
the open has to be tried first.

In conclusion, Perl has seeming duplicates often because they aren't 
duplicates, just near-duplicates.  Sure, the language could get by 
with just one.  It would just be more work for the programmers.

But why do the programmers want to work?

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: Emacs Wizards

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 8:29 AM -0800, drieux is alleged 
to have said:

Or if we are using our bbedit it is some
find and replace with grep using the selected
region only or in 
--As for the rest, it is mine.

Actually, in BBEdit it is Tools->Un/Comment.  No shortcut key by 
default, but you can assign one.

Sorry I can't help with EMacs...

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: strange sort order

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 6:23 PM -0500, danl001 is 
alleged to have said:

I'm thinking the way the file is sorted is something simple, yet
something I don't recgonize! As a result, you'll see that my method
is probably very over-complicated.
I have also posted some more data that is representative of what I
have to work with. Both the comparison function I'm using and the
sample data are attached if anyone wants to check it out. I
appreicate any suggestions.
--As for the rest, it is mine.

Quick question: is this data more representative than the data in the 
first email?  In particular, does set 4 from the first email actually 
exist, exactly as listed, anywhere?

If this latter data is more representative I'd bet on ASCIIbetical 
ordering: Compare each string one character at a time based on it's 
ASCII encoding, and stop the comparison at the first different 
character.  Don't think of numbers or punctuation as anything 
different, just handle them the same.

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: multiline matching

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 6:22 PM -0700, Jose Malacara is 
alleged to have said:

Can someone explain to me how to do multiline matching? I am trying
to extract three consecutive lines from a datafile containing
multiple records like this:
Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28


This is what I have so far, but it doesn't seem to work:

# !/usr/bin/perl -w
open FILE, "){
  if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
   print "Match found!\n";  # ideally, I want to print the the
lines found   }
}
close FILE;
But for some reason, it doesn't seem to like the (\n)'s in the
regex. Any help would be appreciated!
--As for the rest, it is mine.

You actually have two seperate problems here...  First off, you 
aren't reading more than one line at a time, since the readline 
operator stops at a newline.  Then, a regrex normally stops at a 
newline too, unless you specifically tell it to continue past those. 
( The 'm' operator, mentioned in other posts.)

The first problem is actually the bigger one: The obvious solution of 
reading the whole file to an array/scalar first has preformance 
problems, especially with large files.  (Worst case: A file bigger 
than avalible memory...)

Kent's solution neatly sidesteps that, if you don't care that the 
program has no idea of which records go together.  (His solution just 
prints each record line, assuming they are in the correct order 
already.)  Otherwise you are going to need some sort of temporary 
storage where you put the records back together, or read the file in 
chunks.

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: strange sort order

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 10:48 PM -0500, Dan is alleged 
to have said:

Oh no! Its slower! I wrote a function implementing what is
described above and its actually slower (about 1/2 as slow) than
that huge thing I posted earlier. Does anything stand out here as
being inefficient? Here it is:
(First glance stuff:)

sub compare {
 my $a = shift;
 my $b = shift;
If this is a 'real' sort operation this isn't necessary, and 
shouldn't even work.  Perl will do this for you.

 my $asciiDASH = 45;
 my $asciiDOT = 46;
These are legitimate constants.  Declare them as such, outside of the 
subroutine.  Then these assignments will only happen once, at compile 
time.  (Instead of _every_ time the sort calls this routine.)

 my @a = unpack("C*", $a);
 my @b = unpack("C*", $b);
This can also be done with a:
my @a = split //, $a;  # (That is a null pattern.)
I'm not sure if split or unpack is faster, I'll have to benchmark in 
the morning.

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: strange sort order

2004-01-15 Thread Daniel Staal
--As off Wednesday, January 14, 2004 11:24 PM -0500, Daniel Staal is 
alleged to have said:

 my @a = unpack("C*", $a);
 my @b = unpack("C*", $b);
This can also be done with a:
my @a = split //, $a;  # (That is a null pattern.)
I'm not sure if split or unpack is faster, I'll have to benchmark
in the morning.
--As for the rest, it is mine.

Well, my benchmarking skills need work, since the numbers never come 
out the same twice.  Suffice it to say, use whichever you feel is 
more clear: they seem to be about the same speed.

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]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Relative path

2004-01-19 Thread Daniel Staal
--As off Monday, January 19, 2004 5:50 PM +0100, Jan Eden is alleged 
to have said:

I imagine you could fix it by upgrading/reinstalling Perl, if
you're  interested.
Can I reinstall Perl (just Perl) from the OS X CDs?
--As for the rest, it is mine.

Yes, if you get the program Pacifist.  It can extract partial 
installs out of the general installers.

But I'd try a permissions repair first; it often fixes this sort of 
thing.

One other thing, perldoc is actually a part of the Developer Tools 
(eg, XCode) install, not the normal OS X install.  If you haven't 
installed that then that could be the problem.  (Perl itself is part 
of the base system, but you only need the docs if you are a 
developer.)

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: can i do it with perl ?

2004-01-23 Thread Daniel Staal
--As off Saturday, January 24, 2004 12:07 AM +0100, wolf blaum is 
alleged to have said:

I didnt find a way to do the dishes yet, anything else I ever tried
works in  perl.
--As for the rest, it is mine.

I'm sure you could do something with LEGO::RCX and a Mindstorms kit...
;-)
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: HTML reports via email

2004-01-26 Thread Daniel Staal
--As off Sunday, January 25, 2004 5:30 PM -0800, Paul Harwood is 
alleged to have said:

I am trying to learn the best way to send HTML formatted reports via
e-mail using the standard modules that come with Perl 5.8. The
examples I have seen  assign blocks of HTML code to scalars and
pass them to the NET::SMTP datasend() method etc. I was wondering
if there was a better, more efficient way of doing this (maybe
using filehandles?). The FORMAT command works ok for screen output
but I wanted to have things look fancier when I send the report via
email.
--Paul
--As for the rest, it is mine.

I'd probably use Mail::Sender, it can handle multipart email quite 
easily, either from a file or from a scalar. (And in 5.8 you can use 
a scalar as a file.)

The 'multipart' part of it of course means that you can send both a 
HTML part and a plain text part...

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: Can Perl run on Windows CE or Palm?

2004-01-27 Thread Daniel Staal
--As off Monday, January 26, 2004 9:05 PM +0800, Bee is alleged to 
have said:

1. Can Perl run on Windows CE or Palm (  Same as subject )
2. If I can, Is there any modules would helpful on develope my
script for these platforms ?
3. Can I use Perl to write the Hot Sync process instead of build in
progrm.
--As for the rest, it is mine.

I know that Perl cannot run on Palm.  (There just isn't enough memory 
available.)  A quick Google search turns up a couple promising WinCE 
links, so that appears to be at least minimally possible.

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: How to put a variable value into a text file

2004-01-30 Thread Daniel Staal
--As off Friday, January 30, 2004 7:57 AM -0500, 
[EMAIL PROTECTED] is alleged to have said:

Basically, I wanted to know how to put a receipient's name into a
canned  letter.  Like this.
$name = "Joe Blow"

The canned letter template:
--As for the rest, it is mine.

Has anyone pointed out Text::Template yet?

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: Timing out without alarm function

2004-02-03 Thread Daniel Staal
--As off Tuesday, February 3, 2004 10:09 AM -0700, Sam Masiello is 
alleged to have said:

I have a script where I am sending some data over a socket, but
after X seconds I want the operation to time out.  I am currently
using alarm to enforce the timeout, but I don't want the script to
die.  I want a way to be able to gracefully move onto a different
part of the script or return some value.
--As for the rest, it is mine.

What you need to do is catch the signal: perldoc perlipc

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]
 



[OT] Re: Script Kiddie issues

2004-02-07 Thread Daniel Staal
--As off Saturday, February 7, 2004 12:37 PM -0500, Wiggins d'Anconia 
is alleged to have said:

What is to stop a spammer or script kiddie finding out about your
ruse, possibly even listening in on the conversation, and rather
than trying to hack your system starts sending out mass emails to
people with a URL in it that directs them to your system and that
URL, all of a sudden your victims become his victims and he has
used you in a scheme to haunt the very users you wished to defend.
--As for the rest, it is mine.

Or, the more likely scenario: Launching his attack from a compromised 
computer in the first place.  (That is, the first attempt to contact 
you is from some poor computer that the script kiddie has already 
compromised.  Not their own computer.  Not even someone who knows 
they are running the script kiddie's software.)

After all, that is the normal way they work...

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: testing state of filehandle

2004-02-11 Thread Daniel Staal
--As off Wednesday, February 11, 2004 1:25 PM -0600, Michael C. Davis 
is alleged to have said:

At 07:22 PM 2/11/04 -, Rob Dixon wrote:
Please guys, not in an existing thread.
Not sure I undestand, looks like a new thread ... ?
--As for the rest, it is mine.

Erm, no.  Not to those of us with threaded mail clients: They 
recognize that your original message was in response to James' last 
message in the 'Re: Array containment' thread, and label it as such...

To create a new thread, click 'New Message' and paste/type the 
mailing list address into the 'To:' field.  Click 'Reply' only if you 
want to reply to that message.

It's a minor annoyance, really, but...

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: Searching through a directory.

2004-02-13 Thread Daniel Staal
--As of Friday, February 13, 2004 5:07 PM -0800, John Lin is alleged to 
have said:

for ($i=0; $i <= $#filenames; $i++) {
[EMAIL PROTECTED];
if ($wanted_filename == $filename) {
$append_filename=$filename . ';';
open(APPENDFILE, ">>/anotherdirectory/filename.txt");
print APPENDFILE $append_filename;
close(APPENDFILE);
}
}

But for some reason, the IF statement did not work.  In the filename.txt
file, I am getting something like this:
--As for the rest, it is mine.

I think you want:
if ($wanted_filename eq $filename)
That'll do a lexographic check instead of a numeric, which is what I think 
you want.

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: connecting to a mail server via IMAP

2004-02-17 Thread Daniel Staal
--As of Tuesday, February 17, 2004 4:17 PM +0200, John is alleged to have 
said:

Is it neseccary to authenticate the smtp host?
It depends on the host.  ;-)

testing the first sample script i saw no results.

Where is the problem?
We'll need more information than that...  I assume you were trying to mail 
to an address you can check, from an address you can check?  If it got 
through, there is no notification, and many errors would result in a bounce.

Otherwise, if we could see the code you tried we could help.

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: connecting to a mail server via IMAP

2004-02-17 Thread Daniel Staal
--As of Tuesday, February 17, 2004 4:58 PM +0200, John is alleged to have 
said:

Here is my code
Thanks.  ;-)

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

 use Mail::Sender;
 $sender = new Mail::Sender({smtp => 'mymailserver', from =>
'[EMAIL PROTECTED]'});
 $sender->MailFile({to => '[EMAIL PROTECTED]',
  subject => 'Here is the file',
  msg => "I'm sending you the list you wanted."});
john, john2 usernames exist on the mymailserver (it runs ESMTP Sendmail
8.9.3/8.9.3)
Well, you are missing a 'send' call; Mail::Sender has several you can 
choose from, depending on your needs.

By the way, as others pointed out Mail::Sender is very low-level.  I would 
suggest a higher level module here.  MIME::Lite is highly regarded, and 
often overlooked while searching...

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: connecting to a mail server via IMAP

2004-02-17 Thread Daniel Staal
--As of Tuesday, February 17, 2004 5:53 PM +0200, John is alleged to have 
said:

Unfortunately, MIME::Lite requires Sendmail on the host.
--As for the rest, it is mine.

Actually, no.  It just uses it by default...  You can say:
$msg->send('smtp');  #Uses the default smtp server.
or:
$msg->send('smtp', 'host.com'); #Uses host.com.
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: connecting to a mail server via IMAP

2004-02-17 Thread Daniel Staal
--As of Tuesday, February 17, 2004 7:42 PM +0200, John is alleged to have 
said:

Relaying denied.

What is that?
The sever doesn't allow you to connect to send mail through it.  (You can 
send mail *to* it, or *from* it, probably, but not *through* it.)

Could i connect to any smtp server i want.
Only if they let you.  Most these days don't let just anyone connect to 
them; if they did they would quickly attract every spammer around trying to 
use them.

You are either going to need to authenticate to a server, or find the 'end' 
server and call it correctly for a local mail delivery.

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: Why does this keep happening?

2004-02-17 Thread Daniel Staal
--As of Tuesday, February 17, 2004 5:28 PM -0500, Joel is alleged to have 
said:

I fixed the source code with the suggestions given, but still no luck. Any
other ideas?
Joel
---
# !usr/bin/perl
$abc=1000
Still need a semicolon... (and a 'my', for preference.)

until ($abc==0)
{
print "Counting down to 0 from $a\n";
$a--;
Don't you mean $abc instead of $a in the two lines above?

}
print "Blast off!";
With those fixed it runs as intended.

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: Could I put commands in a variable

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 2:22 PM -0500, Joel is alleged to have 
said:

Yes, BASIC is the only programming I have ever done. All I can really
remember was PRINT, GOTO, and a variety of line numbers. I'm trying to
write a text adventure (Don't look at me like that, Perl is a general
purpose language!).
I actually think Perl is perfect for this...

I'm getting tired of writing large chunks of code that I reuse the basic
structure of and wouldn't mind an easier solution. I'll go look up
subroutines, allthough GOTO does just fine for me.
Subroutines will make your life *much* easier, once you understand them. 
They make the control flow obvious (go to the subroutine, come back when 
done), and allow you to do things like return values.

Not to mention that they are shorter to type...

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: switch statement

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 10:14 PM +0100, Anthony Vanelverdinghe 
is alleged to have said:

Could anyone please tell me what's wrong with the following "program"?
The compiler gives errors in the switch statement.
--As for the rest, it is mine.

You mean, besides the fact that Perl doesn't have a switch statement?

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: switch statement

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 10:29 PM +0100, Anthony Vanelverdinghe 
is alleged to have said:

Didn't know it wasn't in Perl, but I've just discovered it's possible
with some file called "Switch.pm"
--As for the rest, it is mine.

You mean the 'Switch' module.  (Sorry, I should have mentioned it in my 
previous email.)

Sure, just include the line 'use Switch;' in the beginning of your program. 
I don't know the advantages/disadvantages of using it.

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: Could I put commands in a variable

2004-02-19 Thread Daniel Staal
--As of Thursday, February 19, 2004 6:31 PM -0500, Joel is alleged to have 
said:

Here it is. Okay so it isn't tommorow. I shortened it a bit, but its the
same really.
--As for the rest, it is mine.

Here's a first approximation of a rewrite. ;-)  (Major problem: it always 
asks what you want to do twice...)

This version keeps track of the state of the game, and uses that to guide 
the flow.  Note that I actually did put commands in a variable...

However, now each location you can go to is entirely independent of any 
other.

I'm sure this can be simplified.  It's just the first treatment I thought 
of.

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.
---#!/usr/bin/perl



use warnings;

use strict;



# Game strings.

my $dowhat="\nWhat will you do?\n";

my $bridge = "\nYou are on the bridge. There is a red light flashing on the main 
console.\nThere are doorways to the north, south, and west.\n";

my $bridge2 = "\nYou are on the bridge. You can see out the window that the ship has 
landed on an unknown planet.\nThere are doorways to the north, south and west\n\n";

my $engine = "\nYou are in the engineering room. There seems to be some smoke coming 
from\nan open panel.\nThere is a wall panel on the floor. The bridge is to the 
north.\n\n";

my $engine2 = "\nYou are in the engineering room. There seems to be smoke coming from 
an open panel.\nThe bridge is to the north\n\n";

my $engine3 = "\nYou are in engineering. The bridge is to the north\n\n";

my $crew = "\nYou enter the crew quarters. Of course, since the crew evacuated, you 
have them all to yourself. The bridge is to the south\n\n";

my $light = "\nThe light is labeled \"Smoke alert in engineering\"\n\n";

my $airlock2 = "\nYou are in the airlock. The ship has landed on a habitable planet, 
and\nyou may leave if you want to. The bridge is to the east\n";

my $airlock = "\nYou are in the airlock. You are currently travelling through 
hyperspace,\nand cannot leave the ship. The bridge is to the east\n";



# Game locations

my %places = (

BRIDGE  => \&bridge,

AIRLOCK => \&airlock,

ENGINE  => \&engine,

CREW=> \&crew,

);



# Game variables.

my %gamestate;



# Actually start the program.



# Main game loop.

my $playtime = 'y';

while ($playtime eq 'y')

{

# Game variables.

%gamestate = ( 

location=> 'BRIDGE',

plate   => 0,

lightbulb   => 0,

previous=> 'NONE',

command => 'NONE',

);



print qq(Welcome to "Spaceship"\n);

print "What is your name? \n\n";

print "My name is: ";

chomp ($gamestate{'name'}=<>);

print "Welcome to the bridge, $gamestate{'name'}\n\n", "Uh Oh, it looks like 
something is wrong. You will need to make an emergency\nlanding... If you can fix the 
ship first.\n\n";



while ($gamestate{'location'} ne 'WINNER')

{

$gamestate{'command'} = getcommand();

&{$places{"$gamestate{'location'}"}}();

}



print 'Play again? [y/n]';

chomp ($playtime=<>);

print "\n\n\n\n\n";

}   # End of game loop.



# End the game.

print "Exiting...";





#

# End of program.  Start of subroutines.

#



# Get a command.

sub getcommand {

print "$dowhat";

chomp (my $command = <>);

return $command;

}



# They're on the bridge.

sub bridge {

if ($gamestate{'previous'} ne 'BRIDGE') {

if ($gamestate{'lightbulb'} == 0) {

print "$bridge";

} else {

print "$bridge2";

}

}

$gamestate{'previous'} = $gamestate{'location'};

if ($gamestate{'command'} eq "examine light") {

print $light;

} elsif ($gamestate{'command'} eq "north") {

$gamestate{'location'} = 'CREW';

} if ($gamestate{'command'} eq "west") {

$gamestate{'location'} = 'AIRLOCK';

} elsif ($gamestate{'command'} eq "look") {

if ($gamestate{'lightbulb'} == 0) {

print "$bridge";

} else {

print "$bridge2";

}

} elsif ($gamestate{'command'} eq "south") {

$gamestate{'location'} = 'ENGINE';

}

}



# They're in the airlock.

sub airlock {


Re: Could I put commands in a variable

2004-02-20 Thread Daniel Staal
--As of Friday, February 20, 2004 11:25 AM +, Rob Dixon is alleged to 
have said:

I haven't looked at your code, but I don't think a rewrite is in the
spirit of helping beginners at Perl. It may occasionally be the best
answer, but I suspect you're simply enjoying yourself here ;)
--As for the rest, it is mine.

Well, it's not a from-scratch rewrite.  Mostly it's his code: I just took 
each section he had GOTO labeled, turned it into a subroutine, then handled 
some namespace issues (created by having separate namespaces), and added a 
wrapper calling loop.

As for enjoying myself, guilty as charged. ;-)

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: Could I put commands in a variable

2004-02-20 Thread Daniel Staal
--As of Friday, February 20, 2004 8:35 AM -0800, R. Joseph Newton is 
alleged to have said:

I don't know about this Daniel.  Even for all its goto's, I found the
original more reaable.
I actually found his code quite readable, and felt I lost some of that.  I 
felt it a tradeoff worth making at this stage, but I didn't like it.

I think Joel needs to understand that Perl function calls need no extra
verbs, and that closing braces should align vertical with the beginning
of the line that opens the block, but otherwise his code is very nice and
tight.
Agreed.

 In particular, I feel that the insertion of gratuitous blank lines
detracts from the overall readability.
Most of those were inserted by my email program... (My copy has very few 
blank lines.)  Sorry.

If anything, I would have modified those assignments by breaking the
lines, using the concatenation operator, to bring the whole assignment
statement into view.
I thought about that.  In the end, I just didn't want to do the work.  ;-)

Joel's code was very nice.  The advantage I believe my version has is 
scalabilty: you can add rooms and variable tracking without touching 
anything.  For that matter, a 'save' function would be trivial in my 
version, while it would be extremely difficult in his.  (Mine can even do a 
general 'teleport' quite easily...)  Also, since the input is centralized 
you can put in much better (and more uniform!) validation of input.

For a four-room spaceship I would probably prefer Joel's code.  For a six 
or seven hundred room environment I would prefer mine.  I was trying to 
come up with a good subroutine-based code that offered a real advantage 
over his code.  (I could have just replaced GOTOs with subs, but there was 
no compelling value in that.)

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: random number between x and y

2003-09-20 Thread Daniel Staal
--On Saturday, September 20, 2003 20:58 +0100 dan 
<[EMAIL PROTECTED]> wrote:

how is it possible to get a random number between x and y? in know
int(rand(10)) returns an integer between 0 and 9, but how do i get
it so that i can get a random integer say between 5 and 10
inclusive?
How about:

$num = int(rand(6)) + 5;

or generalized:

$num = int(rand(($max - $min) + 1)) + $min;

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: Perl Vs ...

2003-09-21 Thread Daniel Staal
--On Sunday, September 21, 2003 21:28 -0400 Paul Kraus 
<[EMAIL PROTECTED]> wrote:

Perl was pretty much my first language. Not counting Business Basic
and same old Pascal from high school. The more I learn the more I
see that perl can handle just about anything I want to do. How do
you go about deciding if you should use another tool such as C++
over perl? I am thinking about learning another language and trying
to decide what language would be best to learn. To expand my skill
set. Suggestions, Ideas, Book Recommendations?
It would really depend on why you want another language.  Each is 
good at some things.  C/C++ (I learned them as one, so that is how I 
think of them) is good for optimized code (either for size or speed). 
Higher level languages are good for quick development and mockups.

Also, what platform you plan to be using could make some difference: 
Windows is pushing C#, Macintosh Objective-C, and Unix/Linux 
traditionally uses bare C, so if you wanted to develop for a 
particular platform you might choose to learn the language that has 
the best tools for it.

Looking over what I'm writing, I'm starting to think that if you 
don't know it learning C would probably be a good idea, for the 
simple reason that it seems to be a baseline language at the moment, 
with lots of other languages being derivatives of it.

At the moment, as a new learner, I would say only times when I would 
want to use C over Perl would be when I really need speed.  I do like 
to play in REALBasic (a Visual Basic clone for Mac), just for the 
speed in which I can create a full featured GUI app.  (Though I 
haven't had a chance to tackle that in Perl yet.)

On the other hand, if the reason you want to learn a new language is 
to learn about programming, then I would suggest learning some weird 
language that has as little to do with the rest as possible.  (Or 
take some idea to the extreme.)  Something like Forth, Smalltalk, 
Fortran, or LISP could be a good way to learn to think about 
programming differently.  (Heck, you could try Brainfuck, Befunge, or 
INTERCAL if you are *really* ambitious.)

Or you could go the 'web developer' route and learn things like PHP 
or ASP, which you could really do in completely in Perl, but 
occasionally are useful on their own...

Ok, I'm rambling at this point.  Time to stop.

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: perl(this) and perl(the)

2003-09-22 Thread Daniel Staal
--On Monday, September 22, 2003 19:23 +0100 Rob Dixon 
<[EMAIL PROTECTED]> wrote:

I'm playing away here, as I know nothing about RPM other than
that it is a package manager and pro9bably specific to RedHat
Linux.
Having said that, it looks like you are trying to install a
module called MySQL::client, which I've never heard of and
isn't available on the definitive CPAN site.
Unless you have a reason to go along this route (when I think
you will need Linux-specific help) you should use the Database
Independent interface module 'DBI' together with the MySQL
driver module 'DBD::MySQL', with which most Perl database
programmers are familiar.
You've got Perl on the brain.  ;-)  An RPM doesn't have to be a Perl 
module.  What he's trying to do is install a database client (like 
you would write using the DBI) program (MySQL-client-4.0.15-0) that 
happens to depend on Perl.  (Presumably it is partially written in 
Perl, maybe using the DBI.)  The install is complaining that Perl is 
not installed.

I missed the original question, but I would echo the advice to use 
your distro's help resources to fix this, assuming you are sure Perl 
is installed.

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: Help needed on Telnet.pm

2003-09-22 Thread Daniel Staal


--On Tuesday, September 23, 2003 0:02 +0530 Pandey Rajeev-A19514 
<[EMAIL PROTECTED]> wrote:

Does Telnet.pm capture output from other than the STDOUT ?

I have a case where I telnet to a router through a console
connection. All commands work well and returns the output.  But,
there is a special command that turns on the monitoring system of
that machine. So some text keep on scrolling (text that appear even
without issuing any user command). Such texts are not captured by
telnet module.
I am not doing any mistake in setting the prompt.

In expect language, I am able to capture the scrolling text but not
in Telnet.pm.
Sounds like Telnet.pm only captures from STDOUT.  You are turning on 
error messages, and they are getting written to STDERR.  You'll have 
to combine them.  If the router you are connecting to is Unix-like 
you should be able to add '2>&1' to the end of the prompt and have 
STDERR written to STDOUT.

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: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Daniel Staal
--As of Saturday, March 27, 2004 10:17 AM -0500, WC -Sx- Jones is alleged 
to have said:


Also, all of these $:: are brought into GLOBAL
usage (which some programmers frown upon much
like GOTO syntax is frowned upon.)
--As for the rest, it is mine.

They why aren't you just leaving off warnings and using varibles without 
declaring them first?  It would be less typing, and get you the same thing 
in the end.  (Or you could turn off the warnings just for that declaration, 
which is more typing for an infrequent variable but cleaner.)

The point of 'my' is to help the programmer manage scope issues, not to 
evade warnings.  This is not to say all variables need to be 'my' scoped, 
but if they aren't it is probably best to just say why they aren't.

Daniel T. Staal

(Note: I like the How-Tos idea, just question the validity of this one in 
particular.)

---
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: Project Advice Wanted

2004-03-30 Thread Daniel Staal
--As of Tuesday, March 30, 2004 10:59 AM -0500, Steve Gross is alleged to 
have said:

1) Any good Perl/other tool to create screens/web pages?
2) any recommended database interfaces?  I've use ODBC and would like
to make it general enough to handle a wide variety of conventional
databases - SQL Server, Access, Oracle, MySQL.
3) Any Perl code template systems out there?
--As for the rest, it is mine.

I see you developing a close friendship with
http://search.cpan.org/ in your near future...
1) Sure.  Check out HTML::Template, HTML::Stream, and generally the rest of 
the the HTML::* modules.

2) You want the DBI module, and its assorted submodules...

3) I think you are looking for HTML::Template here, but otherwise there is 
Text::Template, ZM::Template, Apache::Template...

Check out http://search.cpan.org/ for more details on all of the above 
modules.  ;-)

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: using strict

2004-04-01 Thread Daniel Staal
--As of Thursday, April 1, 2004 5:01 PM -0500, [EMAIL PROTECTED] is 
alleged to have said:


what is a soft reference?
what is a bareword?
why is strict disallowing a compile here When I comment out strict
the  syntax checks outs as ok!???
how do I display each element # with its corresponding data line, b/c I
only want certain elements printed out?
I'll leave these to some Guru who knows what he is talking about, but I 
think I can say why strict is disallowing a compile...

thank you!

# Set pragma

use strict;
use warnings;   #It just makes things easier...
   #Use always, or nearly.
use diagnostics;#It answers questions...
   #Use until comfortable that you know
   #what it will tell you.
&tsm_critical_servers;

# Declare sub

sub tsm_critical_servers {

my $crout="/tmp/critical_servers.out";

# Make system call for data gathering

system ("dsmadmc -id=menu -password=xx 'q event * *
begind=-1 begint=15:30 endd=today endtime=now' > $crout");
# Create array and read in each line as a seperate element

open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
while ( defined($line = ) ) {
Right here.  You've never told the compiler what $line is before.  'strict' 
doesn't like that, though it is technically legal Perl.

Make that:
 my $line;
 while ( defined($line = ) ) {
chomp ($line);
my @tsm = ;
foreach $_ (@tsm) {
print $_;
}
}
close (CRITICALSERVERS);
}
I think that will get you going.

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: Strings with extended characters

2004-04-01 Thread Daniel Staal
--As of Thursday, April 1, 2004 9:58 AM -0500, [EMAIL PROTECTED] is 
alleged to have said:

Is there a simple way to reject any string that has extended characters
in  it? In other words, only accept the 88 (I think it's 88) regular
keyboard  characters and numbers. I can't find a simple way to do this.
--As for the rest, it is mine.

I'm sure there is a smart way, but here's a dumb idea:

my @characters = unpack('U*', $string);
for @characters {
   if $_ > $max_Char_Value {
   # Do something
   } else
   # Do something else.
   }
}
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: How to determine if STDIN has piped data?

2004-04-02 Thread Daniel Staal
--As of Thursday, April 1, 2004 11:48 AM +0159, Morten Liebach is alleged 
to have said:

Strangely, I find that we almost always want our scripts to act this way.
If any files or data is passed to the script, then it uses it.
Otherwise, it prints usage instructions (since we'd rather not have man
pages for scripts, and I don't know how to build them anyway).
Use POD.  See 'perldoc perlpod' for all the details.

Then the user can just run 'perldoc scriptname' (provided 'scriptname'
is in $PATH) and get a nicely formatted manpage.
--As for the rest, it is mine.

Even better: you can run pod2man on the program/pod file, and end up with a 
man page.  Put that in the standard man search path and the user can type 
"man $scriptname" as if it were any other unix program.

This if you don't mind man pages for scripts...  (Which you said you don't 
want, but now you can't say you don't know how to build them.)

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]
 



  1   2   >