[8529] in Perl-Users-Digest
Perl-Users Digest, Issue: 2146 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 20 16:07:49 1998
Date: Fri, 20 Mar 98 13:00:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Mar 1998 Volume: 8 Number: 2146
Today's topics:
Accessing files on another server..... <andy@kirkland.demon.co.uk>
Re: Accessing files on another server..... (Mike Stok)
Re: Arrays & hashes <jkry3025@comenius.ms.mff.cuni.cz>
ARRRG! "recommended" CPAN update stopped CPAN module f (James B. Crigler)
Re: chdir in win32 (Craig Berry)
Re: chdir in win32 <dcameron@nospam.bcs.org.uk>
Re: display lines <jkry3025@comenius.ms.mff.cuni.cz>
Document contains no data <rsauve@securenet.net>
Re: Evaluate expression inside print "" <jkry3025@comenius.ms.mff.cuni.cz>
Re: Evaluate expression inside print "" <rxruck2@uswest.com>
FileHandle - I really wish it had a 'file_name' method! <mgregory@asc.sps.mot.com>
Re: Help with Perl code (Craig Berry)
Re: How to implement "timeouts" in perl? <paganini@paganini.net>
Re: How to take the icecream from the trashbox? <paganini@paganini.net>
Re: Need a perl function <langford@uiuc.edu>
Re: Newbie question: using split() while ignoring regex <paganini@paganini.net>
Re: Perl Daemons <paganini@paganini.net>
Re: Perl Daemons (Neil Briscoe)
Re: Perl Daemons dfrench@aig.vialink.com
Quota 1.0: hints for AIX 4.2 available ? <courcoul@campus.qro.itesm.mx>
qw (was: Re: Newbie question: using split() while ignor <jkry3025@comenius.ms.mff.cuni.cz>
Re: Selling Perl applications effectively (Bennett Todd)
Re: sending mail through perl <jkry3025@comenius.ms.mff.cuni.cz>
Re: sending mail through perl (Neil Briscoe)
Re: Wanted: email address gleaner joneil@cks.ssd.k12.wa.us
Re: what is wrong with being a novice ?? (Andy Lester)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Mar 1998 17:05:22 +0000
From: Andy Kirkland <andy@kirkland.demon.co.uk>
Subject: Accessing files on another server.....
Message-Id: <3512A1D2.7DC5@kirkland.demon.co.uk>
A couple of questions.....
Is it possible using Perl (in a CGI script) to read/search files on
another server? Eg: searching a file at
http://www.somewhere.com/file.txt or searching for a file on
my.unix.server/home/mydir/anotherfile.txt.
Also....
Is it possible to detect whether an http:// location exists (ie is it
possible to detect an error 404 before a script prints out the location
?) - this seems to happen on a typical search engine where you submit a
URL and it says that the URL returned a 404.
Please mail as well as post comments.
TIA.
--
Andy Kirkland
------------------------------
Date: 20 Mar 1998 20:02:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Accessing files on another server.....
Message-Id: <6eui07$n9s@news-central.tiac.net>
In article <3512A1D2.7DC5@kirkland.demon.co.uk>,
Andy Kirkland <andy@kirkland.demon.co.uk> wrote:
>Is it possible using Perl (in a CGI script) to read/search files on
>another server? Eg: searching a file at
>http://www.somewhere.com/file.txt or searching for a file on
>my.unix.server/home/mydir/anotherfile.txt.
You can use LWP::Simple, part of the libwww bundle available from a CPAN
(comprehensive perl archive network, see http://www.perl.com for more
info) site, to retrieve documents from servers.
>Also....
>Is it possible to detect whether an http:// location exists (ie is it
>possible to detect an error 404 before a script prints out the location
>?) - this seems to happen on a typical search engine where you submit a
>URL and it says that the URL returned a 404.
>
>Please mail as well as post comments.
Maybe, maybe not. The server may be set up so that a URL is available to
some locations and not others, and there's always the possibility that the
URL becomes unavailable between the time you check it and the checked URL
is used later.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 20 Mar 1998 19:54:16 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Arrays & hashes
Message-Id: <351339E8.314A@comenius.ms.mff.cuni.cz>
Eric Bohlman wrote:
>
> Matt Burgoon <infinity@gamersinn.com> wrote:
> : I have an array and hash set up like:
> : $accounts[0]{amount}=200;
> : $accounts[3]{paid_till}=890338928;
>
> I.E. each element of your array is a reference to an anonymous hash/
>
> The key thing to remember is that
> $accounts[$_] is a reference to a hash. A reference to anythingy is a
> scalar. So "$thishash=$accounts[$_]" makes "$thishash" a reference to
> the hash you're trying to work with. "$$thishash" is the actual hash,
I think you meant %$thishash. $$thishash would give you
"Not a SCALAR reference at ..." if you'd try to use it as a hash :
%hash = $$thishash;
or
@keys = keys $$thishash;
Only when you are retrieving a value from the hash the % changes to $.
It's the same as %hash versus $hash{key}.
> so
> "$$thishash{amount}" is the value corresponding the the "amount" key in
> the current hash (remember that dereferencing is done before
> subscripting, so it's equivalent to "${$thishash}{amount}").
Jenda
------------------------------
Date: 20 Mar 1998 14:45:12 -0500
From: crigler@seo.com (James B. Crigler)
Subject: ARRRG! "recommended" CPAN update stopped CPAN module from working!
Message-Id: <lzafalqh87.fsf@jim.seo.com>
So I logged on as root, ran
perl -MCPAN -eshell
and at the "cpan>" prompt commanded
r
Which gave me a list of things that are "recommended" for updating.
One item on the list that ensued was was IO version 1.19, so I entered
install IO
It ran and installed. I exited to the root prompt, then restarted with
perl -MCPAN -eshell
again and got these error lines:
IO object version 1.19 does not match $IO:: 1.15 at /usr/lib/perl5/i386-linux/5.00404/DynaLoader.pm line 185.
BEGIN failed--compilation aborted at /usr/lib/perl5/i386-linux/5.00404/IO/Seekable.pm line 50.
BEGIN failed--compilation aborted at /usr/lib/perl5/i386-linux/5.00404/IO/File.pm line 111.
BEGIN failed--compilation aborted at /usr/lib/perl5/CPAN.pm line 26.
BEGIN failed--compilation aborted.
How can I repair my installation so I can use the CPAN module again?
--
Jim Crigler <crigler@seo.com>
Schwartz Electro-Optics, Inc. Voice: (407)298-1802 x200
3404 N. Orange Blossom Trl. Fax: (407)290-9666
Orlando FL 32804-3498 USA
------------------------------
Date: 20 Mar 1998 19:15:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: chdir in win32
Message-Id: <6euf7n$6as$2@marina.cinenet.net>
dgriffith2@bender.com wrote:
: i'm using perl for win32 v5, the chdir function doesn't seem to work, no
: matter what syntax i use it will not change the dir out of
: c:\inetpub\wwwroot
I have my suspicions what's going on -- are you by any chance specifying
the target dir using single backslashes as dir separators? Post a small
sample of your code if this hint doesn't lead directly to the solution.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 20 Mar 1998 20:29:44 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: chdir in win32
Message-Id: <01bd543e$c76480c0$a52b63c3@dns.btinternet.com>
The following seems to work for me:
print 'Enter directory (default is perl\docs): ';
chomp($dir = <>);
$dir = 'c:\program files\perl315\docs\perl' if ($dir eq '');
chdir $dir or die "Cannot change dir $ERRNO\n";
I'm using 5003_07. Can you supply a piece of your code?
HTH
Duncan Cameron
--
Remove 'nospam.' to get my return address.
dgriffith2@bender.com wrote in article <3512B68B.721D@bender.com>...
> i'm using perl for win32 v5, the chdir function doesn't seem to work, no
> matter what syntax i use it will not change the dir out of
> c:\inetpub\wwwroot
>
> any ideas?
>
> ...pls forgive my newbie-ism
>
> djg
>
------------------------------
Date: Fri, 20 Mar 1998 20:19:43 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: display lines
Message-Id: <35133FDF.2CF2@comenius.ms.mff.cuni.cz>
Chuck Stewart wrote:
>
> I need to display a delimited file that has 1000 lines at 50 lines at
> a time so the html is not so huge. How can I do this? Thanks...
print "Content-type: text/html\n\n";
get the parameters to your CGI into hash %query
# use CGI;
# ... # I don't use it, so I don't know it
# # or
# use Deurl qw(as query); # http://www.chipnet.cz/depot/perl.htm
printHeader;
open IN, "<$filename";
$i=1;
while ($i<$query{next}) {
<IN> or last;
$i++
}
$query{next}+=50;
while ($i<$query{next}) {
$_=<IN> or last;
chomp;
printLine $_;
$i++
}
close IN;
printHREF "this_script.pl?next=$query{next}";
# # or better
# printHREF "this_script.pl?",enurl(\%query);
# # to preserver the other parameters
printFooter;
__END__
------------------------------
Date: Fri, 20 Mar 1998 14:59:05 -0500
From: "R. Sauvi" <rsauve@securenet.net>
Subject: Document contains no data
Message-Id: <3512CA89.2E2C@securenet.net>
I'm new to perl, so please bear with a possibly 'stupid' question.
I get the feeling that I'm missing something fundamental.
I have searched extensively (FAQs, etc), but have not seen any
reference to my problem, although I've seen the symptom before.
I simply want my perl script to write to a file, gathering info
from a form using the post method.
Here's the problem: everything works fine but at every 'submit' I
get a 'Document contains no data' message. I only want perl to
write to my file, could that be the problem? Does perl automatically
want to return some form of data and if so, could I simply return it
to a hidden frame? The script is basically as follows . . .
#!/../perl
$file = '/../../../file.txt';
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
open(CHT,">>$file") || die("Unable to open file.");
print CHT "$FORM{user} -- \n";
print CHT "\t$FORM{says}\n\n";
close(CHT);
Any help would be appreciated.
Richard
------------------------------
Date: Fri, 20 Mar 1998 20:52:10 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: Evaluate expression inside print ""
Message-Id: <3513477A.612E@comenius.ms.mff.cuni.cz>
Gary Trachier wrote:
>
> Hi Everyone,
>
> I've been scratching my head over this one, and it is time to ask for
> help. I want to evaluate an expression inside double-quotes of a print
> statement. How can it be done?
>
> Here is an example:
>
> {
> my $var = 5;
>
> print "N plus one is ($var + 1)\n";
print "N plus one is ",$var + 1,"\n"; # :-)
> }
> It should print out
> N plus one is 6
>
> Simple, right?
>
> Thanks for your help.
>
> -Gary
<rest of this post is not for the fainthearted!>
If you realy need to include a piece of perl into a string
(which may be reasonable if using here-doc) try this :
print "N plus one is ${$;.($_=$var + 1)}$_.\n";
Ugly hack, isn't it ;-)
Explanation:
$_=$var + 1 = sets the $_ variable to the result of your computation
$;.(...) = prepends the result by the value of $;
$; is just a variable that is always defined and
it's almost garantied that there will be no
variable starting by it's contents
${$;.(...)} = returns the value of a variable whose name is
computed by evaluating the $;.(...)
the variable should be undefined
${$;.(...)}$_ = prints nothing folowed by your desired text
BTW, if you use here-doc and do not want to have to
"close" string only to be forced to write print <<"*END*" again
you may do this :
print <<"*END*",$var+1,<<"*END*";
The lenthy text
for many lines
*END*
and the rest
of the lenthy text.
*END*
HTH, Jenda
------------------------------
Date: Fri, 20 Mar 1998 14:08:27 -0600
From: Ryan Rucker <rxruck2@uswest.com>
Subject: Re: Evaluate expression inside print ""
Message-Id: <3512CCBB.8A4FAA12@uswest.com>
Gary,
I tried this and it worked:
my $var = 5;
print ("N plus one is ", $var + 1, "\n");
HTH,
Ryan
Gary Trachier wrote:
> Hi Everyone,
>
> I've been scratching my head over this one, and it is time to ask for help. I want to evaluate an expression inside double-quotes of a print statement. How can it be done?
>
> Here is an example:
>
> {
> my $var = 5;
>
> print "N plus one is ($var + 1)\n";
> }
> It should print out
> N plus one is 6
>
> Simple, right?
>
> Thanks for your help.
>
> -Gary
------------------------------
Date: 19 Mar 1998 23:33:13 -0800
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: FileHandle - I really wish it had a 'file_name' method!
Message-Id: <r8pvjhddfq.fsf@asc.sps.mot.com>
Here's the quandary: suppose I write all these groovy packages that
operate on an open FileHandle (so someone else has already worried
about openinging the FileHandle & what to do if it fails).
Now, in the package I'm parsing the input from the FileHandle (say)
and I find an error.
Gee, wouldn't it be nice to be able to issue a warning message with
the file name in it? But how!?
It seems to me that it would be simple enough for the FileHandle class
to provide a method that returns the string that was given in the open
(or whatever) method. Sure, it might return me something like
Error: bad input while parsing '> foo.txt', stopped at line 2 of blah.pl
which is not all that pretty, but it's better than
die "Bad input parsing some file or other";
Any ideas or help. I think I'd derive a class from FileHandle and do
this, except for the scary words at the end of the FileHandle
description!
Any help much appreciated... email copies of responses even more so!
Thanks,
Martin.
------------------------------
Date: 20 Mar 1998 18:42:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help with Perl code
Message-Id: <6euda9$6as$1@marina.cinenet.net>
Bart Lateur (bart.mediamind@tornado.be) wrote:
: Craig Berry wrote:
:
: > s/(\w\1)/($1)/g
:
: I wouldn't think this can possibly work. On the left side, \1 is
: referencing to something containing itself. Could I call this a
: recursive definition?
I really really need to drink more coffee before hitting c.l.p.m. Of
cours my version doesn't work, and yours
: s/((\w)\2)/($1)/g;
does. That's my second parentheses-related error in a week. I don't
like this trend.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 20 Mar 1998 13:04:26 -0600
From: Marco Paganini <paganini@paganini.net>
To: jay@rgrs.com
Subject: Re: How to implement "timeouts" in perl?
Message-Id: <6euega$re3$1@nnrp1.dejanews.com>
Hello!
> Fear not :-) In the context of your original problem, none of what you
> are worrying about here is a problem. Your problem had to do with
> timing-out a connect using alarm in an eval.
>
> If you're blocked, waiting on a slow system call like connect, and you
> receive and handle the signal SIGALRM, the connect is interrupted and
> fails (i.e. it's not restarted). There are no issues of malloc or
> non-reentrant code.
>
> You say you're now using IO::Socket::INET and it works fine. The
> version that comes with a distribution of perl implements the timeout
> using the method that you were trying to avoid. Again I don't think
> this is a problem and I've have never heard of anyone having a problem
> with it dumping core when timing-out a connect.
Hmmm...
God blesses the valiant one... :)
It *happened* to me. I found it to be a strange thing but, after
checking the perlipc code, my guesses proved to be correct. I know
it's strange, but it's also documented and it happens!
I don't believe in witches, but they DO exist... :)
(old saying)
Read ya
Paga
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 20 Mar 1998 13:41:54 -0600
From: Marco Paganini <paganini@paganini.net>
Subject: Re: How to take the icecream from the trashbox?
Message-Id: <6eugpq$uik$1@nnrp1.dejanews.com>
Hi!
> #Start
> $trashbox =":trash:trash:chocolate-icecream:arrow:trash:trash:trash";
> #The location of the icecream is just behind the ':arrow'
> $icecream_only = #What?
> #End
Well, you didn't mention _how_ you want to choose the part you need.
Do you need a specified field (I noticed your separators are ":")?
Or perhaps a fixed position inside the string? Or a fixed string
inside the big string?
Send more details.
Read ya
Paga
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 20 Mar 1998 13:49:22 -0600
From: Jacob Langford <langford@uiuc.edu>
Subject: Re: Need a perl function
Message-Id: <3512C841.7B895E30@uiuc.edu>
wsayegh@lynx.neu.edu wrote:
> Does anyone have a PERL function that reads the directory and lists all the
> files which are not hidden, ie the files which do not start with a ".", then
> stores them in an array
>
> Waseem Sayegh
> wsayegh@lynx.neu.edu
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
@files = glob("*");
------------------------------
Date: Fri, 20 Mar 1998 13:28:27 -0600
From: Marco Paganini <paganini@paganini.net>
To: nbouton@unixg.ubc.ca``
Subject: Re: Newbie question: using split() while ignoring regexps
Message-Id: <6eufta$t6r$1@nnrp1.dejanews.com>
Hello!
> while( defined( $line = <spells> ) ) {
> ( $idx, $name, ... ) = split( /,"/, $line );
>
> $name =~ s/"//;
> $house =~ s/"//;
> ...
> }
>
> Is there some way to ignore all text between pairs of "'s?
Well, to make the answer shorter, let's suppose your datafile
has only 3 fields, being the first one without the quotes and
the following ones with quotes. Just expand the solution to
cover your specific problem:
($a, $b, $c) = m/(.*?),(\".*?\"),(\".*\")/;
Note that I'm using $a,$b and $c. Just use a regexp like this
one and your program will (hopefully :)) work. Add as many
vars as you wish and use =~ if you need to search a specific
var. You may consider using "/o" on the "m" operator to
improve performance.
Read ya
Paga
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 20 Mar 1998 13:38:34 -0600
From: Marco Paganini <paganini@paganini.net>
Subject: Re: Perl Daemons
Message-Id: <6eugga$u3r$1@nnrp1.dejanews.com>
Hello!
> hi, i have a perl script that i want to make into a daemon. how would
> i go about doing it?
There's a module on cpan (http://www.perl.org/cpan) that does
exactly what you want.
> i have seen some programs for win32 that change perl scripts to exe
> files? is there a similar program for unix?
No, you don't need this sort of thing in Unix (I assume you're using
unix, since you used the "daemon" terminology).
Read ya
Paga
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 20 Mar 1998 20:47:30 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Perl Daemons
Message-Id: <memo.19980320204729.32767A@skep.compulink.co.uk.cix.co.uk>
In article <3511E531.64FE39C0@mail.earthlink.net>,
bholzman@mail.earthlink.net (Benjamin Holzman) wrote:
> > The code to do this is :-
> >
> > #!/usr/local/bin/perl
> >
> > if (fork()) { # Invoke a child
> This is unlikely be very helpful in win32, I believe...
>
The question was "Is there a similar thing for this in Unix?" Try reading
the question. I do so hope you're not a provider of tech. support.
You've also had my mail regarding the Cygnus Development Kit. For the
benefit of anyone else - compile the standard distribution using the cdk
(which you can find on http://www.Cygnus.com) and you have a Win32 perl
that does the right thing when presented with fork();
Nevertheless, I can't help agreeing with Tom's "Win32 is unlikely to be
helpful to anyone" ;-))). Hope I've paraphrased that roughly accurately.
Regards
Neil
------------------------------
Date: Fri, 20 Mar 1998 14:44:43 -0600
From: dfrench@aig.vialink.com
Subject: Re: Perl Daemons
Message-Id: <6eukcb$4mi$1@nnrp1.dejanews.com>
In article <3512389d.8190327@news.mindspring.com>,
kucera@mindsrping.com ( Mark Kucera) wrote:
>
> hi, i have a perl script that i want to make into a daemon. how would
> i go about doing it?
>
> i have seen some programs for win32 that change perl scripts to exe
> files? is there a similar program for unix?
>
I assume these are two separate unrelated questions.
answer to question number one:
make an entry in your /etc/inittab file to start your perl script at boot time
OR create an "rc" file which starts your script at boot time OR start your
script at the command line using "nohup" in the background.
answer to question number two:
why do you want to do this??? I have seen such things for shell scripts but
the reason for doing this never made much sense. I have not seen a perl
script compiler yet, but check http://aixpdslib.seas.ucla.edu There may be
one there for AIX.
Dana French
dfrench@aig.vialink.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 20 Mar 1998 12:58:48 -0600
From: "Juan M. Courcoul" <courcoul@campus.qro.itesm.mx>
Subject: Quota 1.0: hints for AIX 4.2 available ?
Message-Id: <3512BC68.B4E0332@campus.qro.itesm.mx>
I'm using Tom Zoerner's Quota module to access users' quota info in a front-end
script that warns my users when they log in. This works just fine on our twin
Sun Solaris mail servers.
However, I would like to extend this functionality to an AIX host. Would some
kind soul happen to have a hints file for AIX 4.2.1, so I could get Quota up and
running on that host ?
Thanks for any help.
John Courcoul
Monterrey Tech,
Queretaro Campus
Mexico
------------------------------
Date: Fri, 20 Mar 1998 19:45:54 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: qw (was: Re: Newbie question: using split() while ignoring regexps)
Message-Id: <351337F2.1083@comenius.ms.mff.cuni.cz>
Eric Bohlman wrote:
>
>
> Yes, it's well-known that such a naive use of split() won't work. It's
> so well known that there's a section in the Perl FAQ about dealing with
> CSV files. It's such a frequently-encountered problem that, sometime
> after the FAQ entry was written, someone wrote a Text::CSV module and put
> it up on CPAN. Therefore, you have many more options open to you than
> re-inventing the wheel; take advantage of them.
Taking into account how often do you need something like this
and how easy is it to split values on a whitespace
I wonder why qw works the way it does instead of taking quotes into
account.
qw(what "ever you" want)
==
split ' ', 'what "ever you" want'
==
( 'what', '"ever', 'you"', 'want')
I think it would be much more usefull if
qw(what "ever you" want) returned ('what','ever you','want').
If we could then specify a different "input_field_separator" by some
$whatever,
the solution to his question would be :
while (<INPUT>) {
$INPUT_FIELD_SEPARATOR=',';
@row = eval "qw{$_}"; # suppose that the data do not contain a closing
brace
# you may use here-doc syntax if you care
do_something_with @row;
}
And if perl would be so kind to provide us with
qqw() = interpolate the variables in the script and then split by
$INPUT_FIELD_SEPARATOR taking quotes into account.
we wouldn't have to do the dangerous eval(). That would be cool.
Jenda
------------------------------
Date: Fri, 20 Mar 1998 18:55:19 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Selling Perl applications effectively
Message-Id: <slrn6h5fcc.eh8.bet@ritz.mordor.net>
>I would like to know if anyone has come up with a way to sell
>applications written in Perl without the risk of the buyer plagerizing
>your code. My company would like to sell our perl applications and want
>to do so without risking theft of our code.
Write your contract clearly, prohibiting theft of your code, make sure you get
a signed copy if it before you ship code, and invest whatever cost you think
best on enforcement. Zero is about right, unless you really plan on going out
of your way to do business with chronic thieves.
It's true that some vendors operate on a complete assumption that all their
customers are amoral theives, and so they invest engineering time and money
into making their code less maintainable, inventing copy-protection hacks,
jiggering up ``network license servers'', and so on. I don't do business with
such vermin; life's too short.
-Bennett
------------------------------
Date: Fri, 20 Mar 1998 20:59:33 -0800
From: Jan Krynicky <jkry3025@comenius.ms.mff.cuni.cz>
Subject: Re: sending mail through perl
Message-Id: <35134935.4B4D@comenius.ms.mff.cuni.cz>
Francois_Bor@bde.espci.fr wrote:
>
> hello !
>
> i would like to send amils through my perl program.
> I have found in a book that i should make a pipe, so that i have done
> it that way :
>
> $filedemel = "| /bin/mailx -s "`cat subjectfile`" `cat tofile`";;
> open (MAILE, $filedemel);
> ....
>
> the trouble is that :
> - i have to put " " after -s for the subjet ( cause mailx need it)
> - but when the perl program meet this "", it think it is the end of
> the one before : $findemel = "....,
> so that it doesn't work.
>
> i search a way to send a subject trough mailx in perl program. Could u
> help me ?
>
> thank u.
You should read man perlsyn and man perlop !
1. Using qq{}
$filedemel = qq{| /bin/mailx -s "`cat subjectfile`" `cat tofile`};
2. escaping the quotes
$filedemel = "| /bin/mailx -s \"`cat subjectfile`\" `cat tofile`";
3. Since you do not interpolate any variables in the string you may use
single quotes.
$filedemel = '| /bin/mailx -s "`cat subjectfile`" `cat tofile`';
4. It's more recomendable to use socket() based modules.
It's quicker and more portable. See CPAN ( http://www.perl.com/CPAN )
for Net::SMTP or http://www.chipnet.cz/depot/perl.htm for
SendMailEx.pm
or Mail::Sender.pm
HTH, Jenda
------------------------------
Date: 20 Mar 1998 20:47:41 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: sending mail through perl
Message-Id: <memo.19980320204741.32767B@skep.compulink.co.uk.cix.co.uk>
In article <6eub68$8ht$1@pinot.ext.jussieu.fr>, Francois_Bor@bde.espci.fr
() wrote:
> hello !
>
> i would like to send amils through my perl program.
> I have found in a book that i should make a pipe, so that i have done
> it that way :
>
> $filedemel = "| /bin/mailx -s "`cat subjectfile`" `cat tofile`";;
> open (MAILE, $filedemel);
> ....
>
> the trouble is that :
> - i have to put " " after -s for the subjet ( cause mailx need it)
> - but when the perl program meet this "", it think it is the end of
> the one before : $findemel = "....,
> so that it doesn't work.
>
> i search a way to send a subject trough mailx in perl program. Could u
> help me ?
>
Easiest way for what you're trying to do is :-
#!/usr/local/bin/perl
open(MAIL, "| /usr/lib/sendmail -t") || die "No sendmail available: $!\n";
select(MAIL); $| = 1;
print "To: someone@somewhere.com\n";
print "From: you@elsewhere.com\n";
print "Subject: The way to do it\n\n"; # Blank line separates headers
print "The mail message goes here, over multiple\n";
print "lines if need be.\n";
print ".\n"; # Some versions need the dot
close(MAIL);
I hope that helps.
Regards
Neil
------------------------------
Date: Fri, 20 Mar 1998 13:39:20 -0600
From: joneil@cks.ssd.k12.wa.us
Subject: Re: Wanted: email address gleaner
Message-Id: <6eugl0$u4c$1@nnrp1.dejanews.com>
In article <350FEE89.5AB9@glpbooks.BADMAIL.com>,
jp@glpbooks.BADMAIL.com wrote:
>
> Jerome O'Neil wrote:
> >
>
> > Sounds like SPAM to me.
>
> Do you call posts from your mom spam, too? Please, give a reason as
> to why the above might be spam. ---It's a specific response to a specific
> post. It's *ontopic* to both the newsgroup and the specific posts involved.
> Unless you're against books being created from NG archives, there's nothing
> 'spamlike' about my quest. If you're against such activity, that's one
thing.
> But posts about the subject are absolutely not spam. Unless you know
> netiquette otherwise?
No. I give my mother my e-mail address because I want to hear from her.
Hoever, if she 'gleaned' email addresses from usenet newsgroups and sent the
same message to everyone, then mom would be a spammer, just like you.
Please give a reason why sending the same unsolicited message to thousands of
people *isn't* spam. They aren't posts, they are Unsolicited Comercial
E-mail.
Jerome "My Mother is a SPAMMER" O'Neil
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 20 Mar 1998 19:03:39 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: what is wrong with being a novice ??
Message-Id: <6eueib$65c$1@usenet11.supernews.com>
: The only problem I find with the faq is that it is so damn long, maybe there
: could be a searchable knowledge base instead. I would be happy to program
So what's the worst that would happen? You might read something you
didn't intend to and learn something accidentally?
Bummer,
xoox,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2146
**************************************