[12726] in Perl-Users-Digest
Perl-Users Digest, Issue: 136 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 13 23:07:17 1999
Date: Tue, 13 Jul 1999 20:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 13 Jul 1999 Volume: 9 Number: 136
Today's topics:
Re: ** Working With Strings <sjs@yorku.ca>
Re: ** Working With Strings (Neko)
***HELP ME SEARCH <aafreddy@tin.it>
Re: Am i stupid, or REALLY tired? CGI help needed (shor bigcheese@my-deja.com
Re: Am i stupid, or REALLY tired? CGI help needed (shor (Martien Verbruggen)
Re: Calculations (Tad McClellan)
Re: Calculations (Martien Verbruggen)
Re: Can I unread a line from <>? (Neko)
Re: Can I unread a line from <>? <ltl@rgsun5.viasystems.com>
Re: Could somebody sort me out please? <uri@sysarch.com>
Re: Could somebody sort me out please? <uri@sysarch.com>
creating an array of hashes (Christian M. Aranda)
Re: creating an array of hashes <rick.delaney@home.com>
FTP Question <mamedeo@yahoo.com>
Re: FTP Question (elephant)
Re: Getting very irregular single 'name' field into fir <X@FACTOR.COM>
Re: how do i convert a integer to string. (Tad McClellan)
Re: How do YOU format your << data? (Anno Siegel)
How to Lock file <abc@abc.com>
Re: How to Lock file (elephant)
Re: Linux - Apache - Perl <bjl@uq.net.au>
Re: MIME::Lite and file attachments <hiller@email.com>
NEED HELP with SNMPTRAP< SNMPGET & SNMPSET in PERL <masroor@bga.com>
Re: Negation in regular expressions (elephant)
Re: Not Learning Perl <keithmur@mindspring.com>
Re: NT Path Question... (elephant)
Re: Old database is erased when I add new information (John Stanley)
Re: Password Entry (Tad McClellan)
Re: Password Entry (Martien Verbruggen)
Re: perl -e 'print "${\ord(s)}\n";' (Charles DeRykus)
Re: perl -e 'print "${\ord(s)}\n";' (Neko)
Re: perl -e 'print "${\ord(s)}\n";' (Tad McClellan)
Re: Reclaiming hashed memory <laurens@bsquare.com>
Re: Reclaiming hashed memory (Anno Siegel)
Re: Running PERL (elephant)
Re: Sending email by perl in NT <jpr@vcnet.com>
something that might help <surgie@bellsouth.net>
storing binary data in a database record <khowe@performance-net.com>
Re: What's faster: GDBM or Storable <stupid@pobox.com>
Re: Where might I find info. on "$_" <keithmur@mindspring.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 13 Jul 1999 19:05:14 -0400
From: Steven Smolinski <sjs@yorku.ca>
Subject: Re: ** Working With Strings
Message-Id: <931907736.1318838308@newshub.ccs.yorku.ca>
On Tue, 13 Jul 1999, Larry Rosler wrote:
><sjs_mrs@my-deja.com> says...
>> Matthew Zimmerman <mdz4c@node16.unix.Virginia.EDU> wrote:
>> [...pointed out my error...]
>> > which might be why Larry stomped on you. :)
>>
>> Thx for the pointer.
>>
>> At least your response to the buggy bit I posted was qw/helpful
>> illuminating informative/[rand 3];
>
>Which implies that even when you saw my response, saying you hadn't
>tested it, that you were too damned lazy to test it yourself then and
>find out what was wrong. Instead, you waited for someone else to spoon-
>feed you with the bug, then thanked them for doing it.
..which proves (not just implies) that you jump to conclusions,
and insult people without knowing what you're talking about.
Nothing in what I wrote implies I did not find out myself what
was wrong.
I happened to read both posts sequentially in a summary mailed
to me. In fact, even in that summary, I stopped at your post to find
my own error. After I found it, I went to finish reading the thread,
and thought I'd thank the guy who posted a helpful, rather than
abusive, correction.
>Things like this are tipping me further to the Abigail side of The
>Force.
That makes two of us. I've read very nearly all of your posts since
starting to read this group, and I've learned quite a bit from you. But
obviously I will have to restrict that to matters of programming and not to
other areas of critical judgment.
Steve
------------------------------
Date: 14 Jul 1999 01:22:20 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: ** Working With Strings
Message-Id: <7mgooc$e6m$0@216.39.141.200>
On 13 Jul 1999 13:53:43 -0700, merlyn@stonehenge.com (Randal L. Schwartz)
wrote:
>>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
>
>Larry> [Posted and a courtesy copy mailed.]
>Larry> In article <m1pv1w30ve.fsf@halfdome.holdit.com> on 13 Jul 1999 10:39:33
>Larry> -0700, Randal L. Schwartz <merlyn@stonehenge.com> says...
>>> >>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
>
>Larry> xxx% perl -le 'print qw(lazy rude thoughtless insufferable)[rand 4]'
>Larry> rude
>Larry> xxx% perl -v
>
>Larry> This is perl, version 5.005_57 built for i686-linux
>
>Aha... in 5.6-pre, they must've added an extra set of fake parens
>around a qw. Interesting. :)
Hmm. Fake parenthesis around everything?
($mday, $mon, $year) = localtime[3..5];
$package = caller[0];
$last_word = split[-1];
($f2, $f3) = split(/:/, $foo)[2,3];
$last_line = <FILE>[-1];
@dirs = grep(/^\.\.?$/, @dirs)[0..9];
@dirs = grep /^\.\.?$/, @dirs [0..9];
@list = my_sub('foo', 'bar')[8];
@list = my_sub 'foo', 'bar' [8];
Well, maybe not. :)
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Wed, 14 Jul 1999 01:59:33 +0200
From: "Freddy" <aafreddy@tin.it>
Subject: ***HELP ME SEARCH
Message-Id: <7mgjrq$7e4$1@nslave1.tin.it>
This is a multi-part message in MIME format.
------=_NextPart_000_0010_01BECD9C.84A5C040
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm searching a whatsnew on site (auto index of last modified html =
document) CGI; Can someone help me to find it??
Freddy
------=_NextPart_000_0010_01BECD9C.84A5C040
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Times New Roman" size=3D2>I'm searching a whatsnew on =
site (auto=20
index of last modified html document) CGI; Can someone help me to find=20
it??</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3D"Times New Roman" =
size=3D2>Freddy</FONT></DIV></BODY></HTML>
------=_NextPart_000_0010_01BECD9C.84A5C040--
------------------------------
Date: Wed, 14 Jul 1999 01:53:48 GMT
From: bigcheese@my-deja.com
Subject: Re: Am i stupid, or REALLY tired? CGI help needed (short)
Message-Id: <7mgqj9$4mh$1@nnrp1.deja.com>
Well, it took me a while to find, but you need a # in your SSI tag, so
it would be
<!--#exec cgi="dumpgm.cgi"-->
which is an easy mistake to make, but still...
Get More Sleep
:)
-Dan
BTW, there's a really good SSI guide at
http://irt.org/articles/js166/index.htm
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 14 Jul 1999 02:41:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Am i stupid, or REALLY tired? CGI help needed (short)
Message-Id: <fNSi3.112$xg5.8364@nsw.nnrp.telstra.net>
In article <7mg1hj$vb6$1@nntp6.atl.mindspring.net>,
"Kevin Alexander" <kalexa2@_NOSPAM_mindspring.com> writes:
> Am I dumb? I can't seem to get this stupid script to
> work at all! Is there a typo that I'm not seeing? Heck
The script works fine. Nothing wrong with it.
Run it from the command line. Use the -c flag if you just want to
check the syntax.
> I call it with an SSI, but nothing pops out. I
> CHMODed it to 755. I call it with a
> <!--exec cgi="dumpgm.cgi"-->
> but nothing..
Oh. It's one of those questions. You should ask in a group about your
webserver how to enable that sort of stuff, and check whether your
server actually has it enabled. I know that most web servers won't
parse that bit of HTML comment. Yours may be different, but again: Ask
in a group about this sort of stuff in the comp.infosystems.www.*
hierarchy. Here we talk about perl, and there's nothing wrong with the
perl part of your question.
> Am I missing something here?? I really am better
> than this, it's just that I'm really tired and I
> can't see straight.
So get some sleep :)
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Tue, 13 Jul 1999 17:01:07 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Calculations
Message-Id: <je9gm7.kvh.ln@magna.metronet.com>
Susan C. Sayce (susan@anthony1.force9.co.uk) wrote:
: How do you get perl to add 2 numbers together??
I think you can do that with the addition operator.
Perl's operators are described in the perlop.pod file that
came with perl.
: Also is there a function to test to see if a string is numeric such as the
: "isnumeric(string)" in VB
Perl FAQ, part 4:
"How do I determine whether a scalar is a number/whole/integer/float?"
: Thanks
Uh huh.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 02:56:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Calculations
Message-Id: <S%Si3.115$xg5.8364@nsw.nnrp.telstra.net>
In article <HoMi3.2652$34.2848@wards>,
"Susan C. Sayce" <susan@anthony1.force9.co.uk> writes:
> Hi,
> How do you get perl to add 2 numbers together??
Hmm. That is a quite complicated matter in Perl. Languages like Basic
are much better at this sort of thing, which is why you will never see
accountancy software written in Perl, but you'll find many written in
Visual Basic.
$_ = <<EO_SUM;
123456
++++++
234567
======
??????
EO_SUM
s*\s+**gs&&s=\++=+=s&&s-\=+--s&&s!\?+!!s;
print eval, "\n";
There may be easier ways of doing it, but I have never found one.
Maybe because I never read the documentation. Too lazy, I guess. And
I'm too stingy to buy a good book on perl. And my web browser is
allergic to www.perl.com.
> Also is there a function to test to see if a string is numeric such as the
> "isnumeric(string)" in VB
I believe that the FAQ answers that question.
# perldoc perlfaq4
=head2 How do I determine whether a scalar is a number/whole/integer/float?
Martien
--
Martien Verbruggen |
Interactive Media Division | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: 14 Jul 1999 02:09:13 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Can I unread a line from <>?
Message-Id: <7mgrg9$q6n$0@216.39.141.200>
On Tue, 13 Jul 1999 05:28:32 GMT, svmcguir@syr4-22c.twcny.rr.com (Scott V.
McGuire) wrote:
>I'm processing a file (usually, sometime standard input) in chunks.
[snip]
>My problem is that this way, at the end of a chunk, I'm reading a line
>which belongs to the next chunk. Is there a nice way to put it back
>or otherwise make sure its included at the top of the next chunk?
tie *FOO, Pushback => $file or die "Can't open '$file: $!";
$line = <FOO>; # Read line.
print FOO $line; # Push line back into queue.
$line = <FOO>; # Repeat.
package Pushback;
sub TIEHANDLE {
my ($class, $file) = @_;
my $fh = \do {local *FH; *FH}; # Two *FH to quiet warnings.
open $fh, "<$file" or return;
bless $fh, $class;
}
sub READLINE {
my $self = shift;
wantarray ? (splice(@{*$self}, 0), readline *$self) :
@{*$self} ? shift @{*$self} :
readline *$self;
}
sub PRINT {
my $self = shift;
local $^W;
push @{*$self}, join($,, @_) . $\;
}
sub CLOSE {
my $self = shift;
$self = undef;
}
__END__
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 14 Jul 1999 02:17:13 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Can I unread a line from <>?
Message-Id: <7mgrv9$17f$1@rguxd.viasystems.com>
Scott V. McGuire <svmcguir@syr4-22c.twcny.rr.com> wrote:
:>I'm processing a file (usually, sometime standard input) in chunks.
:>Each chunk is identified by a regular expression. The code looks
:>something like:
:>while(stuff left to do){
:> initialize
:> while( ($line = <>) =~ Some Regular Expression){
:> do something
:> }
:>}
:>My problem is that this way, at the end of a chunk, I'm reading a line
:>which belongs to the next chunk. Is there a nice way to put it back
:>or otherwise make sure its included at the top of the next chunk?
The sample you show doesn't lend itself to this, but consider the
"redo" loop control. The example in Chapter 2 of the Blue Camel and
what you get from "perldoc -f redo" are both apropo to your subject
line. But you would need to rethink your code structure to use it.
I don't see "redo" used often; perhaps because it doesn't have a
counterpart in other popular languages? I've recently found it useful.
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: 13 Jul 1999 21:31:53 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Could somebody sort me out please?
Message-Id: <x74sj8nhiu.fsf@home.sysarch.com>
>>>>> "PG" == Pete Gilbert <pkg@studbox.uni-stuttgart.de> writes:
PG> Ian Wilkinson wrote:
>>
>> I'll try to be brief - and thanks for any help received.
>>
>> I'm trying to sort the rows of a flat file database into order, by two different fields - location and price. I want prices
>> sorted in descending numeric order within each location, ordered alphabetically, thus:-
PG> not exactly sure what all your code does, but you might try something
PG> along the lines of:
PG> @row = split (/\|/, $row);
PG> push(@all_rows, \@row);
that pushes a reference to @row onto @all_rows. i don't think you meant
to do that. if @row is not my'ed in a loop then you will overwrite @row
and have many copies of the last record.
try:
@all_rows = map [ split '\|', $_], @rows
PG> @sorted_rows = sort { $a->[0] cmp $b->[0] || $a->[1] <=> $b->[1] }
PG> (@all_rows);
that is slow. use the schwartz, luke.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 13 Jul 1999 21:33:51 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Could somebody sort me out please?
Message-Id: <x71zecnhfk.fsf@home.sysarch.com>
>>>>> "B" == Brownie <cbrown@rmi.nospam.net> writes:
B> Ian Wilkinson <ian@no-spam4site.co.uk> wrote:
>> I'm trying to sort the rows of a flat file database
B> I see this time and again.
B> What the hell is a "flat file database"?
B> sheeesh...
why so upset grasshopper? the term describes exactly what it is. a flat
file is just a normal file with no external index info, and it usually
is plain text. to make it a database, all you do is have fields in each
line usually separated by a tab or | or something else.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 14 Jul 1999 02:11:35 GMT
From: christianarandaOUT@OUTyahoo.com (Christian M. Aranda)
Subject: creating an array of hashes
Message-Id: <378bf1ba.21589293@news.bmc.com>
Folks,
I've written the following code to create an array of hashes and,
while it works, probably isn't the right / best way to do it. This is
the first time I've really done an array of hashes, so I'm looking for
any help you can offer.
$y = 0;
while ( <FLAT> ) {
@fields = unpack ( "a24a20@unpackKey", $_ );
for ( $x = 0; $x < @columnHead; $x++ ) {
$fields[$x] =~ s/^[\s]+//;
#print "setting sysData[$y]\{$columnHead[$x]\}
= $fields[$x]\n";
$sysData[$y]{$columnHead[$x]} = $fields[$x];
}
$y++;
}
an explaination:
@fields is the array containing the actual data that of use.
@columnHead is the array containing the names of the columns
pertaining to @fields
the reason I'm setting it up as such is because it's very helpful if I
can organize the data in such a way that I can do:
print "This was started at $sysData[0]{STARTTIME}";
Obviously, the usage will be more complicated, but since I am only
demonstrating...
Thanks in advance for any and all help / comments.
----------------------------------------
Christian M. Aranda
Performance Consultant
BMC Software - Waltham, MA
------------------------------
Date: Wed, 14 Jul 1999 02:56:51 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: creating an array of hashes
Message-Id: <378BFC3F.E553CCFA@home.com>
Christian M. Aranda wrote:
>
> $y = 0;
> while ( <FLAT> ) {
> @fields = unpack ( "a24a20@unpackKey", $_ );
>
> for ( $x = 0; $x < @columnHead; $x++ ) {
> $fields[$x] =~ s/^[\s]+//;
> #print "setting sysData[$y]\{$columnHead[$x]\}
> = $fields[$x]\n";
> $sysData[$y]{$columnHead[$x]} = $fields[$x];
> }
> $y++;
> }
I don't think you had a specific question but you can make your code a
lot shorter by using a hash slice. I also strongly recommend 'use
strict', especially since you're using references.
use strict;
# ...
my $y = 0;
my @sysData;
while (<FLAT>) {
@{ $sysData[$y++] }{@columnHead} = unpack "a24a20@unpackKey",
$_;
}
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Tue, 13 Jul 1999 21:01:20 -0400
From: mike <mamedeo@yahoo.com>
Subject: FTP Question
Message-Id: <378BE160.8386F129@yahoo.com>
I am certain this may be a frequently asked question if so my
apoligises.
I would like to connect to an FTP server and get a dozen or so files. I
only need to get files not put any files. Is there a simple way to do
this. If someone could send me any code to get me started it would be
appreciated.
Thanks in Advance
Mike
------------------------------
Date: Wed, 14 Jul 1999 12:59:16 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: FTP Question
Message-Id: <MPG.11f6a80e47147a3d989b36@news-server>
mike writes ..
>I am certain this may be a frequently asked question if so my
>apoligises.
being certain that it's in an FAQ makes your post the worst .. don't post
- look in the faqs
perldoc -q 'ftp'
--
jason - remove all hyphens for email reply -
------------------------------
Date: Tue, 13 Jul 1999 21:52:03 -0500
From: "XFACTOR" <X@FACTOR.COM>
Subject: Re: Getting very irregular single 'name' field into first/last name for credit card gateway -- what hit rate is possible?
Message-Id: <7mgtv9$chd$1@eve.enteract.com>
>*plonk*
>Abigail
> **plonk**
>Tad McClellan
>*plonk*
>Martien
What a crew of pompous asses. Threatening to killfile someone for such
petty nuances and then crossposting it to three seperate groups. Ha ha.
Trolls in training. *plonk* *plonk* *plonk*
They walk in line they walk in line they walk in line.
------------------------------
Date: Tue, 13 Jul 1999 17:03:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how do i convert a integer to string.
Message-Id: <9i9gm7.kvh.ln@magna.metronet.com>
cramey@my-deja.com wrote:
: i want to convert an integer
: specifically
: 1111111 to a string with
: str[0] == 1
: ..
: ..
: ..
: str[6] == 1
: is there an easy way to do this ?
str = '1111111';
But Perl variables have funny characters before the names,
so I guess you were asking a C question in the Perl newsgroup
for some reason...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Jul 1999 01:33:58 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How do YOU format your << data?
Message-Id: <7mgpe6$e0f$1@lublin.zrz.tu-berlin.de>
Ian Smith <iansmith@pepper.ncinter.net> wrote in comp.lang.perl.misc:
>--
>$p=3;do{print substr('t"scha
>krtrJ,hree" uo a nlPe',$p-1,1);$p=27*$p%58;}until $p==3;
It's broken.
Anno
--
$p=3;do{print substr('t"scha krtrJ,h
ree" uo a nlPe',($p-1)/2,1);$p=27*$p%58}until$p==3;
------------------------------
Date: Wed, 14 Jul 1999 09:49:50 +0800
From: "MyName" <abc@abc.com>
Subject: How to Lock file
Message-Id: <378bebb9.0@newsvr.cyberway.com.sg>
How do I obtain an exclusive lock for WinNT OS? Can I use flock?
------------------------------
Date: Wed, 14 Jul 1999 13:00:37 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: How to Lock file
Message-Id: <MPG.11f6a85dd981bd41989b37@news-server>
MyName writes ..
>How do I obtain an exclusive lock for WinNT OS? Can I use flock?
why don't you give it a go - then you'll be able to answer both of your
questions
--
jason - remove all hyphens for email reply -
------------------------------
Date: Wed, 14 Jul 1999 10:44:47 +1000
From: "Brad Long" <bjl@uq.net.au>
Subject: Re: Linux - Apache - Perl
Message-Id: <7mgm11$dn$1@bunyip.cc.uq.edu.au>
Thanks to all who helped....after reading this thread I wondered what bears
had to do with perl? I thought I asked a perl question.... oh well ....
Anyway, sorry I posted to the wrong newsgroup.
It turns out that I was running a "bash" shell which doesn't recognise the
#!/usr/bin/perl on the first line of the script. I have changed all shells
to /bin/sh and it works!!!
Thanks to everyone, especially Bruce.
Regards,
Brad.
bjl@uq.net.au
P.S. I slink away in embarrasment....burnt all over from flames.....never to
be seen again.....I won't be coming back here again!
Brad Long wrote in message <7me4p8$obp$1@bunyip.cc.uq.edu.au>...
>Does anyone know how to get Apache web server to recognize ".pl" programs
as
>perl programs (i.e. to run them as scripts)?
>
>If so, please let me know how to do it!
>
>MTIA,
>Brad.
>bjl@uq.net.au
>
>
>
------------------------------
Date: Wed, 14 Jul 1999 01:34:10 GMT
From: Jordan Hiller <hiller@email.com>
Subject: Re: MIME::Lite and file attachments
Message-Id: <378BE915.2EC3A8CD@email.com>
lbravo10102@my-deja.com wrote:
>
> my $msg = new MIME::Lite
> From =>'webmaster@newtek.com',
> To =>'webmaster@newtek.com',
> Subject =>'Data file attached',
> #Type =>'multipart/mixed';
When you commented out the Type line, you commented out the semi-colon too and
you were left with the comma from the previous line. Try fixing that.
HTH,
Jordan Hiller (hiller@email.com)
JavaScript and Perl programs for
making online tests and quizzes:
http://web-shack.hypermart.net/quiz.html
------------------------------
Date: Tue, 13 Jul 1999 19:51:21 -0500
From: masroor <masroor@bga.com>
Subject: NEED HELP with SNMPTRAP< SNMPGET & SNMPSET in PERL
Message-Id: <378BDF09.4C7B@bga.com>
I would very much appreciate if someone could give me a simple examples
in PERL, on how to use snmptrap, snmpset & snmpget in PERL, and what
module I need.
I am using unix machine to run my script, and need to use the snmptrap,
snmpset & snmpget via perl. Any help would be appreciated greatly.
Thanks in advance.
masroor
email ==> masroor@bga.com
------------------------------
Date: Wed, 14 Jul 1999 09:56:34 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Negation in regular expressions
Message-Id: <MPG.11f67d3da12a8823989b35@news-server>
nasenaffe@my-deja.com writes ..
>How can I reach that the regular expression does
>not match, when a \ Symbol stands before it?
look up perlre and check out the (?<=pattern) construct .. it should
allow you to do something like (untested - can't be bothered)
split( /(?<=[^\])\]\[/, ...)
--
jason - remove all hyphens for email reply -
------------------------------
Date: Tue, 13 Jul 1999 14:58:14 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Not Learning Perl
Message-Id: <378B9A56.4BE6CC04@mindspring.com>
Jason wrote:
>
That's nice, but there's no mention of Y2K in there...
------------------------------
Date: Wed, 14 Jul 1999 09:37:41 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: NT Path Question...
Message-Id: <MPG.11f678d470cad141989b33@news-server>
Sean O'Neill writes ..
>I have a site that is in a subfolder of the root web of IIS and the current
>directory always seems to start at the root web...and not in the current
>folder. I can detect it and change it inside scripts, but when I try to do
><!-- exec cgi="someScript.cgi" --> NT always is looking at the root web and
>of course doesn't find this file since it is in the current folder and not
>the root web.
>
>I can easily change this to <!-- exec cgi="/myfolder/someScript.cgi" --> but
>that will cause problem when this site is uploaded to a Unix server that
>correctly looks in the current folder.
RTFFFFFFFFFFFM -> you people just don't stop do you .. wtf does this have
to do with perl ?
to get you to go away - here's some text from the IIS documentation that
you have on your server .. I direct your attention specifically to the
sentence that states in fairly plain english - "The path to the
application must be a full virtual path, or URL."
followups set
--
Including Output from Applications
In addition to simply including the contents of a file, you can run an
application or a shell command by using an SSI directive and include the
output in your HTML page. To run an application or a shell command, use
the #exec directive. The application can be a CGI program, an ASP
application, or an ISAPI application. For example:
<!-- #exec cgi=/scripts/guestbook.exe?FirstName+LastName>
The path to the application must be a full virtual path, or URL. You can
pass parameters to the application by following the application's file
name with a question mark (?) and a list of parameters joined by plus
signs (+).
Allowing HTML files to run applications presents a security risk. You can
disable the #exec directive while still allowing HTML pages to use the
other SSI directives. For more information, see the #exec reference page.
--
--
jason - remove all hyphens for email reply -
------------------------------
Date: 14 Jul 1999 00:10:24 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Old database is erased when I add new information
Message-Id: <7mgkhg$bnb$1@news.NERO.NET>
In article <slrn7olhkc.h7.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Perulinks (perulinks@aol.com) wrote on MMCXLI September MCMXCIII in
><URL:news:19990712195746.06618.00010191@ng-fg1.aol.com>:
>`` His name is Greg Hassan from the Independent Solution or something like that.
>`` The scrips was working Ok, I think, when he installed them. However, since h
>`` wouldn't answer my emails, I tried to do some needed changes myself. Most of
>`` them worked, but not the last one.
>
>Ah, so you screwed up yourself. It's not fair blaiming the author for not
>giving support, and then it turn out that you screwed up yourself.
This demonstrates the very good reason that people have for hiding the
code of their perl scripts. Someone wants some changes done for free,
and when they aren't done, the user screws up the code and then expects
fixes for free. When the fixes don't come for free, he starts plastering
the author's name around the net as if it were the author's fault that
the code doesn't work, and it is only after questioning that it comes
out that the luser mades "fixes" of his own to working code.
If the lusers don't have access to the code, they don't get to screw it
up as easily and then complain that you haven't fixed it yet.
>Are you sure you license allowed you to modify the scripts? Perhaps the
>author is now preparing a lawsuit...
Perhaps for slander...
------------------------------
Date: Tue, 13 Jul 1999 16:56:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Password Entry
Message-Id: <j59gm7.kvh.ln@magna.metronet.com>
Vipul M. Shah (vipul@healtheon.com) wrote:
: This is a multi-part message in MIME format.
^^^^^^^^^^^^^^
Please don't do that.
Usenet is a plain text medium.
: I suppose this is a FAQ, but how does one prevent the password text from being
: echoed on the screen in Perl?
You are right. It is in the FAQ.
*plonk*
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 14 Jul 1999 03:05:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Password Entry
Message-Id: <x7Ti3.120$xg5.8364@nsw.nnrp.telstra.net>
[comp.lang.perl is a long dead newsgroup. If your news server still
has it, please inform your admin that it is no longer active and
should be removed]
In article <000001becd62$c013ba40$9701040a@healtheon.com>,
"Vipul M. Shah" <vipul@healtheon.com> writes:
> This is a multi-part message in MIME format.
Please don't do that. Usenet is a plain text medium.
> I suppose this is a FAQ, but how does one prevent the password text
> from being echoed on the screen in Perl?
You are halfway there. You suppose it is a FAQ. Good. The first thing
one does in a situation like that is check the FAQ. You didn't do
that. Bad.
- You can use grep to search the faq on a decent system
- You can search through the perltoc documentation
- You can use perldoc to search through the subjects of the FAQ
# perldoc -q password
=head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq8.pod
=head2 How do I ask the user for a password?
I suggest next time you suspect something is a FAQ, you check the FAQ
to see whether it is.
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Tue, 13 Jul 1999 23:30:42 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: perl -e 'print "${\ord(s)}\n";'
Message-Id: <FEu1B6.84G@news.boeing.com>
In article <378BACC4.350BB4CC@ufl.edu>, Jeremy James <perly@ufl.edu> wrote:
>perl -e 'print "${\ord(u)}\n";'
>117
>perl -e 'print "${\ord(s)}\n";'
>Substitution pattern not terminated at -e line 1.
>
>can someone help me understand why the 's' is trying to start a
>substitution and how I can stop this from happening?
>
I'm guessing but maybe because the lexer gets its hands on 's'
even before `ord' which would know to expect a string.
You could prevent this by doing:
print "${\ord(qw/s/)}\n"
hth,
--
Charles DeRykus
------------------------------
Date: 14 Jul 1999 02:29:28 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: perl -e 'print "${\ord(s)}\n";'
Message-Id: <7mgsm8$q6n$1@216.39.141.200>
On Tue, 13 Jul 1999 23:30:42 GMT, ced@bcstec.ca.boeing.com (Charles DeRykus)
wrote:
>In article <378BACC4.350BB4CC@ufl.edu>, Jeremy James <perly@ufl.edu> wrote:
>>perl -e 'print "${\ord(u)}\n";'
>>117
>>perl -e 'print "${\ord(s)}\n";'
>>Substitution pattern not terminated at -e line 1.
>
>You could prevent this by doing:
>
> print "${\ord(qw/s/)}\n"
Why qw//?
print "${\ord(q/s/)}\n";
print "${\ord('s')}\n";
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Tue, 13 Jul 1999 17:31:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: perl -e 'print "${\ord(s)}\n";'
Message-Id: <m6bgm7.i2i.ln@magna.metronet.com>
Jeremy James (perly@ufl.edu) wrote:
: perl -e 'print "${\ord(u)}\n";'
: 117
Enabling warnings, even on one-liners is a good idea.
perl -we 'print "${\ord(u)}\n";'
Unquoted string "u" may clash with future reserved word at -e line 1.
: perl -e 'print "${\ord(s)}\n";'
: Substitution pattern not terminated at -e line 1.
: can someone help me understand why the 's' is trying to start a
: substitution and how I can stop this from happening?
You use bare words at your own peril.
(so you probably should just not use bare words)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 13 Jul 1999 17:11:08 -0700
From: "Lauren Smith" <laurens@bsquare.com>
Subject: Re: Reclaiming hashed memory
Message-Id: <7mgkiq$koo$1@brokaw.wa.com>
Anno Siegel wrote in message <7mggtn$dou$1@lublin.zrz.tu-berlin.de>...
>Lauren Smith <laurens@bsquare.com> wrote in comp.lang.perl.misc:
>>Anno Siegel wrote in message <7mg7bd$d73$1@lublin.zrz.tu-berlin.de>...
>
>Trying to reconstruct your situation, I arrive at something like this:
>
>#!/usr/bin/perl -w
>
>for ( 1 .. 3 ) {
> my %h;
> @h{ 0 .. rand 100} = 1;
> $d = %h;
> undef %h;
> $u = %h;
> print "defined: $d undef'd: $u\n";
>}
>
>--->
>defined: 32/64 undef'd: 0
>defined: 21/32 undef'd: 0
>defined: 10/16 undef'd: 0
>
>(or similar)
>
>As you see, the size shrinks if it can.
This is where I see the problem. When the value of keys(%h) == 0, the value
of %h is also 0.
However, after clearing the hash and repopulating it (perhaps with only one
entry), it retains the last size of the hash.
thus altering your example a little:
defined 10/16
defined 21/32
defined 32/64
defined 1/64
^^^^^^^^?
Maybe the garbage collector is broken?
Lauren
------------------------------
Date: 14 Jul 1999 02:01:07 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reclaiming hashed memory
Message-Id: <7mgr13$e33$1@lublin.zrz.tu-berlin.de>
Lauren Smith <laurens@bsquare.com> wrote in comp.lang.perl.misc:
[...]
>This is where I see the problem. When the value of keys(%h) == 0, the value
>of %h is also 0.
>
>However, after clearing the hash and repopulating it (perhaps with only one
>entry), it retains the last size of the hash.
>thus altering your example a little:
>
>defined 10/16
>defined 21/32
>defined 32/64
>defined 1/64
>^^^^^^^^?
This depends (on my machine) on whether the hash is cleared via
$h = (), or undef %h. In the former case it indeed keeps the space
once reserved, which is usually considered a feature. If you undef
it, its history should be forgotten and reservation start anew.
Anno
------------------------------
Date: Wed, 14 Jul 1999 09:49:23 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Running PERL
Message-Id: <MPG.11f67b8e82f4c1b9989b34@news-server>
darkmanjs@my-deja.com writes ..
>How do I start a Perl script from an HTML file, and does it need to be
>an SSI document? I tried <!--#include variable="yada yada"--> and that
>didn't work. I also tried substituding 'name' in for 'variable'. Can
>someone help??
no one here can help you conclusively on the information you have
provided .. your problem has nothing to do with perl and everything to do
with your web server
your web server documentation can help .. read it
--
jason - remove all hyphens for email reply -
------------------------------
Date: Wed, 14 Jul 1999 00:51:55 GMT
From: jpr <jpr@vcnet.com>
Subject: Re: Sending email by perl in NT
Message-Id: <7mgmv7$3ja$1@nnrp1.deja.com>
In article <z8qg3.406$dV1.64115@typhoon1.gnilink.net>,
"James Tolley" <jtolley@bellatlantic.net> wrote:
> You could check the latest issue of The Perl Journal for a few good ideas
> and examples: Mail::Mailer, Net::SMTP, and one custom solution which is free
> for download from their ftp site.
I tried their Mail::Mailer example. First, my perl5 barfed on the
"Mail::Mailer qw(smtp);" line with and invalid syntax error. So I dropped
the qw part, and now have this (after consulting the man page):
#!/usr/bin/perl5
use Net::SMTP;
use Mail::Mailer;
my $mailer = new Mail::Mailer 'smtp', Server => "smtp.domain.com";
$mailer->open(To => "email\@address.com",
From => "email\@address.com",
Subject => "Test Subject");
print $mailer "Body goes here\n";
print $mailer "------------------------------------\n";
$mailer->close;
But perl now barfs on code farther down:
Can't use string ("To") as a HASH ref while "strict refs" in use
at /path/to/Mail/Mailer.pm line 291.
I've tried it with and without the square brackets as shown in TPJ.
5.005_01 built for i386-bsdos
Thanks for any help,
jon
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 13 Jul 1999 22:03:03 -0400
From: "Travis Surgnier" <surgie@bellsouth.net>
Subject: something that might help
Message-Id: <xgSi3.3456$ib5.6577@news4.mco>
What probably happen was you replaced a >> (appending a line to the end of a
file) with a > (which clears the file, and then you write to it).
------------------------------
Date: Tue, 13 Jul 1999 23:29:50 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: storing binary data in a database record
Message-Id: <oxSi3.7259$j3.38627@tor-nn1.netcom.ca>
Not long ago I read an article on how you could store files (.doc, .gif,
.jpg, etc.) directly into a database records rather than uploading the files
to the server using a file uploader. Does anyone know how this is done?
Thanks
Kevin
------------------------------
Date: Tue, 13 Jul 1999 22:39:43 -0400
From: Michael G Schwern <stupid@pobox.com>
To: nkaiser@my-deja.com
Subject: Re: What's faster: GDBM or Storable
Message-Id: <130719992239437576%stupid@pobox.com>
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <7mf6c5$fot$1@nnrp1.deja.com>, <nkaiser@my-deja.com> wrote:
> I have an application which uses GDBM hash files for the database.
> However, to accomodate the win32 people (I know there is a port), I
> converted to use Perl data structures (assoc. arrays) and use the
> Storable module.
>
> Does anyone have any benchmarks on what would have faster access,
> saving, etc?
There is no good answer to your question, because gdbm and Storable do
different things. However, there are several good solutions to your
problem (compatibility of data storage across platforms).
1) Instead of using GDBM_File directly, use AnyDBM_File. This takes
advantage of Perl's interface to DBM and allows your program to choose
whatever DBM library is available to it. This has the advantage of
working on any recent installation of Perl needing no other modules to
be installed. It should also require only a minimum modification to
your existing code (the version that uses GDBM_File).
# dbmopen is really a wrapper around AnyDBM_File in modern perls.
use AnyDBM_File;
# This reorders AnyDBM's preference of DBM libraries. DB_File
# (Berkley DB), and gdbm are usually considered the best with
# sdbm being the worst, but its ubiqitous (comes with Perl).
# I tend to modify the AnyDBM_File library itself to use this @ISA
# instead of its default ordering which puts NDBM_File first.
@AnyDBM_File::ISA =
qw(DB_File GDBM_File NDBM_File ODBM_File SDBM_File);
# Tie the database to %data. This is pretty much the same as:
# tie(%data, 'GDBM_File', ...); except that the first DBM
# library found from @AnyDBM_File::ISA will be used.
dbmopen(%data, "filename", 0666) ||
die "Can't open DBM 'filename': $!";
# Use %data normally.
2) Use MLDBM. It allows you to store arbitrarily complex data
structures on disk. It makes use of DBM files -and- Storable. Only
problem is that you have to tell it exactly what DBM implementation to
use, which is kinda lame. But that can be changed.
PLEASE READ THE "BUGS" SECTION IN THE MLDBM MAN PAGE! You have to be a
little careful about how its used.
# Just like AnyDBM_File, we pick the first DBM library we see.
# You can replace @AnyDBM_File::ISA with your own list if you like.
my $DBM;
BEGIN {
for $mod (@AnyDBM_File::ISA) {
if (eval "require $mod") {
$DBM = $mod;
return 1;
}
}
}
# Tell MLDBM to use the DBM library we found and Storable (you can
# also use FreezeThaw or Data::Dumper)
use MLDBM ($DBM, "Storable");
tie %data, 'MLDBM', 'filename' ||
die "Can't open DBM for 'filename': $!";
# Store some complex stuff.
$data{foo} = {
bar => 1,
car => "Yarrow",
hey => [qw(This that whatever)],
};
Now that I'm thinking, I'm going to send off some patches to Guru to
get MLDBM to select its defaults more intellegently.
BTW To answer your original question about benchmarking, look at
Benchmark (comes with perl), Devel::DProf (subroutine level profiler)
and Devel::SmallProf (line level).
------------------------------
Date: Tue, 13 Jul 1999 14:49:32 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Where might I find info. on "$_"
Message-Id: <378B984C.DA0B9743@mindspring.com>
TRG Software : Tim Greer wrote:
>
[cut]
>
> Hey idiot, why don't you tell him which page it's on in HIS book, rather
> then trying to SPAM this NG while you get a percentage of the sales from
> the URL's you keep posting. Or should he buy another book to get an
> answer to that simple question?
>
OK, all this piqued my interest. (I must answer to "hey idiot"). My
Gecko book has "$_" in the index. The earliest page it lists, page 71,
has a pretty good explanation. If you can't RTFM, at least LITFI.
--
... if the problem persists ... get a 3.5 ft ... length of sucker rod
and have a chat with the user in question.
-- Linux System Administration,
SYSLOGD (8), page 7
(Dealing with DOS attacks exploiting SYSLOGD)
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 136
*************************************