[18486] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 654 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 8 18:05:50 2001

Date: Sun, 8 Apr 2001 15:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986767513-v10-i654@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 8 Apr 2001     Volume: 10 Number: 654

Today's topics:
    Re: ? The best Perl book ? <gellyfish@gellyfish.com>
    Re: [OT] Re: password encryption (Randal L. Schwartz)
    Re: [OT] Re: password encryption <uri@sysarch.com>
    Re: can somebody explain <uri@sysarch.com>
    Re: complaint about moderation of this group <flavell@mail.cern.ch>
    Re: complaint about moderation of this group <mjcarman@home.com>
    Re: complaint about moderation of this group <tinamue@zedat.fu-berlin.de>
        dir problem <nlp0421@gz.cngb.com>
    Re: dir problem (Gwyn Judd)
    Re: dir problem <wayne.keenan@ntlworld.com>
    Re: dir problem <wayne.keenan@ntlworld.com>
        HTML::Parser - no compiler to compile Win32 object requ <postmaster@hollandnumerics.co.uk>
    Re: inheritance within one file? <uri@sysarch.com>
    Re: Making a dir on a Win2000 server <gtoomey@usa.net>
        Net::SMTP and MIME::Base64 problem - help <root@novastar.dtdns.net>
    Re: Net::SMTP and MIME::Base64 problem - help <info@gareth-watkins.co.nz>
    Re: Net::SMTP and MIME::Base64 problem - help <root@novastar.dtdns.net>
    Re: Radius detail File to csv <uri@sysarch.com>
    Re: Radius detail File to csv (Garry Williams)
    Re: Radius detail File to csv <gellyfish@gellyfish.com>
    Re: sendmail script - got to be something simple (Garry Williams)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 8 Apr 2001 20:17:14 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ? The best Perl book ?
Message-Id: <9aqh0a$l05$1@plutonium.btinternet.com>

In comp.lang.perl.misc Ciaran McCreesh <keesh@users.pleaseremovethisbit.sourceforge.net> wrote:
> 
>                                                                  I've
> yet to see a decent Perl book published by anyone other than O'Reilly 
> 

I don't think that is entirely fair to the other publishers and the
authors that have written books for them that are producing good books.

As a single lighthouse example I would suggest Object Oriented Perl by 
Damian Conway which is a truly illuminating book for those thus inclined
and almost certainly falls outside of what O'Reilly see as their remit.
(Of course I might well be wrong about that :)

There are a number of books published by other publishers who's authors
might not be quite as well known as Larry Wall or Tom Christiansen or
Randal Schwartz but nonetheless are people who know a lot about, and
have put a lot into, Perl.

Of course there are a lot of other crap books out there on the subject.

If Uri is still maintaining his book list I would suggest you refer to that.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 08 Apr 2001 08:30:44 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: [OT] Re: password encryption
Message-Id: <m1n19rcst7.fsf@halfdome.holdit.com>

>>>>> "Eric" == Eric Bohlman <ebohlman@omsdev.com> writes:

Eric> Note that *some* mail readers give an automatic indication of
Eric> whether a piece of mail was a cc from a newsgroup, but not all
Eric> of them do.

If you mean that some mail readers show that there's a "newsgroups:"
line, that's insufficient to know that it was actually a newsgroup
post as well.  My mail reader can forward a private message with the
"newsgroups:" header intact so that the original poster understands
the context of this conversation.  My mail reader can also post a
message, then turn around and mail the same message to the original
poster *without* including any indication.  Of course, by default, my
mail reader posts-and-mails by adding "this mail was also posted" in
the first few lines of the message body on the mail only.  (In other
words, my news/mail reader can beat up your big brother's news and
mail readers combined. :)

So, there is no consistent reliable header to show that something has
been posted as well as mailed.  It must be in-band at the beginning of
the message.  Anything else is a "stealth-cc", and therefore evil.

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Sun, 08 Apr 2001 17:24:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: [OT] Re: password encryption
Message-Id: <x7vgofpaoe.fsf@home.sysarch.com>

>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:

  RLS> So, there is no consistent reliable header to show that something
  RLS> has been posted as well as mailed.  It must be in-band at the
  RLS> beginning of the message.  Anything else is a "stealth-cc", and
  RLS> therefore evil.

not only that, but who actually reads all the headers on each email
looking for newsgroups: or some other indication that it was a cc from a
news posting? so an in band message is the best option.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: Sun, 08 Apr 2001 16:56:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: can somebody explain
Message-Id: <x74rvzqqib.fsf@home.sysarch.com>

>>>>> "SS" == Steven Smolinski <sjs@linux.ca> writes:

  SS> Uri Guttman <uri@sysarch.com> wrote:

  >> better called the binding operator. [...]

  SS> Indeed; thanks for the correction.  The manpage I pointed to also calls
  SS> it the binding operator, and has for many moons, if not forever.

  SS> I can't figure out where I got "matching operator" from.

i have seen it incorrectly called that many times because both m// and
s/// have a matching component. but those who use that wrong term don't
seem to get that the difference between use =~ and not using it, is just
whether the operation works on $_ or another expression. so the think =~
means match. when you throw in tr/// into the picture it makes it
clearer to them.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: Sun, 8 Apr 2001 17:13:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: complaint about moderation of this group
Message-Id: <Pine.LNX.4.30.0104081657190.11811-100000@lxplus003.cern.ch>

On Sun, 8 Apr 2001, Tad McClellan wrote:

> 2) I figure the unhelpfulness of the CGI newsgroup is exactly
>    what happens when the rules of netiquette are largely ignored.

It's a long story.  Somewhere along the way, the regulars all got fed
up of the amount of sheer off-topic posting from newbies who didn't
know any better, exacerbated by long rants from people who didn't want
to learn.  (Sound familiar?).  Tom Boutell came out with a well-
intentioned proposal to take the group into auto-moderation.  Each new
poster would be emailed a copy of the FAQ and a clue about how the
auto-moderation worked, and their posting held meantime; so nobody
could claim the excuse of not being given a chance to discover the
rules before posting.

I was sceptical at the time, but was willing to go along with it if
enough of the others voted it in.  Which they did; and for quite a
while, it worked.  And of course we have no clear idea now what it
would have been like without the automoderation bot.

Unfortunately by now a massive proportion of posters don't use an
emailable posting address, and it seems even the newbies and spammers
know how to slink past the bot without having seen the FAQ.  And
occasionally the bot 'takes a vacation' and leaves a whole stash of
postings unmoderated for days on end.

[f'ups set]



------------------------------

Date: Sun, 08 Apr 2001 16:12:10 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: complaint about moderation of this group
Message-Id: <3AD08DC7.39A2A522@home.com>

Scott wrote:
> 
> Michael Carman wrote:
> 
>> Yes and no. If there were only a few messages here each day, 
>> then I doubt that anyone would really mind seeing CGI questions.
>> However, they would still be off-topic.
> 
> CGI scripts that are written in perl are not off topic.
> [...]

Maybe, maybe not.

Let's see if I can come up with an example that will make this clearer.
Hypothetical situation: You're developing a CGI application, in Perl,
that will be run on a Linux box under Apache. It will perform some sort
of system administration task. You're using emacs as your editor. You're
a southpaw. You run into a problem and can't find a solution with a
quick web search or by consulting the various books and other
documentation available to you, so you decide to post a question on
Usenet. Where do you post it?

comp.lang.misc.perl
comp.infosystems.www.authoring.cgi
comp.os.linux
japan.www.server.apache
comp.os.linux.admin
gnu.emacs
alt.left-handed
alt.sex.bondage.particle.physics

Any of these groups *could* be the right one. (Well, maybe not that last
one. ;) It all depends on what you're problem is. Don't assume that
clp.misc is the right ng just because you're programming in Perl --
that's a common newbie mistake.

If you don't know how to manipulate your data, that's a Perl question.
If you don't know to make a cookie, that's a CGI question. If you don't
know how to make your script executable, that's a linux question. If you
don't know where to put it so that the webserver can run it, that's a
Apache question. Etc., etc., ad naseum.

Admittedly, it isn't always clear, but experience will help. Take you're
best shot at picking the right one, and if you're told you chose wrong,
try to politely say "Thank you" and move along.

> I would say that most people using perl are using it for web
> related activities such as CGI scripts or mod_perl programs.

I wouldn't. Many people do, certainly, but Perl is used for a lot of
other tasks. I've never done more than play with CGI myself, and I use
Perl almost every day.

-mjc


------------------------------

Date: 8 Apr 2001 16:20:25 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: complaint about moderation of this group
Message-Id: <9aq349$686eo$1@fu-berlin.de>

hi,
"Jürgen Exner" <juex@my-deja.com> wrote:
> "Scott" <admin@gatordev.net> wrote in message
> news:3ACF7AC8.31D50E6C@gatordev.net...

>> I would say that most people using perl are using it for web
>> related activities such as CGI scripts or mod_perl programs. Saying that
>> CGI is off topic in this newsgroup is like saying that servlets are off
>> topic to a java newsgroup.

> Not quite. The difference is that servlets are part of the Java Script
> language.

? what's the Java Script language? do you mean Javascript or
Java? however, servlets are written in Java.
just wanted to get that right.

regards,
tina

offtopic => f'up2p

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


------------------------------

Date: Sun, 8 Apr 2001 09:18:42 +0800
From: "J.A.W" <nlp0421@gz.cngb.com>
Subject: dir problem
Message-Id: <9aoe96$30i$1@news.cz.js.cn>

When I open and read a directory, everything including files and
subdirectories are seen as "files".

opendir(DIR, "$dir") or die;
@files=readdir(DIR);
closedir(DIR);

But I am not interested in the subdirectories. I think I can use

if (opendir(TEMPDIR, "$whatever")) {
    closedir(TEMPDIR);
    next;
}

to ignore the subdirs, but is there an efficient way to do this?

Thanx!!

J.A.W.




------------------------------

Date: Sun, 08 Apr 2001 21:13:27 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: dir problem
Message-Id: <slrn9d1l3m.k95.tjla@thislove.dyndns.org>

I was shocked! How could J.A.W <nlp0421@gz.cngb.com>
say such a terrible thing:

>to ignore the subdirs, but is there an efficient way to do this?

You want the '-d' file-test operator.

perldoc -f '-X'

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Q: How can you tell when a lawyer is lying?A: His lips are moving.


------------------------------

Date: Sun, 08 Apr 2001 22:44:04 +0100
From: "wayne.keenan" <wayne.keenan@ntlworld.com>
Subject: Re: dir problem
Message-Id: <3AD0DBA4.13EBDE05@ntlworld.com>



"J.A.W" wrote:

> When I open and read a directory, everything including files and
> subdirectories are seen as "files".
>
> opendir(DIR, "$dir") or die;
> @files=readdir(DIR);
> closedir(DIR);
>
> But I am not interested in the subdirectories. I think I can use
>
> if (opendir(TEMPDIR, "$whatever")) {
>     closedir(TEMPDIR);
>     next;
> }
>
> to ignore the subdirs, but is there an efficient way to do this?
>
>

have a pick, but then I wouldn't trust these numbers, u try the script.
(note: fileslurp uses opendir underneath,  but is (typically) quicker,
go figure)

Benchmark: timing 1000 iterations of dirhand, fileslurp, globbing,
opendir...
dirhand:  7 wallclock secs ( 7.19 usr +  0.00 sys =  7.19 CPU) @
139.08/s (n=1000)
fileslurp:  5 wallclock secs ( 4.72 usr +  0.00 sys =  4.72 CPU) @
211.86/s (n=1000)
globbing:  7 wallclock secs ( 7.25 usr +  0.00 sys =  7.25 CPU) @
137.93/s (n=1000)
opendir:  7 wallclock secs ( 6.43 usr +  0.00 sys =  6.43 CPU) @
155.52/s (n=1000)


#perl -w
END {print "Program finished\nPress ENTER to close"; <STDIN>;}

use strict;
use Data::Dumper;
use File::Slurp;    #from CPAN, not in std perl.
use DirHandle;
use Benchmark;

Main();
exit;

sub Main
{
 timethese(1000,
 {
     globbing  => sub { using_dir_globbing("/test_dir/*")},
  opendir   => sub { using_opendir("/test_dir")    },
  fileslurp => sub { using_file_slurp("/test_dir") },
  dirhand   => sub { using_dir_handle("/test_dir") }
 });

}

sub using_dir_globbing
{
 my $dir = shift;
 my @dirEntries = glob($dir);
 my @onlyFiles = grep { -f  } @dirEntries;
 #see perlfunc for filetest operators (the -f)
 return \@onlyFiles;
}

sub using_opendir
{
 my $dir =shift;

 opendir(DIR, $dir) or die "Failed to open $dir, $!";
 my @dirEntries=readdir(DIR);
 my @onlyFiles = grep { $_= "$dir/$_"; -f  } @dirEntries;
 closedir(DIR);
 return \@onlyFiles;

}

sub using_file_slurp
{
 # which internally uses opendir;
 my $dir =shift;

 my @dirEntries=read_dir($dir);
 my @onlyFiles = grep { $_= "$dir/$_"; -f } @dirEntries;
 return \@onlyFiles;
}

sub using_dir_handle
{
 # avoids namespace polution, unlike opendir.

 my $dir =shift;

 my $dh= new DirHandle $dir  or die "Failed to open dir: $!";
 my @onlyFiles  = ();
 while (defined($_ = $dh->read() ) )
 {
  push @onlyFiles, "$dir/$_" if ( -f "$dir/$_");
 }
 return \@onlyFiles;
}




------------------------------

Date: Sun, 08 Apr 2001 22:45:06 +0100
From: "wayne.keenan" <wayne.keenan@ntlworld.com>
Subject: Re: dir problem
Message-Id: <3AD0DBE2.7C1A9EC5@ntlworld.com>


Gwyn Judd wrote:

> I was shocked! How could J.A.W <nlp0421@gz.cngb.com>
> say such a terrible thing:
>
> >to ignore the subdirs, but is there an efficient way to do this?
>
> You want the '-d' file-test operator.
>

-f





------------------------------

Date: Sun, 8 Apr 2001 22:12:15 +0100
From: Phil Holland <postmaster@hollandnumerics.co.uk>
Subject: HTML::Parser - no compiler to compile Win32 object required - Help!!
Message-Id: <wFQr5QAvQN06EwmZ@hollandnumerics.demon.co.uk>

I have downloaded version 3.19 of HTML::Parser from CPAN, but can't
complete the installation on my Win2000 system as dmake has no C
compiler it can use.

Can anyone send me a pre-compiled Parser object that I seem to need to
run this module, or tell me where I can find one, please?

Thanks.........Phil Holland
-- 
--------------------------------------------------------
Holland Numerics Ltd
        94 Green Drift, Royston, Herts SG8 5BT, UK
        mobile : +44-(0)7714-279085
        email  : <NEWS@hollandnumerics.com>
        URL    : http://www.hollandnumerics.com/
--------------------------------------------------------


------------------------------

Date: Sun, 08 Apr 2001 16:48:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: inheritance within one file?
Message-Id: <x78zlbqqvq.fsf@home.sysarch.com>

>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:

  JS> Uri Guttman <uri@sysarch.com> wrote:
  >> 
  >> read object oriented perl or take damian's class in boston (see below)
  >> to really learn about OO perl.
  >> 

  JS> Or read the perlboot, perltoot, perlbot, perlobj and perlmod manpages :)

and those are great (and listed as prerequisites to damian's class). but
they don't go anywhere near what damain is covering. his class is in
ADVANCED OO perl.

:)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: Mon, 9 Apr 2001 01:06:00 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Making a dir on a Win2000 server
Message-Id: <jW_z6.11831$45.67889@newsfeeds.bigpond.com>

Directories on Unix look like '/dir1/dir2'.
Directories on Windows look like 'C:/file1/file2/' or 'C:\file1\file2\'
Is this any help?

gtoomey
-----------
"YJW" <mess@dds.nl> wrote in message
news:5yZz6.60054$t9.4137495@news.soneraplaza.nl...
> Is it different to make a directory with perl on a Win2000 server then on
a
> Unix-server? Because the script did work on an account of Virtualave, but
> since I use another server (that uses Win2000) it does not work anymore.
> Please help me out. Thanks....
>
>
>




------------------------------

Date: Sun, 8 Apr 2001 19:54:50 +0200
From: "novastar" <root@novastar.dtdns.net>
Subject: Net::SMTP and MIME::Base64 problem - help
Message-Id: <9aq54l$g76$1@usenet.otenet.gr>

I have a mail script on my ISP that sends emails. The server have not sendmail, MIME::Lite, or nothing else than
Net::SMTP and MIME::Base64 installed. So I have to encode the attached binaries files with the MIME::Base64 module.
The problem is that the encoded binaries files are obviously misformated. I tryied to encode several files with no
success at all. I think that I am doing a mistake but I can not figure out. Here is an example :
use MIME::Base64;
open(output,">output.bin") ; open(input, "<sample.jpg") ;
    while (read(input, $var, 57*60))
    {
    print output encode_base64($var)
    }
close input ; close output ;
The input file ( http://users.otenet.gr/~novastar/misc/sample.jpg ) is 57.953 bytes and the output file is only 94
bytes ...

George





------------------------------

Date: Mon, 9 Apr 2001 06:32:17 +1200
From: "Gareth Watkins" <info@gareth-watkins.co.nz>
Subject: Re: Net::SMTP and MIME::Base64 problem - help
Message-Id: <752A6.1952$ndm.100008114@news.xtra.co.nz>

I've had the same problem with the Base64 module ... after a number of
terror days trying to work it it switched to using MimeLite....


"novastar" <root@novastar.dtdns.net> wrote in message
news:9aq54l$g76$1@usenet.otenet.gr...
> I have a mail script on my ISP that sends emails. The server have not
sendmail, MIME::Lite, or nothing else than
> Net::SMTP and MIME::Base64 installed. So I have to encode the attached
binaries files with the MIME::Base64 module.
> The problem is that the encoded binaries files are obviously misformated.
I tryied to encode several files with no
> success at all. I think that I am doing a mistake but I can not figure
out. Here is an example :
> use MIME::Base64;
> open(output,">output.bin") ; open(input, "<sample.jpg") ;
>     while (read(input, $var, 57*60))
>     {
>     print output encode_base64($var)
>     }
> close input ; close output ;
> The input file ( http://users.otenet.gr/~novastar/misc/sample.jpg ) is
57.953 bytes and the output file is only 94
> bytes ...
>
> George
>
>
>




------------------------------

Date: Sun, 8 Apr 2001 21:45:12 +0200
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: Net::SMTP and MIME::Base64 problem - help
Message-Id: <9aqbjh$if3$1@usenet.otenet.gr>

Silly me !!! I was trying to open a binary file as a text file . The binmode command solve the problem !
open(input, "<sample.jpg");
binmode input, ":raw";


"Gareth Watkins" <info@gareth-watkins.co.nz> wrote in message news:752A6.1952$ndm.100008114@news.xtra.co.nz...
> I've had the same problem with the Base64 module ... after a number of
> terror days trying to work it it switched to using MimeLite....
>
>
> "novastar" <root@novastar.dtdns.net> wrote in message
> news:9aq54l$g76$1@usenet.otenet.gr...
> > I have a mail script on my ISP that sends emails. The server have not
> sendmail, MIME::Lite, or nothing else than
> > Net::SMTP and MIME::Base64 installed. So I have to encode the attached
> binaries files with the MIME::Base64 module.
> > The problem is that the encoded binaries files are obviously misformated.
> I tryied to encode several files with no
> > success at all. I think that I am doing a mistake but I can not figure
> out. Here is an example :
> > use MIME::Base64;
> > open(output,">output.bin") ; open(input, "<sample.jpg") ;
> >     while (read(input, $var, 57*60))
> >     {
> >     print output encode_base64($var)
> >     }
> > close input ; close output ;
> > The input file ( http://users.otenet.gr/~novastar/misc/sample.jpg ) is
> 57.953 bytes and the output file is only 94
> > bytes ...
> >
> > George
> >
> >
> >
>
>




------------------------------

Date: Sun, 08 Apr 2001 17:08:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Radius detail File to csv
Message-Id: <x71yr3qpyp.fsf@home.sysarch.com>

>>>>> "BB" == Brad Baxter <bmb@ginger.libs.uga.edu> writes:

  >> while( my ( $name, $value ) = /^\s*(\S+)\s*=\s*(.+)/gm ) {
  >> 
  >> this assumes each key=value pair starts on it own line which seems
  >> to be what you were doing.

  BB> That results in an infinite loop (because it's not in scalar
  BB> context?)  However, I get the point.  I modified it in the code at
  BB> the end of this post.

ahh, no testing strikes again. the list context causes the /g to loop
inside the regex so the while loop only gets executed once. i wanted
something like each() where i can grap a pair of tokens each time. i
would fall back to:

	while( 1 ) {

		my( $name, $value ) ;
		last unless ( $name, $value ) = /^\s*(\S+)\s*=\s*(.+)/gm ) ;

that saves the extra work of the split and is pretty clear.

  BB> I used to run out of screen space with tabstop=4, so I started
  BB> using 2 and am now very used to it.  I indent with tabs, so others
  BB> who edit my code will see what they like.  Of course, I have to
  BB> encourage them to indent with tabs also.  The '} #' comments are a
  BB> habit I've gotten into.  I tend to leave them in place, because my
  BB> blocks often span pages (and because uncommented '}'s tend to make
  BB> me cross-eyed :-).  I'm not arguing with you--just my preferences.
  BB> And I'll grant that they're preferences that grew out of poor
  BB> programming style.  :-)

blocks that span pages are not good at all. break them down into subs if
you can. even calling a sub once is worth the overhead of clarity in
code.

the same is true for indenting too deep. if your code blocks are so long
that you end up indenting deep you should break it up into subs.
consider a sub a way of moving code back to the left margin. that is
good for both shortening your blocks and giving your more room for
indents.

  BB> I doubt the value has to have "" around it if it contains no
  BB> commas or '"'s, but it's easier to code that way, and the OP did
  BB> say 'simple'.

and it is CSV and some of those stupid csv parser want "" on all their
fields.

  BB> This sort of reply is one of the main reasons I try hard to stick
  BB> with this news group.  I find these discussions, even when I'm not
  BB> involved, invaluable to improving my own skills.

tell that to all the flaming whiners who want to be spoon fed fish. :)

  BB> { local $/ = '';  ### paragraph mode
  BB>     while( <> ) {
  BB>         while( /^\s*(\S+)\s*=\s*(.+)$/gm ) {
  BB>             my ( $name, $value ) = ( $1, $2 );
  BB>             die "Unknown field: $name" unless exists $h{ $name };
  BB>             $value =~ s/"/\\"/g;
  BB>             $h{ $name } = $value;
  BB>         }
  BB>         { local $" = q{","} ;
  BB>             print qq{"@h{sort keys %h}"\n} ;
  BB>         }
  BB>         @h{ keys %h } = ('') x keys %h ;
  BB>     }
  BB> }

much nicer (including the indents!)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: Sun, 08 Apr 2001 17:22:29 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Radius detail File to csv
Message-Id: <slrn9d17il.22s.garry@zfw.zvolve.net>

On Sun, 8 Apr 2001 10:42:23 -0400, Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> On Sat, 7 Apr 2001, Uri Guttman wrote:
>> >>>>> "BB" == Brad Baxter <bmb@ginger.libs.uga.edu> writes:
>> 
>> some minor and style improvements

[snip minor improvements and refinement]

I thought it would be a good idea to point out to the OP that some
Network Access Servers send Radius Accounting packets with multiple
instances of the same keyword.  I have never had any reason to deal
with the "list" values for those keywords, but you may, depending on
your application.  

That would imply some change to the nice algorithm that Uri suggested
and that you refined.  

-- 
Garry Williams


------------------------------

Date: 8 Apr 2001 19:43:46 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Radius detail File to csv
Message-Id: <9aqf1i$bqk$2@uranium.btinternet.com>

Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> On Sat, 7 Apr 2001, Uri Guttman wrote:
>> >>>>> "BB" == Brad Baxter <bmb@ginger.libs.uga.edu> writes:
>> 
>> some minor and style improvements
>> 
>>   BB> my %h = map { $_, '' } qw(
>> 	Acct-Authentic
>> 	Acct-Delay-Time
> [snip]
>> );
>> 
>> isn't that easier to read and maintain?
> 
> Yes!
> 

Just to put this one to bed there is also :

   Module          Logfile::Radius (P/PA/PAULG/Logfile-Radius-1.14.tar.gz)


Though I have to say I use something completely different at work :)

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: Sun, 08 Apr 2001 15:26:11 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: sendmail script - got to be something simple
Message-Id: <slrn9d10oj.21v.garry@zfw.zvolve.net>

On Sat, 07 Apr 2001 19:15:38 GMT, Wes <theXYZtenor@attXYZ.XYZnet> wrote:
> I appologize for posting this here, but I'm not sure if I've got a perl,
> sendmail or server problem. This has got to be something so obvious: I'm
> trying to run a simple sendmail script on an AT&T small business hosting
> server and I have yet to be able to send mail. So far the folks at AT&T
> haven't been very helpful.
> 
> script follows:
> 
> if ( !open(MAIL, "|/usr/lib/sendmail -t") ) {
>             print "Open mail failed\n";
>             exit;
> }
> print MAIL "To: me\@noplace.com\n";
> print MAIL "From: me\@somewhere.net\n";
> print MAIL "Subject: Testing mail script\n\n";
> print MAIL "This is a test\n\n";
> 
> close (MAIL);

Works for me: 

  $ cat x
  if ( !open(MAIL, "|/usr/lib/sendmail -t") ) {
	      print "Open mail failed\n";
	      exit;
  }
  print MAIL "To: me\@noplace.com\n";
  print MAIL "From: me\@somewhere.net\n";
  print MAIL "Subject: Testing mail script\n\n";
  print MAIL "This is a test\n\n";

  close (MAIL);
  $ perl x
  $ 

Must not be a Perl problem :-)  

Try it from the command line.  I suspect that there is something
you're not showing us.  

-- 
Garry Williams


------------------------------

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.  

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 654
**************************************


home help back first fref pref prev next nref lref last post