[9874] in Perl-Users-Digest
Perl-Users Digest, Issue: 3468 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 17 18:07:16 1998
Date: Mon, 17 Aug 98 15:01:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 17 Aug 1998 Volume: 8 Number: 3468
Today's topics:
How do you email an attached file using perl? <ccorrigan@bradson.com>
Re: How do you email an attached file using perl? (Greg Bacon)
Re: How to "flip" a hash of arrays? <tringali@ed.ray.com>
Re: is there a way to prevent the dos window from closi <grant.griffin@nospam.com>
Re: Link to a CGI script in a CGI script <tbeaulieu@mediaone.net>
Re: NT Registry Routines (Tye McQueen)
Re: Pattern substitution using perl <sneaker@sneex.fccj.org>
Re: Perl to C <grant.griffin@nospam.com>
Re: Q: How to read all the file name in a directory <dan@fearsome.net>
Re: Random Number <jim.michael@gecm.com>
Re: Random Number <ghia@telerama.lm.com>
Re: Random Number (Greg Bacon)
Re: Random Number <grant.griffin@nospam.com>
Re: Recommend a good editor <zenin@bawdycaste.org>
socket client on Windows 95 machine <pagib@aur.alcatel.com>
Re: Substituting patterns using perl 5 <sneaker@sneex.fccj.org>
Trouble with perl invocation line (from Camel) <mgregory@asc.sps.mot.com>
UDP Socket supported in Perl5? <chsiao@intrepid.interaccess.com>
Re: WIN32::NetAdmin User Management <pete.keefe@eds.com>
Re: WIN32::NetAdmin User Management <pete.keefe@eds.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 17 Aug 1998 16:46:43 -0400
From: "C. K." <ccorrigan@bradson.com>
Subject: How do you email an attached file using perl?
Message-Id: <6ra5qp$9ar$1@nr1.ottawa.istar.net>
Hi,
How do you send an attached file with sendmail from a form in perl?
I'm creating a form where the user can select which file they want to send
and the email address they want to send it to.
Thanks
------------------------------
Date: 17 Aug 1998 21:30:24 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: How do you email an attached file using perl?
Message-Id: <6ra7dg$39o$6@info.uah.edu>
In article <6ra5qp$9ar$1@nr1.ottawa.istar.net>,
"C. K." <ccorrigan@bradson.com> writes:
: How do you send an attached file with sendmail from a form in perl?
The MIME-Lite distribution (which is on the CPAN) may be of some
assistance. Find it at
<URL:http://www.perl.com/CPAN/modules/by-module/MIME/>
The README gives an example of how to create a message with a MIME
attachment.
Hope this helps,
Greg
--
Must one first batter their ears, that they may learn to hear with
their eyes? Must one clatter like kettledrums and penitential
preachers? Or do they only believe the stammerer?
-- Nietzsche
------------------------------
Date: Mon, 17 Aug 1998 11:56:09 -0400
From: "Scott J. Tringali" <tringali@ed.ray.com>
To: Greg Bacon <gbacon@cs.uah.edu>
Subject: Re: How to "flip" a hash of arrays?
Message-Id: <35D85299.2781@ed.ray.com>
> You mean this?
> for my $key (keys %h1) {
> for (@{ $h1{$key} }) {
> push @{ $h2{$_} }, $key
> }
> }
Yup, this is exactly what I have... I was wondering if there was some
cool one-liner that used map or grep or something like that. You know,
the kind of Perl statement that makes you feel totally dumb for doing it
the hard way previously.
Hey, I must be getting better at Perl if you guys come up with the same
implementation. Cool! :)
Thanks,
Scott
------------------------------
Date: Mon, 17 Aug 1998 15:52:39 -0500
From: Grant Griffin <grant.griffin@nospam.com>
To: Matthew Bafford <dragons@scescape.net>
Subject: Re: is there a way to prevent the dos window from closing after running a perl program in win32?
Message-Id: <35D89817.55AEF64@nospam.com>
Matthew Bafford wrote:
> Actually, (at least on my machine) if you put the end at the
> beginning it works fine.
OK, you can put the end at the beginning, but let's just be sure we don't put the
cart before the horse.
;-)
=g2
------------------------------
Date: Mon, 17 Aug 1998 17:28:24 -0400
From: "Todd B" <tbeaulieu@mediaone.net>
Subject: Re: Link to a CGI script in a CGI script
Message-Id: <6ra7ce$nn3$1@wbnws01.ne.highway1.com>
cgi.pm provides two functions to help you: escape() and unescape().
unescape() will remove the %20-type stuff from your arg list. escape will
build a string with the %20-type substitions for passing to another script,
or for building a htm doc that calls a script.
------------------------------
Date: 17 Aug 1998 16:31:52 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: NT Registry Routines
Message-Id: <6ra7g8$jf9@fumnix.metronet.com>
rineholt <rineholt@us.ibm.com> writes:
) I have "inherited" some code that I need to maintain and update that
) use apis like NTReg...Key. Are these officially how one can access
) NT's registry?
Never heard of them (so I'm pretty sure they aren't "official").
The least common denominator for accessing the Registry is
something like:
use Win32::Registry qw(:ALL);
RegOpenKeyEx( HKEY_LOCAL_MACHINE(), ... );
but there is no documentation included with this and for some old
version of Perl:
You don't need and can't have the "use" line.
You have to call Win32::RegOpenKeyEx(...);
And there are other ways to use Win32::Registry.
) All the books I have read and code that I have written with the latest
) perl distribution use an OO approach like $hkey->Create(...) etc.
The idea of using $HKEY_LOCAL_MACHINE->Create(...) is poorly
implemented in Win32::Registry and having $HKEY_LOCAL_MACHINE
being both a constant value and an object reference is a poor
design. So, for example, you can't currently do this except
in the "main" package. Also, there is no way to determine
why a call failed with Win32::Registry (the error code is
silently thrown away).
So the most common way of accessing the Registry, Win32::Registry
(which was in the early version of Perl from ActiveState and is
now part of the widely distributed libwin32) has some problems.
This has lead to several people writing their own (probably where
your NTReg...Key calls came from).
I wrote Win32API::Registry and actually got it in the Perl Modules
list (thinking, incorrectly, that this might prevent a lot of
duplication of work -- the Modules list seems to be very underused,
especially in the Win32 world). But I used standard tools for
writing extensions that ActiveState versions of Perl did not
support prior to Perl version 5.005 (ActiveState's distributions
of Perl5.005 and after claim to support these tools but I've
seen a lot of unanswered compalints about them not working).
So you might or might not be able to use Win32API::Registry
(available from CPAN, like all modules should be), depending
mostly on which version of Perl you have.
At one time it looked like Win32API::Registry (and Win32::TieRegistry)
would get folded into libwin32 in such a way that most of the
problems with Win32::Registry would also be fixed. I still
think (and hope) this is going to happen, but that process appears
to be stalled at the moment.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: Mon, 17 Aug 1998 16:58:09 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Pattern substitution using perl
Message-Id: <35D89961.213188B8@sneex.fccj.org>
zaxaz@my-dejanews.com wrote:
>
> I am trying to substitute leading and trailing double quotes from each line in
> a numbe of files. Is this something easily accomplished using perl. I would
> like to substitute the pattern then rewrite each file in sequence.
>
> Thanks,
>
> Scott Slattery
Maybe not exactly what you want, but feel free to change...
#!/usr/bin/perl -w
use strict;
# The text that needs replacing:
my $oChunk = qq{""};
# With this text:
my $nChunk = qq{"};
# Let's try this:
$/ = ".\n";
while (<>)
{
open (NFILE, ">>../$ARGV") or die "\n\nCan't open ../$ARGV: $!\n\n";
s/$oChunk/$nChunk/g;
print NFILE;
close (NFILE) or die "\n\nCan't close ../$ARGV: $!\n\n";
}
This script and more available via a search of DejaNews!
(Or the actual Internet, if you prefer...)
HTH,
-Sneex- :]
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Life is a 'Do it yourself' thing...
http://webmaster.fccj.org/cgi/mail?webmaster
------------------------------
Date: Mon, 17 Aug 1998 16:04:22 -0500
From: Grant Griffin <grant.griffin@nospam.com>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl to C
Message-Id: <35D89AD6.635F2BCF@nospam.com>
Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> It would very likely do you no good. Now go read the FAQ to learn why.
>
You know, I read the FAQ, and it left me confused, as a matter of faq. If
the Perl Compiler _might_ be used to solve problems a), b), c), or d) but
it really isn't a good _solution_ to problems a), b), c), or d) then why
does it exist? Perhaps along with the reasons why it _shouldn't_ be used,
the FAQ could also spell out why the Perl Compiler _should_ be used!
=g2
p.s. If my cc: doesn't get to you, it is the computer's fault, not mine.
If you want to beat me anyway, I can live with that.
------------------------------
Date: Mon, 17 Aug 1998 22:29:14 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <903389718.1315.1.nnrp-07.c2deb1c5@news.demon.co.uk>
Just to try and put a stop to this unproductive bickering:
The "experts" are right - many of the newbies who ask questions haven't read
the FAQs or manpages before they ask their questions. 90% of the time I
would suggest that is simply because they do not know that they exist. If
someone asks a question that you think is answered in the FAQs, simply say
so and direct them to it with a link. Is that so hard?
Basically, not replying at all isn't rude. If you reply positively, that is
a samaritan act - it isn't required or expected, but freely given if the
person so wishes. If you flame the newbie for what is in all probability an
innocently-asked question by someone who simply doesn't know about manpages,
that is just pathetic. Yes, they should probably have found a copy of the
FAQ/manpages/reference book before they started programming, but it is
evident that they haven't or, if they have, that it has not helped them, so
reply based on these premises or do not reply at all.
SImple, and everyone goes home happy:
the "evil experts" who now have lots lets messages to send
the "kind experts" who continue to provide geneerous help as before
the "innocent newbies" who are quickly given references to help them
the "lazy newbies" who find that, instead of having it easy, the have to
genuinely learn the language.
Lets not forget another important point - "newbies" in one ng are probably
"experts" in another - certainly this is true of me. The whole point of
usenet is that you help out where you can and get helped out by others where
they can. The important thing is that this is USENET-WIDE not group-wide.
Those newbies you blast are probably experts in another group and you are
without a doubt a newbie in a different field. If, for whatever reason, you
needed some information quickly on a subject with which you were unfamiliar,
wouldn't it be natural to go to a forum filled with experts in that field
who would be willing to provide you with help? Just because YOU don't need
to do that with Perl, doesn't mean that other people don't. Just imagine the
reverse situation, with you asking for help in another newsgroup.
------------------------------
Date: Mon, 17 Aug 1998 15:47:41 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Random Number
Message-Id: <35D888DD.33F3@gecm.com>
Grant Griffin wrote:
> > Did you even bother to read the FAQ or the docs or some book on Perl?
> > I found 38 occurrences of `random' grepping through the FAQ and docs.
>
> I know that "Windows People" (if that's what Darren is) supposedly deserve
> automatic scorn around here, but to my knowledge, Windows comes with nothing like
> "grep". I'm sure many grep or grep-like programs are available on the net, but
I don't see your leap from grep'ing the documentation to scorn for
'Windows People', however I wouldn't expect a Unix user to know what the
equivalent application is on other platforms.
Every perl installation comes with extensive documentation, and that
documentation is searchable, *even in Windows*. For your amusement:
start:find:files or folders:advanced:containing text:(random):
Name&Location:Named:(*.*):Look in:(D:\perl\lib\Pod)
where D: = your drive letter.
Cheers,
Jim
------------------------------
Date: Mon, 17 Aug 1998 16:14:00 -0400
From: Daniel <ghia@telerama.lm.com>
Subject: Re: Random Number
Message-Id: <35D88F07.E9557D44@telerama.lm.com>
Darren Ferguson wrote:
> Is there a random number command for Perl or in fact a routine.
>
> Thanks
>
> Darren
> Darren@introdesign.com
This one is very simple, please read through some books on perl, and
other recourses on the net,
srand;
$roll = int(rand 6) + 1; # $roll is now an integer between 1 and 6
The above example is from page 202 of the camel book, there is a lot
more to it then this, but its a good jumping off point.
"The" Daniel
------------------------------
Date: 17 Aug 1998 20:42:50 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Random Number
Message-Id: <6ra4ka$39o$2@info.uah.edu>
In article <35D86952.C43DE25C@nospam.com>,
Grant Griffin <grant.griffin@nospam.com> writes:
: I know that "Windows People" (if that's what Darren is) supposedly deser
: automatic scorn around here, but to my knowledge, Windows comes with not
: "grep".
Well, for one thing, you're putting words in my mouth. Please stop.
For another, Win{95,98,NT} do have text file search built-in.
: I'm sure many grep or grep-like programs are available on the net, but
: unless you have heard of a grep program somewhere, you may not have even
: of the concept.
Never thought of the concept of searching for patterns in text files?
Please be serious. Even simple and simple-minded editors have some
sort of search functionality.
: Anyway, the term "grepping" probably doesn't mean much to the uninitiate
: as people who don't grep), so maybe somebody like this needs to be given
: URL, along with your helpful advice. (Anybody know where a grep program
: Windows is? Anybody written one in Perl?--There can't be much to it.)
I use this (and I believe there will be a newer version in the upcoming
Perl Cookbook by tchrist and gnat):
#! /usr/bin/perl
#
# tcgrep: tom christiansen's rewrite of grep
# tchrist@colorado.edu
# see usage for features
# yet to implement: -f
# v1.0: Thu Sep 30 16:24:43 MDT 1993
# v1.1: Fri Oct 1 08:33:43 MDT 1993
#
# Revision by Greg Bacon <gbacon@cs.uah.edu>
# Fixed up highlighting for those of us trapped in terminfo
# implemented -f
# v1.2: Fri Jul 26 13:37:02 CDT 1996
#
# Revision by Greg Bacon <gbacon@cs.uah.edu>
# Avoid super-inefficient matching (almost twice as fast! :-)
# v1.3: Sat Aug 30 14:21:47 CDT 1997
&init;
&parse_args;
&matchfile(@ARGV);
exit(2) if $Errors;
exit(0) if $Grand_Total;
exit(1);
######################################
sub init {
($me = $0) =~ s!.*/!!;
$Errors = $Grand_Total = 0;
$| = 1;
%Compress = (
'z', 'gzcat',
'gz', 'gzcat',
'Z', 'zcat',
);
}
sub matchfile {
local($_,$file);
local(@list);
local($matches);
local($total);
FILE: while (defined ($file = shift(@_))) {
if (-d $file) {
if (-l $file && @ARGV != 1) {
warn "$me: \"$file\" is a symlink to a directory\n"
if $opt_T;
next FILE;
}
if (!$opt_r) {
warn "$me: \"$file\" is a directory, but no -r given\n"
if $opt_T;
next FILE;
}
if (!opendir(DIR, $file)) {
unless ($opt_q) {
warn "$me: can't opendir $file: $!\n";
$Errors++;
}
next FILE;
}
@list = ();
for (readdir(DIR)) {
push(@list, "$file/$_") unless /^\.{1,2}$/;
}
closedir(DIR);
if ($opt_t) {
local(@dates);
for (@list) { push(@dates, -M) }
@list = @list[sort { $dates[$a] <=> $dates[$b] } 0..$#dates];
} else {
@list = sort @list;
}
&matchfile(@list);
next FILE;
}
if ($file eq '-') {
warn "$me: reading from stdin\n" if -t STDIN && !$opt_q;
$name = '<STDIN>';
} else {
$name = $file;
unless (-f $file || $opt_a) {
warn qq($me: skipping non-plain file "$file"\n) if $opt_T;
next FILE;
}
($ext) = $file =~ /\.([^.]+)$/;
if ( $Compress{$ext} ) {
$file = "$Compress{$ext} <$file |";
} elsif (! (-T $file || $opt_a)) {
warn qq($me: skipping binary file "$file"\n) if $opt_T;
next FILE;
}
}
warn "$me: checking $file\n" if $opt_T;
if (!open(FILE, $file)) {
unless ($opt_q) {
warn "$me: $file: $!\n";
$Errors++;
}
next FILE;
}
$total = 0;
$matches = 0;
LINE: while (<FILE>) {
$matches = 0;
if ($] < 5) {
eval $match_code;
}
else {
&{$matcher}();
}
next LINE unless $matches;
$total += $matches;
if ($opt_p || $opt_P) {
local($*);
s/\n{2,}$/\n/ if $opt_p;
s,$/$,,o if $opt_P;
}
print("$name\n"), next FILE if $opt_l;
$opt_s || print $mult && "$name:",
$opt_n ? "$.:" : "",
$_,
($opt_p||$opt_P) && ('-' x 20)."\n";
next FILE if $opt_1;
}
} continue {
print $mult && "$name:", $total, "\n" if $opt_c;
close FILE;
}
$Grand_Total += $total;
}
sub usage {
die <<EOF
usage: $me [flags] [files]
Standard grep options:
i case insensitive
n number lines
c give count of lines matching
C ditto, but >1 match per line possible
w word boundaries only
s silent mode
x exact matches only
v invert search sense (lines that DON'T match)
h hide filenames
e expression (for exprs beginning with -)
f file with expressions
l list filenames matching
Specials:
1 1 match per file
H highlight matches
u underline matches
r recursive on directories or dot if none
t process directories in `ls -t` order
p paragraph mode (default: line mode)
P ditto, but specify separator, e.g. -P '%%\\n'
a all files, not just plain text files
q quiet about failed file and dir opens
T trace files as opened
EOF
}
sub parse_args {
require 'getopts.pl';
if ($_ = $ENV{TCGREP}) {
s/^[^\-]/-$&/;
unshift(@ARGV, $_);
}
## hush the warnings
$opt_n = 0;
$opt_t = 0;
$opt_v = 0;
$opt_w = 0;
$opt_x = 0;
$opt_e = 0;
$opt_h = 0;
$opt_i = 0;
&Getopts("inqcClsue:f:xwhva1pHtrT-P:") || &usage;
if ($opt_f) {
open(PATFILE, $opt_f) || die qq($me: Can't open '$opt_f': $!);
# make sure perl is down with these patterns...
while (defined($pattern = <PATFILE>)) {
chop $pattern;
eval { /$pattern/, 1 } || die "$me: $opt_f:$.: bad pattern: $@";
push @Patterns, $pattern;
}
close PATFILE;
} else {
$pattern = $opt_e || shift(@ARGV) || &usage;
eval { /$pattern/, 1 } || die "$me: bad pattern: $@";
@Patterns = ($pattern);
}
if ($opt_H || $opt_u) {
$ospeed = 0; # hush little warnings..
$ospeed = 13; # bogus but shouldn't hurt; means 9600
require 'termcap.pl';
local($term) = ($ENV{TERM} || 'vt100');
&Tgetent($term);
($SO, $SE) = $opt_H ? @TC{'so','se'} : @TC{'us','ue'};
unless ($SO || $SE) {
($SO, $SE) = $opt_H
?
(`tput -T $term smso`, `tput -T $term rmso`)
:
(`tput -T $term smul`, `tput -T $term rmul`);
}
}
if ($opt_i) {
if ($] < 5) {
@Patterns = grep(s/\w/[\u$&\l$&]/gi, @Patterns);
} else {
@Patterns = grep($_ = "(?i)$_", @Patterns);
}
}
$opt_p && ($/ = '', $* = 1);
$opt_P && ($/ = eval(qq("$opt_P")), $*=1); # for -P '%%\n'
$opt_w && (@Patterns = grep($_ = '\b' . $_ . '\b', @Patterns));
$opt_x && (@Patterns = grep($_ = "^$_\$", @Patterns));
$mult = 1 if ($opt_r || (@ARGV > 1) || -d $ARGV[0]) && !$opt_h;
$opt_1 += $opt_l;
$opt_H += $opt_u;
$opt_c += $opt_C;
$opt_s += $opt_c;
$opt_1 += $opt_s && !$opt_c;
@ARGV = ($opt_r ? '.' : '-') unless @ARGV;
$opt_r = 1 if !$opt_r && grep(-d, @ARGV) == @ARGV;
## try to speed things up a bit
$match_code = '';
$match_code .= 'study;' if @Patterns > 5;
if ($opt_H) {
foreach $Pattern (@Patterns) {
$match_code .= "\$matches += s/$Pattern/${SO}\$&${SE}/g;";
}
}
elsif ($opt_v) {
foreach $Pattern (@Patterns) {
$match_code .= "\$matches += !/$Pattern/;";
}
}
elsif ($opt_C) {
foreach $Pattern (@Patterns) {
$match_code .= "\$matches++ while /$Pattern/g;";
}
}
else {
foreach $Pattern (@Patterns) {
$match_code .= "\$matches++ if /$Pattern/;";
}
}
if ($] >= 5) {
$matcher = eval "sub { $match_code }";
die if $@;
}
}
Enjoy,
Greg
--
If a tree falls in the forest and nobody hears it, is Bambi squashed beneath
it any less dead?
-- Mason Capwell
------------------------------
Date: Mon, 17 Aug 1998 16:09:52 -0500
From: Grant Griffin <grant.griffin@nospam.com>
To: jim.michael@gecm.com
Subject: Re: Random Number
Message-Id: <35D89C20.1D5D62FB@nospam.com>
Jim Michael wrote:
> start:find:files or folders:advanced:containing text:(random):
> Name&Location:Named:(*.*):Look in:(D:\perl\lib\Pod)
>
> where D: = your drive letter.
Well see there, I just learned something: I didn't know that the windows "Find" feature
had a grep capability. (I probably would have used the "Search" feature of the Windows
Help System to find that if I didn't already use a grep program to search Perl
documents!)
thanks,
=g2
------------------------------
Date: 17 Aug 98 20:47:20 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Recommend a good editor
Message-Id: <903387756.17872@thrush.omix.com>
Dan Nguyen <nguyend7@msu.edu> wrote:
: What could be better than emacs?
A boot to the head, perhaps?
:-)
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 17 Aug 1998 16:07:00 -0400
From: Bruno Pagis - 1320NM systems <pagib@aur.alcatel.com>
Subject: socket client on Windows 95 machine
Message-Id: <35D88D64.C2582688@aur.alcatel.com>
I tried the example of the Camel book for client and server
socket on my ActivePerl 502 release for Win32.
Everything goes fine except that when I try to start my
client, the first thing that happens is that it starts my
dial-up networking that is set up to access my ISP (Internet
Service Provider). If I hit the cancel button, then it connect
to my Perl server.
Is there a way to avoid starting my dial-up networking first.
I am using localhost as the machine hostname, and port 2345 to
listen (like in the camel book).
Thanks.
------------------------------
Date: Mon, 17 Aug 1998 16:59:11 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Substituting patterns using perl 5
Message-Id: <35D8999F.318AE0F6@sneex.fccj.org>
zaxaz@my-dejanews.com wrote:
>
> I am attempting to replace leading and trailing double-quotes in a series of
> files. I would like to use a regular expression like s/^\"//g and s/\"$//g to
> remove these quotes from each line.
>
> Is this easily accomplished by opening reading and rewriting each file?
>
> thanks,
>
> Scott Slattery
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Well, what have you tried?
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Life is a 'Do it yourself' thing...
http://webmaster.fccj.org/cgi/mail?webmaster
------------------------------
Date: 17 Aug 1998 17:28:14 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Trouble with perl invocation line (from Camel)
Message-Id: <r8pve0nip5.fsf@asc.sps.mot.com>
In the Blue Camel, under the -S option, it suggests an invocation
method in place of a #! that should survive most vagaries of operating
systems. It looks like this:
eval '(exit $?0)' && eval 'exec /usr/binperl -S $0 ${1+"$@"}'
& eval 'exec /usr/bin/perl -S $0 $argv:q'
if 0;
We have been using a modified version, like this:
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' # -*- Perl -*-
& eval 'exec perl -w -S $0 $argv:q'
if 0;
This has -w and also uses the perl on the person's path, which is what
we want (allows easy control of what perl is used, and saves
recipients of scripts having to edit the path to perl).
Unfortunately, this does not work under HPUX's "brilliant" new
Posix-compliant shell on HPUX 10.20.
Under this shell, when a script containing this invocation method is
invoked via perl's system() call with metacharacters in the command
line (hence via an exec, I guess), the resulting sh ends up executing
the second line and complaining about the & character.
I know that this is not exactly a Perl problem, but since the recipe
came from a Perl book, and Perl people use it, I'm hoping that a Perl
person might be able to tell me what is going on! (And all the code
quoted is valid perl :-) )
I guess I have two questions:
1) Is what HPUX sh is doing fair, or can I complain to HP?
2) Why was this shell-determining-tickery ever needed anyhow?
I can't see what is wrong with
eval 'exec perl -w -S $0 ${1+"$@"}' # -*- Perl -*-
if 0;
Isn't it the case that a script is always executed by sh, so all
that csh trickery was not needed?
Any illumination much appreciated!
Martin.
------------------------------
Date: 17 Aug 1998 21:46:05 GMT
From: Chang-An Hsiao <chsiao@intrepid.interaccess.com>
Subject: UDP Socket supported in Perl5?
Message-Id: <6ra8at$qvh$1@supernews.com>
Hi:
I was trying to write a RADIUS client program but Perl5 is complaining
about "Protocol not supported".
My question is whether Perl supports UDP socket call or not.
RADIUS is running on UDP 1645.
Anyone has experience on it? Thanks in advance!
Andrew Hsiao
ahsiao@interaccess.com
------------------------------
Date: Mon, 17 Aug 1998 16:02:35 -0400
From: "Pete Keefe" <pete.keefe@eds.com>
Subject: Re: WIN32::NetAdmin User Management
Message-Id: <6ra27q$hkv$1@news.ses.cio.eds.com>
See the Win32::AdminMisc module. The ::UserGetAttributes call returns the
NT users full name.
<snip>, Win32::NetAdmin does not appear to support >the 'Full Name' <snip>
------------------------------
Date: Mon, 17 Aug 1998 16:00:25 -0400
From: "Pete Keefe" <pete.keefe@eds.com>
Subject: Re: WIN32::NetAdmin User Management
Message-Id: <6ra23p$hcu$1@news.ses.cio.eds.com>
See the Win32::AdminMisc module. ::UserGetAttributes returns the full user
name.
Kevin Genus wrote in message <6r9fm6$ifh8@hernnews.us.newbridge.com>...
>I'm in the process of building a web based user management system for my
>domain. There is one problem, Win32::NetAdmin does not appear to support
>the 'Full Name' feature of the user container.
>
>How are people getting around this, or at least getting the full name added
>to the user field?
>
>Kevin Genus
>Newbridge Networks Inc.
>kgenus@newbridge.com
>
>
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3468
**************************************