[25608] in Perl-Users-Digest
Perl-Users Digest, Issue: 7852 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 3 21:05:31 2005
Date: Thu, 3 Mar 2005 18:05:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 3 Mar 2005 Volume: 10 Number: 7852
Today's topics:
Re: @_ uninitialized value <emschwar@pobox.com>
Re: @_ uninitialized value mbosogrp@gmail.com
ANNOUNCE: CGI::ContactForm 1.30 released to CPAN <noreply@gunnar.cc>
Re: clpannounce problem <noreply@gunnar.cc>
Re: clpannounce problem <abigail@abigail.nl>
Re: disagree with a few things in perlsec <matternc@comcast.net>
Re: disagree with a few things in perlsec <tadmc@augustmail.com>
Re: disagree with a few things in perlsec <tadmc@augustmail.com>
Re: disagree with a few things in perlsec <tadmc@augustmail.com>
Re: disagree with a few things in perlsec el_roachmeister@yahoo.com
Re: disagree with a few things in perlsec el_roachmeister@yahoo.com
Re: How to specify [regex] beginning of line/unlimited <jgibson@mail.arc.nasa.gov>
Re: How to specify [regex] beginning of line/unlimited <ljames@apollo3.com>
Re: How to specify [regex] beginning of line/unlimited <tadmc@augustmail.com>
Re: How to specify [regex] beginning of line/unlimited <ljames@apollo3.com>
Re: How to specify [regex] beginning of line/unlimited <jkeen_via_google@yahoo.com>
Re: Iterated mega file upload - invented wheel wanted <juglesh@nospamRadioKDUG.com>
Log::Agent in ActivePerl Windows? <nospam@nospam.com>
Re: mod_perl hosting <ljames@apollo3.com>
Re: Pure Perl OpenSSL Library <No_4@dsl.pipex.com>
RTF::Text::Converter stov753@aol.com
signal handling and returning <alex_the_hart@yahoo.com>
Subroutine Function (nicolas-laurent)
Re: Subroutine Function <jkeen_via_google@yahoo.com>
Re: UltraEdit? <jussij@zeusedit.com>
Re: UltraEdit? <stan@surecann.com>
Re: WikiConverter <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 03 Mar 2005 16:14:07 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: @_ uninitialized value
Message-Id: <etooee02ugw.fsf@wilson.emschwar>
mbosogrp@gmail.com writes:
> Thank you for the reply. You've been extremely helpful. That link will
> come in very handy. Up till now I've been using painfully incomplete
> perl gtk2 documentation. It left a lot to be desired. That link is a
> breath of fresh air.
Next time, it would really help if you quoted a bit of context here.
I am tangentially interested in this thread, as I have an idea for a
GTK+ app I'd like to write in Perl, but I have no idea what link
you're referring to.
Not everybody gets all the articles at the same time in USENET, you
know.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: 3 Mar 2005 17:11:54 -0800
From: mbosogrp@gmail.com
Subject: Re: @_ uninitialized value
Message-Id: <1109898714.811960.178380@z14g2000cwz.googlegroups.com>
>Next time, it would really help if you quoted a bit of context here.
>I am tangentially interested in this thread, as I have an idea for a
>GTK+ app I'd like to write in Perl, but I have no idea what link
>you're referring to.
Point taken. Here's a link to the documentation I was referring to.
http://developer.gnome.org/doc/API/2.0/gtk/GtkTextBuffer.html
Mboso
------------------------------
Date: Fri, 04 Mar 2005 01:41:17 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: ANNOUNCE: CGI::ContactForm 1.30 released to CPAN
Message-Id: <38ppdeF5s0ceoU1@individual.net>
CGI::ContactForm is a module for generating web contact forms. It lets
you create an unlimited number of forms with a minimum of effort, and
makes it possible for e.g. web hosting providers to offer their
customers an easy way to set up a contact form.
Version 1.30 does only require one other non-standard Perl module:
Mail::Sender. The code for email validation has been changed to better
conform with RFC 822.
http://search.cpan.org/src/GUNNAR/CGI-ContactForm-1.30/readme.html
Enjoy!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
------------------------------
Date: Fri, 04 Mar 2005 01:42:54 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: clpannounce problem
Message-Id: <38ppgfF5s0ceoU2@individual.net>
At Feb 22 Gunnar Hjalmarsson wrote:
> brian d foy wrote:
>> Gunnar Hjalmarsson wrote:
>>> More than a week ago I posted an announcement of a CPAN module
>>> release to clpannounce. I've reposted twice, but it has not
>>> showed up (while other posts have). Since I believe that Randal
>>> is a moderator of that group, I also wrote him (twice), but no
>>> response (yet).
>>>
>>> I have a feeling that the fact that I posted from my
>>> noreply@gunnar.cc address (which I don't read) might have
>>> something to do with it, but OTOH I have successfully posted
>>> similar announcements from that address previously.
>>>
>>> Could somebody please enlighten me on what's involved to get a
>>> post through on clpannounce? If this would not be an appropriate
>>> place to bring up this issue, I'd appreciate a pointer about what
>>> to do instead.
>>
>> Randal has to approve it, but you have to get your email past his
>> spam filters. You should use a real email address that he can
>> respond to.
>
> Thanks for your reply. I received a private message from Randal,
> which basically told me the same, so hopefully my fourth post will
> now make it. :)
The fourth post did not make it, neither did the fifth or sixth post. At
this time I'm frustrated and disappointed at Randal's ignoring of my
requests that he either approves it or at least lets me know the reason
why he doesn't.
For you to better understand the absurd in this situation, below follow
the private messages that have been exchanged between Randal and me
since I asked for advice here:
<'STORY'>
RS (Feb 22)
It wasn't obvious from your post that you also had the code in the
CPAN, and when I hit reply to your CLPA post, I see that it's
a non-address.
I do not approve non-address postings in CLPA. You must be willing
to answer email sent to the address in your FROM: line for a CLPA
posting to be approved. If I approved prior email that does not meet
that rule, it was my error.
GH (Feb 22)
Thanks for your reply.
Okay, you're the boss, your rules. :) I have temporarily disabled the
autoresponder for my noreply@gunnar.cc address, and posted a fourth
time, making it obvious that CGI::ContactForm is a CPAN module. Please
approve it this time.
RS (Feb 22)
I don't understand "temporarily" in that sentence.
Why aren't you posting from "XXXXXX@XXXXXXX", since that's obviously
you?
GH (Feb 22)
Because of spam, of course. I'm using the noreply@gunnar.cc address on
Usenet and other public forums where non-obfuscated email addresses are
retained in archived messages. That's why I include a link to a contact
form in the sig.
RS (Feb 22)
But if that's not an address you read on a regular basis, it's not your
address, and I have a policy on no obfuscated addresses in CLPA.
GH (Feb 22)
I just read the policy; just posted it to clpmisc, btw. Why are you
enforcing a literal application of it when I provide an easy way to
contact me? Are you paid by the spammers? ;-)
Anyway, I just created the address clpa@gunnar.cc, and posted my
announcement from that address (the fifth post).
[RS silent while approving other announcement at CLPA]
GH (Feb 23)
What are you waiting for now?
[RS silent while approving yet another announcement]
GH (Feb 27)
Almost two weeks have passed since I first tried to announce my module
release at CLPA. The latest attempt, posted from a working email
address, was made last Tuesday, but it hasn't been approved yet, while
other announcements have.
Can you please approve my latest post, or let me know why you do not.
[GH made a sixth post - after all RS *might* have discarded the fifth
one by mistake...]
[RS silent; no approval]
</'STORY'>
My patience is now exhausted, so I just crossposted my announcement to
three un- or self-moderated groups instead, including this one.
I have no idea how 'the inner circle' of the Perl community works, but
to me it seems as if it's time for Randal to be replaced as the
moderator of CLPA.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 04 Mar 2005 01:07:20 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: clpannounce problem
Message-Id: <slrnd2fd68.v9v.abigail@alexandra.abigail.nl>
Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on MMMMCCIII September
MCMXCIII in <URL:news:38ppgfF5s0ceoU2@individual.net>:
][
][ I have no idea how 'the inner circle' of the Perl community works, but
][ to me it seems as if it's time for Randal to be replaced as the
][ moderator of CLPA.
I don't think there's an "inner circle", but noone I know actually
pays attention to clpa. I don't think anything serious gets posted
on clpa that isn't posted on at least half a dozen other Perl forums.
I ignore everything that smells like a cabal. clpa, clp.moderated and
modules@cpan.org, to name a few.
Personally, I wouldn't announce CPAN modules - there are thousands of
them, and if anyone would announce a new release, it just becomes a blur.
If there's something worthwhile to announce, I'd use clp.misc, use.perl.org,
Perlmonks and/or appropriate mailingslist.
Oh, and if you really want to hear about new CPAN modules, there are
mailinglists that announce new releases.
Abigail
--
perl -we '$| = 1; $_ = "Just another Perl Hacker\n"; print
substr $_ => 0, 1 => "" while $_ && sleep 1 => 1'
------------------------------
Date: Thu, 03 Mar 2005 18:38:01 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: disagree with a few things in perlsec
Message-Id: <b-udnYjAsIREArrfRVn-vw@comcast.com>
el_roachmeister@yahoo.com wrote:
>
> A. Sinan Unur wrote:
>> el_roachmeister@yahoo.com wrote in news:1109882174.262420.288990
>> @g14g2000cwa.googlegroups.com:
>>
>> > The convenience store in the bad neighborhood will always get
> robbed
>> > day in and day out, while the billions of dollars sitting in bank
>> > accounts that nobody knows exists will remain untouched.
>>
>> This is as bad an analogy as I have ever heard. The reason bank
> accounts is
>> not being robbed is not because nobody knows where the bank is or
> that the
>> bank has accounts, but because of security mechanisms that assume
> people
>> know the location of the bank and the money.
>
> I do not have hard facts to prove the analogy true so consider this
> case. A wealthy person hides a treasure on an island. The probability
> of it being found is proportional to the number of people that know
> about it. Therefore the security measures to secure the treasure are
> proportional to the number of people who know it exists. This the
> principle I am trying to get accross, which perhaps my analogy did not
> do a good job illustrating.
And how many wealthy people do you know who keep their valuables in
secret locations on deserted islands, as opposed to those who
keep them in a safe deposit box in a bank, where *everyone* knows
valuables are kept?
>
> If I understand your point correctly you say the probability is the
> same regardless of the number of "pirates" who know your treasure
> exists. According to you the probability of it being found is only
> based on the type of lock the wealthy person put on the treasure when
> they buried it. Is that correct?
No, his point is that it is very difficult to regulate how many
"pirates" know about your treasure, and that it is very difficult
to keep "pirates" from finding out about your treasure. Therefore
security measures that depend on nobody knowing where you stashed
the loot should be, at best, secondary measures to the *real* security.
>
> Relating this to perslec, someone may code the most secure script and
> think their script is great because it has all the best built-in
> security measures. One needs to use common sense to minimize the risk
> of breaking into your script from multiple entry points. That's exactly
> how hackers operate. They know great programmers write great scripts,
> but that is their weakness, since they only focus on the script and not
> the enviroment it is placed in.
But what you're proposing is stashing the script away where it can't
be run. It's not very useful that way. If it's a script for use
on the system, it needs to be accessible to the people who use it
(You're the *only* person who uses it? It's not a very useful
script, then.) If it's a CGI script, it can't be runnable only
by your userid, because the webserver won't run it under your
userid--or if the webserver *is* running CGI scripts under your
userid, then you have bigger security issues to worry about.
And what have you gained? Unless it's a set-id script, the
other user can't do anything with the script that he couldn't
do from the command line. It just doesn't make much sense
95% of the time.
>
>> But, then, your posting history does tell us something:
>>
>> http://tinyurl.com/5nzcp
>
> Is referencing this really neccessarry?
Probably not; the link is dead, so we can't find out what the Perl
advice Sinan thought was amusing was.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Thu, 3 Mar 2005 18:04:08 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: disagree with a few things in perlsec
Message-Id: <slrnd2f9fo.3p8.tadmc@magna.augustmail.com>
el_roachmeister@yahoo.com <el_roachmeister@yahoo.com> wrote:
> I disagree with a few things in perlsec relating to "Protecting your
> program", namely these two paragraphs:
>
> First of all, however, you can't take away read permission, because the
> source code has to be readable in order to be compiled and interpreted.
> (That doesn't mean that a CGI script's source is readable by people on
> the web, though.) So you have to leave the permissions at the socially
> friendly 0755 level. This lets people on your local system only see
> your source.
>
> Some people mistakenly regard this as a security problem. If your
> program does insecure things, and relies on people not knowing how to
> exploit those insecurities, it is not secure. It is often possible for
> someone to determine the insecure things and exploit them without
> viewing the source. Security through obscurity, the name for hiding
> your bugs instead of fixing them, is little security indeed.
>=======================================
>
> If you are concerned about security you why are you going to let people
> on your local system see your source?
Because if it is properly secured, then it won't matter if they see it.
> Security is not a black and white issue. No script on this planet is
> 100% secure. It is all about reducing your probablity of being hacked.
> Security by obscurity is very helpful in reducing your risks. The
> perlsec makes it sounds like it has no effect on protecting it.
Because it is not "protected" by obscurity.
Obscurity only reduces the odds, it is still not "protected" it
is merely "hidden" (which might be Good Enough in some situations).
If you had said "reducing the risks" instead of "protecting" you
would have been on safer ground.
"protected" has a much strong meaning than "hidden" does.
> I
> suggest perslec either eliminate any comments about security by
> obscurity since that really has nothing to do with perl anyways. Or
> they should be more realistic about what it really means.
Got a patch for review?
Don't have one, I didnt think so.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Mar 2005 18:27:13 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: disagree with a few things in perlsec
Message-Id: <slrnd2far1.3ve.tadmc@magna.augustmail.com>
Chris Mattern <matternc@comcast.net> wrote:
> el_roachmeister@yahoo.com wrote:
>> A. Sinan Unur wrote:
>>> el_roachmeister@yahoo.com wrote in news:1109882174.262420.288990
>>> @g14g2000cwa.googlegroups.com:
>>> But, then, your posting history does tell us something:
>>>
>>> http://tinyurl.com/5nzcp
>>
>> Is referencing this really neccessarry?
>
> Probably not; the link is dead, so we can't find out what the Perl
> advice Sinan thought was amusing was.
Message-ID: <5d705481.0410241000.649a77e1@posting.google.com>
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Mar 2005 18:27:52 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: disagree with a few things in perlsec
Message-Id: <slrnd2fas8.3ve.tadmc@magna.augustmail.com>
el_roachmeister@yahoo.com <el_roachmeister@yahoo.com> wrote:
> A. Sinan Unur wrote:
>> el_roachmeister@yahoo.com wrote in news:1109882174.262420.288990
>> @g14g2000cwa.googlegroups.com:
>> But, then, your posting history does tell us something:
>>
>> http://tinyurl.com/5nzcp
>
> Is referencing this really neccessarry?
You make your reputation, and then you live with the reputation you've made.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Mar 2005 16:53:44 -0800
From: el_roachmeister@yahoo.com
Subject: Re: disagree with a few things in perlsec
Message-Id: <1109897623.993474.163760@g14g2000cwa.googlegroups.com>
Tad McClellan wrote:
> Because it is not "protected" by obscurity.
>
> Obscurity only reduces the odds, it is still not "protected" it
> is merely "hidden" (which might be Good Enough in some situations).
Dictionary
pro=C2=B7tect (pr=C9=99-t=C4=95kt') pronunciation
tr.v., -tect=C2=B7ed, -tect=C2=B7ing, -tects.
1. To keep from being damaged, attacked, stolen, or injured; guard
Obscurity accomplishes this, therefore obscurity protects.
------------------------------
Date: 3 Mar 2005 17:04:34 -0800
From: el_roachmeister@yahoo.com
Subject: Re: disagree with a few things in perlsec
Message-Id: <1109898274.271363.17950@l41g2000cwc.googlegroups.com>
The more obscure you make your script, the fewer the number of pirates
who can find it. The fewer the number of pirates means the less chance
of one of them cracking it. I really don't see what is wrong in this
logic?
Whether obscurity is the primary or secondary way to secure your code
entirely depends on the situation. In majority of cases it will not be
the best way to secure it, but any script that is secure is only one
way is very not secure at all. This is where I feel perslec needs to
either eliminate the reference to obscurity or give it the proper
credit it is due in the greater scheme of things.
------------------------------
Date: Thu, 03 Mar 2005 15:15:05 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: How to specify [regex] beginning of line/unlimited characters/no spaces terminatingn with ":"
Message-Id: <030320051515057858%jgibson@mail.arc.nasa.gov>
In article <1109885401.403847.38770@o13g2000cwo.googlegroups.com>, Jim
Keenan <jkeen_via_google@yahoo.com> wrote:
> L. D. James wrote:
[data sample snipped]
> > #!/usr/bin/perl
> > $/ =
> >
>
> use strict;
> use warnings;
>
>
> "*****************************************************************************
> **\n";
> > open (FILE,"../confirmation.txt");
> > @lines = <FILE>;
> > $numrecords = @lines;
> > print "There are $numrecords\n";
> > foreach $l (@lines)
>
> perldoc -f chomp
>
> > {
> > $sep = '\w+:';
> > @REC = split(/$sep/,$l);
>
> This is probably better handled with a full regular expression rather
> than 'split'; see below. Specifically, you should consult the
> documentation (or the Camel book) re: non-greedy pattern matching.
Except that non-greedy pattern matching is not needed in this
particular case (see below).
>
> Here is a starting point. It doesn't attempt to solve all your
> problems, e.g., I leave the Comment line for you to figure out.
>
> Jim Keenan
>
> ###########
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Data::Dumper;
>
> my %individual;
>
> while (<DATA>) {
> chomp;
> if (/^(\w+?):\s+(.*)/) {
I think that the '?' is unnecessary in this case because \w will not
match a colon. Therefore, a simple (\w+) will stop when it encounters
the first colon and need not be set to non-greedy. You can also use
([^:]+) to extract the key if it will include any non-\w characters.
> my $key = $1;
> my $value = $2;
> $individual{$key} = $value;
> } else {
> print "Non-matching line: $_\n";
> }
> }
> print Dumper(\%individual);
>
>
> __DATA__
> MessageType: Signup
> Questions:
> Username: L. D. James
> UserEmail: lja...@apollo3.com
> UserTel: 555-555-555
> UserFax: 222-222-222
> AccountNumber: 123
> ContactRequested: ContactRequested
> Date: 24 Feb 2005
> Time: 10:21:36
> Comments: This is a unique comment.
> The comment is continuing. All the rest of the
> text is part of the comment field.
>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: Thu, 3 Mar 2005 19:08:59 -0500
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: How to specify [regex] beginning of line/unlimited characters/no spaces terminatingn with ":"
Message-Id: <112f9p72364jg30@corp.supernews.com>
"Jim Keenan" <jkeen_via_google@yahoo.com> wrote in message
news:1109885401.403847.38770@o13g2000cwo.googlegroups.com...
> L. D. James wrote:
>
> "*******************************************************************************\n";
>> open (FILE,"../confirmation.txt");
>> @lines = <FILE>;
>> $numrecords = @lines;
>> print "There are $numrecords\n";
>> foreach $l (@lines)
>
> perldoc -f chomp
Thank, Jim. I did the refresher. I'm also starting a new habit of
using: use Strict; and use warnings;. It's showing the flaws in much of my
code. It's giving me good dicipline... helping me to the habit of writing
cleaner scripts.
By the way, I can't believe i forgot the first line of the data sample.
It's a bunch of stars "*". I'm sure this might affect the example you might
have shown. That was the reason for the first line in my example code: $/ =
"******...".
Sample Data:
--------------------------------------------------
***********************************************
MessageType: Signup
Questions:
Username: L. D. James
UserEmail: ljames@apollo3.com
UserTel: 555-555-555
UserFax: 222-222-222
AccountNumber: 123
ContactRequested: ContactRequested
Date: 24 Feb 2005
Time: 10:21:36
Comments: This is a unique comment.
The comment is continuing. All the rest of the
text is part of the comment field.
> This is probably better handled with a full regular expression rather
> than 'split'; see below. Specifically, you should consult the
> documentation (or the Camel book) re: non-greedy pattern matching.
>
> Here is a starting point. It doesn't attempt to solve all your
> problems, e.g., I leave the Comment line for you to figure out.
Thanks, I'll look to order the book since I'm very interested in
regular expressions. I do have a number of older books that were written in
the late 80's. I'm sure after 20 years it's about time to add to my
library, though I do most all my reading online.
My sloppy code worked fairly, except for the fact it striped the colon
":" from anywhere it appeared. And it failed on the field.
Is it possible that using the stars "*" for the record separator rather
than the new line would make it easier to grab the comment field, which has
numerous new lines?
-- L. James
--
--------------------------------
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames
------------------------------
Date: Thu, 3 Mar 2005 17:54:35 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to specify [regex] beginning of line/unlimited characters/no spaces terminatingn with ":"
Message-Id: <slrnd2f8tq.3p8.tadmc@magna.augustmail.com>
L. D. James <ljames@apollo3.com> wrote:
> Data File:
There is a way to include the data file in your program file,
as suggested in the Posting Guidelines.
> #!/usr/bin/perl
use warnings;
use strict;
As suggested in the Posting Guidelines.
> $/ =
> "*******************************************************************************\n";
Yuk!
You have to get finger prints on the screen to count how many
asterisks there are supposed to be:
local $/ = '*' x 80 . "\n";
> open (FILE,"../confirmation.txt");
You should always, yes *always*, check the return value from open():
open (FILE, '../confirmation.txt') or
die "could not open '../confirmation.txt' $!";
You should use single quotes unless you are going to make use of
one of the two extra things that double quotes give you.
Whitespace is not a scarce resource, feel free to use as much of
it as you like to help make your code easier to read.
> @lines = <FILE>;
That is a misleading choice of name since what is stored in the
array is not lines, but (multiline) records.
> $numrecords = @lines;
> print "There are $numrecords\n";
> foreach $l (@lines)
You should choose meaningful variable names, single character names
are a red flag.
foreach my $line ( @lines )
> {
> $sep = '\w+:';
> @REC = split(/$sep/,$l);
That is a misleading choice of name since what is stored in the
array is not records, but fields (or lines).
There is no need to put the pattern into a variable first, why
are you doing that?
Why are you SHOUTING with the array's name?
> I believe the problem is that I'm trying to figure out a way that will
> make every thing that begins a new line with any sequence of characters with
> no spaces
That isn't what you are doing, you are looking for lines with sequences
of characters that are only letters, digits and underscore (\w).
\S is how you match non-whitespace characters.
> up to the first colon ":", the field separator. I tried to put
> the separator as, $sep='^\w+:'; with intentions that the "^" will indicate
> that this is the start of a line.
The ^ anchor does not mean beginning of line, it means beginning of string.
You can add a modifier to change it to mean beginning of line though.
Since you have a separator at the very beginning of the record, there
will be an empty field at the beginning, you probably don't want that.
I think this will fix all of those problems:
my(undef, @fields) = split /^\S+:\s*/m;
> I know my terminology is very crude. As people respond, I'm sure I'll
> soon speak better Perl.
It isn't better Perl you are mainly needing, it is only
better Computer Science terminology.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 3 Mar 2005 19:26:47 -0500
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: How to specify [regex] beginning of line/unlimited characters/no spaces terminatingn with ":"
Message-Id: <112faqj98b7q246@corp.supernews.com>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnd2f8tq.3p8.tadmc@magna.augustmail.com...
> L. D. James <ljames@apollo3.com> wrote:
>
>> I know my terminology is very crude. As people respond, I'm sure
>> I'll
>> soon speak better Perl.
>
>
> It isn't better Perl you are mainly needing, it is only
> better Computer Science terminology.
Thanks, Tad. I'm still spending a lot of time studying the Guidelines.
Actually that's why I made a reference to speaking Perl. I got that from
the Guidelines, Revision: 1.5. I'll add the speaking "better Computer
Science terminology" to a high priority on my agenda of learning and
practicing for this group. Please be aware, I'm trying to be as careful as
I can to comply with everything.
-- L. James
--
--------------------------------
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames
------------------------------
Date: Fri, 04 Mar 2005 00:16:55 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: How to specify [regex] beginning of line/unlimited characters/no spaces terminatingn with ":"
Message-Id: <XNNVd.85733$g16.9250@trndny08>
Jim Gibson wrote:
> In article <1109885401.403847.38770@o13g2000cwo.googlegroups.com>, Jim
> Keenan <jkeen_via_google@yahoo.com> wrote:
>
>>
>>while (<DATA>) {
>> chomp;
>> if (/^(\w+?):\s+(.*)/) {
>
>
> I think that the '?' is unnecessary in this case because \w will not
> match a colon. Therefore, a simple (\w+) will stop when it encounters
> the first colon and need not be set to non-greedy.
True. I was doing this in my last 5 minutes at work, so I didn't have
time to fine-tune the answer.
> You can also use
> ([^:]+) to extract the key if it will include any non-\w characters.
>
Did you try that out? When I substituted this line:
if (/^([^:]+)\s+(.*)/) {
I got this output:
Non-matching line: MessageType: Signup
Non-matching line: Questions:
Non-matching line: Username: L. D. James
Non-matching line: UserEmail: lja...@apollo3.com
Non-matching line: UserTel: 555-555-555
Non-matching line: UserFax: 222-222-222
Non-matching line: AccountNumber: 123
Non-matching line: ContactRequested: ContactRequested
Non-matching line: Date: 24 Feb 2005
Non-matching line: Time: 10:21:36
Non-matching line: Comments: This is a unique comment.
$VAR1 = {
'The comment is continuing. All the rest of' => 'the',
'text is part of the comment' => 'field.'
};
jimk
------------------------------
Date: Thu, 3 Mar 2005 16:16:30 -0800
From: "juglesh" <juglesh@nospamRadioKDUG.com>
Subject: Re: Iterated mega file upload - invented wheel wanted
Message-Id: <ZNGdnSMEQqDWNLrfRVn-2g@comcast.com>
<john_ramsden@sagitta-ps.com> wrote in message
news:1109862480.383312.250480@z14g2000cwz.googlegroups.com...
>
> I have to prepare an Apache/PHP based (or perl if easier) web
> page that allows a user to upload very large files, possibly
> over 10 Gbytes and maybe up to 100 Gbytes.
maybe this
http://jupload.biz/
havent tried it for large files (working great so far with smallish images),
but the website says no limit...
------------------------------
Date: Thu, 03 Mar 2005 17:15:34 -0800
From: whph <nospam@nospam.com>
Subject: Log::Agent in ActivePerl Windows?
Message-Id: <3pcf219bdcgi6mre47knufl9jf7pn5blrc@4ax.com>
Hi,
I'm trying to covert a perl program from unix to run on windows with
active perl.
The original code has modules like Log:Agent and HTML::TreeBuilder
I can't find these when using PPM.
Any idea?
Thanks
--dave
------------------------------
Date: Thu, 3 Mar 2005 19:51:58 -0500
From: "L. D. James" <ljames@apollo3.com>
Subject: Re: mod_perl hosting
Message-Id: <112fc9qf67mu1d1@corp.supernews.com>
"Tom" <none@zerofiveone.com> wrote in message
news:d7je21d0ibgin0ttv2ep4ctedeu92ohk9v@4ax.com...
>I am looking for decent mod_perl hosting. I am based in the UK but
> dont mind if the hosting is elsewhere.
>
> MySQL would also be nice, what Im looking for is a hosting company
> that has sane charging policies for DNS entries etc.
>
> Any recommendations or resource links would be good.
I have some suggestions for you to consider. Would like to avoid
cluttering the group with commercialism, but if you email me,
ljames(AT)apollo3.com, I'll give you a good recommendation.
-- L. James
--
--------------------------------
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames
------------------------------
Date: Thu, 03 Mar 2005 23:55:15 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Pure Perl OpenSSL Library
Message-Id: <foydnbfDbd9DPrrfRVnysA@pipex.net>
Marc wrote:
>
> I thought of this but as a side effect, I can have certificate that are
> not used (for example, if one machine is broken...).
How is that a problem, apart from a small "waste" of filespace?
> Second point, is that if I want to generate certificate _before_ nodes'
> installations, server will also need to generate private keys.
It will need to do this anyway. Do you mean it will have to store them?
> I don't
> want to have a repository with all private keys inside.
Why not?
> Your cache
> system will make the private keys to be duplicated (one copy on the
> central server, one copy (possibly) on a node).
You can delete them once a node has "collected" its keys, if you wish.
> I am still
> in the 'study' part, I'm writing a test system, and I'll be able to see
> where the real bottleneck (if one) is ;)
Probably find it is in writing this thread!
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
Date: 3 Mar 2005 17:29:32 -0800
From: stov753@aol.com
Subject: RTF::Text::Converter
Message-Id: <1109899772.103850.79170@o13g2000cwo.googlegroups.com>
I need to parse converted RTF files on Red Hat, and CPAN'ed
RTF::Text::Converter for that purpose. But the text converter yields
only the first few lines of the file. I've tried a number of variations
on:
require RTF::TEXT::Converter;
my $result;
my $self = new RTF::TEXT::Converter(output => \$result);
if (@ARGV) {
foreach my $filename (@ARGV) {
$self->parse_stream($filename);
print $result;
$result = '';
The RTF::HTML::Converter works perfectly on these files, as does the
RTF::Tokenizer. Can anyone explain this?
Steven Stovall
sstovall@amtrex.com
------------------------------
Date: 3 Mar 2005 17:55:41 -0800
From: "Alex Hart" <alex_the_hart@yahoo.com>
Subject: signal handling and returning
Message-Id: <1109901340.841709.137520@f14g2000cwb.googlegroups.com>
I'd like to understand exactly when perl will call a signal handler
(HUP, CHLD, PIPE are the exact one's I'm listening for). I notice that
in perl5.6, the handler does not interupt the accept command, but on
5.8 it does. Is there a list of functions which will be interupted?
What exactly is the difference between 5.6 and 5.8.
Along the same lines, where will perl return in the code? Will it
always return to the next line of the code?
Thanks in advance.
- Alex Hart
------------------------------
Date: 3 Mar 2005 16:14:25 -0800
From: nicolas_laurent545@hotmail.com (nicolas-laurent)
Subject: Subroutine Function
Message-Id: <97fc9ebc.0503031614.5851c26f@posting.google.com>
Hello world,
Can anybody help me understand what does the following subroutine do?
I dont understand the syntax 1. my $res = ""; 2. $sub = "\\."; and not
sure what it does exactly. Thanks for your help.
sub unrollExcTree {
my ($alias, $conf) = @_;
my $res = "";
my $sub;
#printc "unroll $alias";
# main alias like DERT
if ($alias =~ /^[A-Z_]+$/m) {
$sub = "";
}
# sub alias like DERT19.2 or DERT3
elsif ($alias =~ /^[A-Z_]+\d+\.\d+$/m) {
$sub = "";
}
else {
$sub = "\\.";
}
#printc "sub=$sub", 'blue';
while (my ($a, $re) = each (%$conf)) {
#trc("$a =~ /^$alias$sub/");
if ($a =~ /^$alias$sub/m) {
$res .= "$a,";
#trc("found $a", '', 'green');
}
}
if ($res eq '') {
$res = $alias;
}
else {
$res = substr($res, 0, length($res)-1);
}
#trc("res=$res"); die;
return $res;
}
------------------------------
Date: Fri, 04 Mar 2005 01:05:33 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Subroutine Function
Message-Id: <xvOVd.41681$ya6.26736@trndny01>
nicolas-laurent wrote:
> Hello world,
> Can anybody help me understand what does the following subroutine do?
> I dont understand the syntax 1. my $res = ""; 2. $sub = "\\."; and not
> sure what it does exactly. Thanks for your help.
>
>
> sub unrollExcTree {
> my ($alias, $conf) = @_;
> my $res = "";
$res is declared within the scope of the subroutine and an empty string
is assigned as its value.
> my $sub;
A very poor choice of variable name, because 'sub' is a keyword in Perl
... as shown above.
> #printc "unroll $alias";
>
> # main alias like DERT
> if ($alias =~ /^[A-Z_]+$/m) {
> $sub = "";
> }
> # sub alias like DERT19.2 or DERT3
> elsif ($alias =~ /^[A-Z_]+\d+\.\d+$/m) {
> $sub = "";
> }
> else {
> $sub = "\\.";
Assign badly-named $sub the value between the double quotes. I think
this will evaluate to a backslash followed by a dot (but I haven't
checked it out).
jimk
------------------------------
Date: Fri, 04 Mar 2005 11:20:39 +1100
From: Jussi Jumppanen <jussij@zeusedit.com>
Subject: Re: UltraEdit?
Message-Id: <4227A9D6.224A@zeusedit.com>
Ron Graham wrote:
> Has anybody used UltraEdit for their perl scripting? Is this
> the best editor or is their a better one for general networking
> and perl/vbscript scripting? Any advice would be greatly
> appreciated.
The Zeus for Windows programmers editor will handle Perl:
http://www.zeusedit.com/lookmain.html
Some of the programming specific features include:
+ Code folding
+ Code completion and intellisensing
+ Integrated class browser
+ Project/workspace management
+ Fully configurable syntax highlighting
+ Seamless FTP editing
+ Integrated version control (including CVS)
+ Quick Help context sensitive help engine
+ Fully scriptable using Python, Lua, JavaScript, VbScript
Zeus is shareware, cost $35-00, and the shareware version runs
fully functional for 60 days.
Jussi Jumppanen
Author of: Zeus for Windows (New version 3.94 out now)
------------------------------
Date: Thu, 03 Mar 2005 17:54:25 -0700
From: Uncle Pirate <stan@surecann.com>
Subject: Re: UltraEdit?
Message-Id: <4227b1bc@nntp.zianet.com>
> On Thu, 03 Mar 2005 18:31:46 GMT, Ron Graham <Ronvgraham@yahoo.com>
> wrote:
>
>
>>Has anybody used UltraEdit for their perl scripting? Is this the best
>>editor or is their a better one for general networking and perl/vbscript
>>scripting? Any advice would be greatly appreciated.
>
>
Tom wrote:
> I like Active State Komodo, but thats geared to open source languages,
> for VB Im not so sure what you should use.
>
Top posting fixed.
I use UltraEdit all the time for HTML, CSS, Perl, and any other text
editing I need to do. It is a great tool well worth the money (yes, I
bought it). The latest version (10+) even does ftp over ssh. I
upgraded from a pretty old version after removing telnet and ftp from
one of the servers I administer. Now, all the servers I administer only
use ssh for remote access. I'd be lost without UE as I got so used to
working with files directly from the server using the open/save with
ftp. UltraEdit also has syntax highlighting for the above mentioned
languages as well as C++, VB, and some others. There's not a day goes
by that I don't use it for something.
--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Coordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
------------------------------
Date: Thu, 3 Mar 2005 18:07:54 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: WikiConverter
Message-Id: <slrnd2f9mq.3p8.tadmc@magna.augustmail.com>
* Tong * <sun_tong@users.sourceforge.net> wrote:
> ... Nothing works. Anybody can? Please help.
You should provide one or more symptoms if you hope to get a diagnosis.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7852
***************************************