[11790] in Perl-Users-Digest
Perl-Users Digest, Issue: 5390 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 15 11:07:32 1999
Date: Thu, 15 Apr 99 08:00:29 -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 Thu, 15 Apr 1999 Volume: 8 Number: 5390
Today's topics:
Re: $variables in <FILES> timespinner@my-dejanews.com
[HELP] Looking for Linux ISP with a vitual server for t <pofpof98@yahoo.com>
Re: Can I write a #!-style interpreter with Perl ? <jdf@pobox.com>
Re: compare form input with log file <rhardicr@hotmail.com>
Convert HTML -> Perl <Jan@Angermueller.com>
Re: Convert HTML -> Perl (Matthew Bafford)
Re: Convert HTML -> Perl <gellyfish@gellyfish.com>
Re: efficient file I/O for file updates (M.J.T. Guy)
error message <x30407@wrek1.mar.lmco.com>
Re: FAQ 1.1: What is Perl? (David Turley)
globbing doesn't work (Uli Zappe)
Re: How do I delete text in a file? (Sys Adm 89806 Manager of programing development and Intranet Resources)
Re: How do I format form input to DOS text (sort of) ?? (Larry Rosler)
Re: How to access Database in Perl ? <jwarner@tivoli.com>
Re: ide advice wanted <Philip.Newton@datenrevision.de>
Re: like print <<...; load a variable? (M.J.T. Guy)
Re: Matching whole word (Tad McClellan)
Need help in creating a search by date script saumya9999@my-dejanews.com
Re: Need to print \n - Not do a carrage return <Philip.Newton@datenrevision.de>
Re: No echo on a socket connection (Christopher Allene)
Re: Password encryption (Daniel Beckham)
Re: Perl 5 DBI MySQL Win32 Package? TimeSpinner@hotmail.com
Re: Perl Development Environment (Sys Adm 89806 Manager of programing development and Intranet Resources)
Re: Perl Regex Q? (Tad McClellan)
PerlIS and system command: please help me <borgo@indi.it>
Re: Printing a file <rick.delaney@home.com>
Question about variables, and Perl in general <aidan@salvador.blackstar.co.uk>
Re: Question about variables, and Perl in general <aidan@salvador.blackstar.co.uk>
Re: Question about variables, and Perl in general <jdf@pobox.com>
Re: Registry Information (Daniel Beckham)
Scalar length and general Perl questions <aidan@salvador.blackstar.co.uk>
Re: SQL and the ODBC module <ernstc@post3.tele.dk>
Re: stripping html tags (Tad McClellan)
Re: stripping html tags <Philip.Newton@datenrevision.de>
sub's <info@blue.uk.com>
Re: sub's <gellyfish@gellyfish.com>
Re: sub's (Bart Lateur)
Re: Typeglobs broken by threaded perl??? <bbense+comp.lang.perl.misc.Apr.15.99@telemark.stanford.edu>
Re: want regex to set a value in place of a procedure <jdf@pobox.com>
Re: Whats wrong with this? <Philip.Newton@datenrevision.de>
Why a complex numbers package? <m.kennedy@ieee.org>
Re: Why a complex numbers package? <thelma@alpha2.csd.uwm.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Apr 1999 14:08:16 GMT
From: timespinner@my-dejanews.com
Subject: Re: $variables in <FILES>
Message-Id: <7f4rsa$glv$1@nnrp1.dejanews.com>
Perhaps I am going about what I am doing incorrectly.
What I was originally thinking was making web pages as .htm files, so they
are not physically embedded in the Perl script, with fields that had
something like:
<b>Name:</b><input size=50 type="text" name="InputName" value="$name">
Where the Perl script would have populated $name with some value (for this
case we will say 'Fred Flinstone') and when it displayed on the users
browser, it would show as:
Name: Fred Flinstone
Where Fred is in the Text Box.
Is there an easier way to do this? Again, I don't want to have to embed the
HTML directly into the Perl Script.
Thanks,
-TS
In article <3714aa7d@cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> TimeSpinner@hotmail.com writes:
> :Is it possible to have a file which contains the text:
> :
> :Hello, my name is $name.
> :My address is $address.
> :
> :and have a Perl Script read this file, and print it, automatically
> :substituting the $name and $address variables in?
>
> That's wrong. You don't want the file to access your variables.
> You think you do, but you're wrong.
>
> =head2 How can I use a variable as a variable name?
>
> Beginners often think they want to have a variable contain the name
> of a variable.
>
> $fred = 23;
> $varname = "fred";
> ++$$varname; # $fred now 24
>
> This works I<sometimes>, but it is a very bad idea for two reasons.
>
> The first reason is that they I<only work on global variables>.
> That means above that if $fred is a lexical variable created with my(),
> that the code won't work at all: you'll accidentally access the global
> and skip right over the private lexical altogether. Global variables
> are bad because they can easily collide accidentally and in general make
> for non-scalable and confusing code.
>
> Symbolic references are forbidden under the C<use strict> pragma.
> They are not true references and consequently are not reference counted
> or garbage collected.
>
> The other reason why using a variable to hold the name of another
> variable a bad idea is that the question often stems from a lack of
> understanding of Perl data structures, particularly hashes. By using
> symbolic references, you are just using the package's symbol-table hash
> (like C<%main::>) instead of a user-defined hash. The solution is to
> use your own hash or a real reference instead.
>
> $fred = 23;
> $varname = "fred";
> $USER_VARS{$varname}++; # not $$varname++
>
> There we're using the %USER_VARS hash instead of symbolic references.
> Sometimes this comes up in reading strings from the user with variable
> references and wanting to expand them to the values of your perl
> program's variables. This is also a bad idea because it conflates the
> program-addressable namespace and the user-addressable one. Instead of
> reading a string and expanding it to the actual contents of your program's
> own variables:
>
> $str = 'this has a $fred and $barney in it';
> $str =~ s/(\$\w+)/$1/eeg; # need double eval
>
> Instead, it would be better to keep a hash around like %USER_VARS and have
> variable references actually refer to entries in that hash:
>
> $str =~ s/\$(\w+)/$USER_VARS{$1}/g; # no /e here at all
>
> That's faster, cleaner, and safer than the previous approach. Of course,
> you don't need to use a dollar sign. You could use your own scheme to
> make it less confusing, like bracketed percent symbols, etc.
>
> $str = 'this has a %fred% and %barney% in it';
> $str =~ s/%(\w+)%/$USER_VARS{$1}/g; # no /e here at all
>
> Another reason that folks sometimes think they want a variable to contain
> the name of a variable is because they don't know how to build proper
> data structures using hashes. For example, let's say they wanted two
> hashes in their program: %fred and %barney, and to use another scalar
> variable to refer to those by name.
>
> $name = "fred";
> $$name{WIFE} = "wilma"; # set %fred
>
> $name = "barney";
> $$name{WIFE} = "betty"; # set %barney
>
> This is still a symbolic reference, and is still saddled with the
> problems enumerated above. It would be far better to write:
>
> $folks{"fred"}{WIFE} = "wilma";
> $folks{"barney"}{WIFE} = "betty";
>
> And just use a multilevel hash to start with.
>
> The only times that you absolutely I<must> use symbolic references are
> when you really must refer to the symbol table. This may be because it's
> something that can't take a real reference to, such as a format name.
> Doing so may also be important for method calls, since these always go
> through the symbol table for resolution.
>
> In those cases, you would turn off C<strict 'refs'> temporarily so you
> can play around with the symbol table. For example:
>
> @colors = qw(red blue green yellow orange purple violet);
> for my $name (@colors) {
> no strict 'refs'; # renege for the block
> *$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
> }
>
> All those functions (red(), blue(), green(), etc.) appear to be separate,
> but the real code in the closure actually was compiled only once.
>
> So, sometimes you might want to use symbolic references to directly
> manipulate the symbol table. This doesn't matter for formats, handles, and
> subroutines, because they are always global -- you can't use my() on them.
> But for scalars, arrays, and hashes -- and usually for subroutines --
> you probably want to use hard references only.
> --
> "I think I'll side with the pissheads on this one." --Larry Wall
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 15 Apr 1999 15:32:35 +0200
From: "PofPof98" <pofpof98@yahoo.com>
Subject: [HELP] Looking for Linux ISP with a vitual server for tests
Message-Id: <7f4qeh$sbh$1@guinness.serv.psi.calva.net>
Hi
I am looking for an ISP that let have access to a virtual machine to test
your CGIs (msql based) before you subscribe.
Intermedia inc (www.intermedia.com) is doing is it with NT hosting but I am
looking for the same on Linux.
Any idea ?
Regards
Pofpof98
------------------------------
Date: 15 Apr 1999 10:41:35 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Jorma.Laaksonen@hut.fi
Subject: Re: Can I write a #!-style interpreter with Perl ?
Message-Id: <m3r9pmuesg.fsf@joshua.panix.com>
Jorma Laaksonen <jorma.laaksonen@hut.fi> writes:
> *** #! /my-perl-script-dir/parser
You'll probably get better help on a newsgroup that deals with
whatever shell you're using. HTH.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Thu, 15 Apr 1999 12:01:19 +0100
From: Richard H <rhardicr@hotmail.com>
Subject: Re: compare form input with log file
Message-Id: <3715C6FF.C87E5471@hotmail.com>
> while ($line = <PEOPLE>) {
> @data = split(/\:/, $line);
> #stopped here because it's not getting any better :-)
Not sure what the question is exactly?? but,
shift @data;
$passes{"$data[0]"} = "$data[1]";
would get your user/passwords into a hash,
to verify look up exists/defined in perlfaq
Richard H
------------------------------
Date: Thu, 15 Apr 1999 13:37:13 +0200
From: "Jan Angerm|ller" <Jan@Angermueller.com>
Subject: Convert HTML -> Perl
Message-Id: <7f4j6q$kel$2@rzsun02.rrz.uni-hamburg.de>
Is there a Win95/98 programme to convert a HTML-coded page into Perl ?
This would save a lot of time for creating HTML-outputs in Perl.
Jan Angerm|ller
------------------------------
Date: Thu, 15 Apr 1999 12:35:50 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Convert HTML -> Perl
Message-Id: <slrn7hbma5.1fm.dragons@dragons.duesouth.net>
On Thu, 15 Apr 1999 13:37:13 +0200, Jan Angerm|ller <Jan@Angermueller.com>
lucked upon a computer, and thus typed in the following:
) Is there a Win95/98 programme to convert a HTML-coded page into Perl ?
) This would save a lot of time for creating HTML-outputs in Perl.
http://www.stonehenge.com/merlyn/WebTechniques/
Column #30 (Oct '98)
) Jan Angerm|ller
--Matthew
------------------------------
Date: 15 Apr 1999 15:17:19 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Convert HTML -> Perl
Message-Id: <3715f4ef@newsread3.dircon.co.uk>
Matthew Bafford <dragons@dragons.duesouth.net> wrote:
> On Thu, 15 Apr 1999 13:37:13 +0200, Jan Angerm|ller <Jan@Angermueller.com>
> lucked upon a computer, and thus typed in the following:
> ) Is there a Win95/98 programme to convert a HTML-coded page into Perl ?
> ) This would save a lot of time for creating HTML-outputs in Perl.
>
> http://www.stonehenge.com/merlyn/WebTechniques/
>
> Column #30 (Oct '98)
>
Of course he might simply have meant :
#!/usr/bin/perl -w
use strict;
print <<'EO1';
print <<'EO1';
EO1
print while(<>);
print 'EO1';
;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: 15 Apr 1999 13:49:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: efficient file I/O for file updates
Message-Id: <7f4qpb$skp$1@pegasus.csx.cam.ac.uk>
Greg Wimpey <greg.wimpey@waii*removetomail*.com.invalid> wrote:
>
>If you need to reduce the amount of file open()ing/close()ing, you
>need to switch your loops. Speaking in pseudocode, rather than:
>
>for (each kernel_tag) {
> open file
> while (read line from file) {
> update (line)
> }
> close file
>}
>
>you want:
>
>open file
>while (read line from file) {
> for (each kernel_tag) {
> update (line)
> }
>}
>close file
And to do the inner loop efficiently, see perlfaq6:
How do I efficiently match many regular expressions at once?
Mike Guy
------------------------------
Date: Thu, 15 Apr 1999 10:30:24 -0400
From: Adam Dittmer <x30407@wrek1.mar.lmco.com>
Subject: error message
Message-Id: <3715F7FF.180673C3@wrek1.mar.lmco.com>
i am getting a error message when i try to use my guestbook type script
and i am not sure wht it means if anyone could please tells me what my
pro gram is doing wrong i would aprcieate it
Error: HTTPd: malformed header from script
/usr/local/etc/httpd/htdocs/cgi-bin/tplogbook.cgi
------------------------------
Date: Thu, 15 Apr 1999 13:08:04 GMT
From: dturley@binary.net (David Turley)
Subject: Re: FAQ 1.1: What is Perl?
Message-Id: <3715e427.6381689@news.erols.com>
On 14 Apr 1999 04:59:48 GMT, stanley@skyking.OCE.ORST.EDU (John
Stanley) wrote:
>Instead of splitting the FAQs up into little pieces and stuffing them
>onto the net in dribs and drabs, can you please just post the updated
>FAQs whole? It is so much more convenient to have them in the original
>nine parts and not have to try to repack them.
The FAQs are already avaialble in numerous places "whole."
I like these postings. I've read the FAQs but like the opportunity to
review them quickly with no effort on my part.
Wish some other newsgroups did the same.
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley/
------------------------------
Date: 15 Apr 1999 14:05:10 GMT
From: uli@tallowcross.uni-frankfurt.de (Uli Zappe)
Subject: globbing doesn't work
Message-Id: <7f4rmm$30i$1@tallowcross.tallowcross.uni-frankfurt.de>
Hi all,
I'm using NEXTSTEP (BSD-Unix) and Perl 5.004_04.
Being a Perl newbie, I'm totally at a loss with the following problem:
I have written a C program which (via execv) executes a Perl script. The Perl
script uses globbing:
@files = </foo/bar/*>;
The Perl script works fine if started from the commandline (sh, csh,
whatever...). However, when it's executed by my C program, @files is always
empty.
I have not the slightest idea why globbing would fail if I execute the script
with my C program. I have tried to execute the Perl script within a shell
that I start by my C program, but that doesn't help either.
I should add that the Perl script is actually a very elaborated script that
I've only modified, and anything else besides the globbing I added works fine
if started from my C program, just globbing only works if started from a
shell.
The only thing I could think of at all that may be different in both
situations is the environment, but I can't think of any influence of the
environment on globbing if the path in the globbing expression is an absolute
path.
Any ideas what the problem may be, or what I could try to find it?
Many thanks for your help!
Bye
Uli
--
_____________________________________________________________________
Uli Zappe E-Mail: uli@tallowcross.uni-frankfurt.de
(NeXTMail,Mime,ASCII) PGP on request
Lorscher Strasse 5 WWW: -
D-60489 Frankfurt Fon: +49 (69) 9784 0007
Germany Fax: +49 (69) 9784 0042
_____________________________________________________________________
------------------------------
Date: Thu, 15 Apr 1999 13:53:41 GMT
From: ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources)
Subject: Re: How do I delete text in a file?
Message-Id: <FbmR2.16$Hu2.447@typhoon.nyu.edu>
[Posted and mailed]
In article <xkfk8vhlm0j.fsf@valdemar.col.hp.com>,
Eric The Read <emschwar@rmi.net> writes:
> ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources) writes:
>> You cound write the function.
>
> Generally a bad idea, especially when someone's already done it for you.
> HTML is moderately complicated, and a simple regex will *not* do it for
> you; you must write a parser. Which is silly, given that HTML::Parser
> exists already.
General - it is NOT a bad idea, especially for a BEGINNER as it teaches them how to program. Learning HOW to do something is more important than just DOING IT.
>
>> Here is a start
>>
>> sub htmlbegone{
>> s/<.*>//g #correct this - it is greedy
>
> And wrong. perldoc perlfaq9, "How do I remove HTML from a string?":
>
Actually - this is more or Less CORRECT.
> Many folks attempt a simple-minded regular expression approach, like
> s/<.*?>//g, but that fails in many cases because the tags may continue
> over line breaks,
ALL OF WHICH can be addressed as one LEARNS to join lines, change the default
string and glob settings, etc. LEARNING how to program is what a newbie
needs to do, not to jump right into a bunch of CSPAN modules which they have
no clue to how they work.
> Read the FAQ for better solutions.
>
> -=Eric
>
Try to be a little more polite when you have have a worthing contribution -
at least when you answer anything I write.
Thanks
Ruben I Safir
------------------------------
Date: Thu, 15 Apr 1999 07:32:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I format form input to DOS text (sort of) ???
Message-Id: <MPG.117f986f66e2f72c9898bc@nntp.hpl.hp.com>
In article <37159f5a.2682387@news.newsguy.com> on Thu, 15 Apr 1999
09:31:11 GMT, Kvan <kvan@dis.dk> says...
> On Thu, 15 Apr 1999 05:12:49 GMT, rdcomp@sympatico.ca (Mark Creelman)
> wrote:
>
> > $lines[$a] =s/[\cM\cB]//g
...
> What you want is:
>
> $lines[$a] = s/\n$/\r\n/g;
I doubt that either of you wants to store in $lines[$a] the Boolean
result of whether the contents of $_ matches the regex.
Try using =~ instead of = .
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 15 Apr 1999 09:04:20 -0500
From: John Warner <jwarner@tivoli.com>
Subject: Re: How to access Database in Perl ?
Message-Id: <3715F1E4.1F8600C3@tivoli.com>
It is very simple to access a database in Perl. Look into DBI and
DBD::Oracle (or DBD::Sybase, etc).
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::Oracle;
#===================================================
# Set some global values
local ($srvr,$uname,$upwd,$dbtype);
local ($sth,$dbh,$sqlstmt);
local @array;
$srvr = 'System_DSN';
$uname='read';
$upwd='only';
$dbtype='Oracle';
die "Cannot do \$dbh->connect: $DBI::errstr\n" unless $dbh =
DBI->connect($srvr,$uname,$upwd,$dbtype);
$sqlstmt=&setSQL;
&execSQL($sqlstmt);
# Finished. Time for some house cleaning.
$dbh->disconnect;
exit;
#=============================================================
#=============================================================
sub setSQL{
#....prep string to be assigned to $sqlstmt here....
return 'select * from exav.solutions where solution_id <= 100';
}
sub execSQL{
my $count = 0;
my @row;
$sth = $dbh->prepare("@_") or die "Couldn't prepare: \n\t@_\nError:
$DBI::errstr\n";
$sth->execute() or die "Couldn't execute: \n\t@_\nError:
$DBI::errstr\n";
while( @row = $sth->fetchrow()) {
$array[$count]=$row[0];
$count++;
}
if (defined $sth){$sth->finish;}
&sortResults(@array); #Perform Schwartzian transformation on
@array
}
sub sortResults{
my ($prev, $item, @unique);
@_ = sort { $a cmp $b } @_;
$prev = 'bogus_value';
@unique = grep($_ ne $prev && ($prev = $_), @_);
foreach $item (@unique) {print "$item\n";}
if ((scalar @unique) == 0){ print "No records found.\n\n";}
else {print "\n",scalar @unique," records founds.\n\n";}
return @unique;
}
Hope this helps.
"Chow Hoi Ka, Eric" wrote:
> Hello,
>
> Is it possible to access Database in Perl ?
> Such as, Oracle, Sybase, Ms Access, DBF file.
>
> Is it is possible, how ? Would you please to give me a simple example
> ???
>
> Best regards,
> Eric
--
John Warner Tivoli Systems Inc.
Sales Support Engineer 9442 Capital Of Texas Hwy North
Sales Infrastructure Group Austin, TX 78759
john_warner@tivoli.com
------------------------------
Date: Thu, 15 Apr 1999 15:51:07 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: ide advice wanted
Message-Id: <3715EECB.B3DE6BEC@datenrevision.de>
lynn ranen wrote:
>
> Can anyone recommend a decent ide for NT? (or VI for NT?)
As for vi for NT, try http://www.vim.org/ . They have both a console and
a GUI version. With syntax colouring for Perl (and other languages)
even.
Cheers,
Philip
------------------------------
Date: 15 Apr 1999 13:12:32 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: like print <<...; load a variable?
Message-Id: <7f4ok0$qlp$1@pegasus.csx.cam.ac.uk>
Tad McClellan <tadmc@metronet.com> wrote:
>
> There are "single quotish" here-docs (when delimiter string is
> in single quotes) which have all of the
> same "special characters" that plain old single quoted strings
> have.
Nope. There are *no* special characters in a single-quotish here-doc.
\ represents \ and ' represents '. (A fact which I can't find in
the documentation :-( )
% perl -w
print <<'EOF';
Here are two backslashes \\ and an escaped \'.
EOF
__END__
Here are two backslashes \\ and an escaped \'.
Mike Guy
------------------------------
Date: Thu, 15 Apr 1999 08:31:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Matching whole word
Message-Id: <96m4f7.7p7.ln@magna.metronet.com>
Damon61 (damon61@aol.com) wrote:
: if $whatever =~/^blah$/
: {
: }
: the ^ in the beginning specifies that the word must start with "blah", and the
: $ at the end specifies that the word must end with "blah"
No it doesn't.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Apr 1999 14:16:37 GMT
From: saumya9999@my-dejanews.com
Subject: Need help in creating a search by date script
Message-Id: <7f4sbt$h77$1@nnrp1.dejanews.com>
Hi,
I need to have a search script which can list results whilst only searching
the metatags on html pages.
The most important things is ordering the search results by date. Any ideas of
how to do this?? You can see a similar example of what I want to do on:
http://www.incmagazine.com/searchindex/
Any help would be much appreciated.
Thanks!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 15 Apr 1999 16:03:38 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Need to print \n - Not do a carrage return
Message-Id: <3715F1BA.8FED95E7@datenrevision.de>
Wyzelli wrote:
>
> What you might want to do actually is output the HTML code for a line
> break (ie <br>) this will need to be escaped (ie \<br\>)
not <br> rather than \<br\>? From whom are we escaping it? From
the HTML, no? Either way, not a Perl problem any more.
Cheers,
Philip
------------------------------
Date: Thu, 15 Apr 1999 16:37:03 +0100
From: cwis@dial.oleane.com (Christopher Allene)
Subject: Re: No echo on a socket connection
Message-Id: <1dqb867.1anpp4g79a7kxN@[192.168.1.2]>
<kevin_collins@my-dejanews.com> wrote:
> I did swap them - I even tried both sequences. It is recognizing the
> sequences, its stops and restarts echoing, but it adds that additional
> character to the output...Weird...
I'm running out of ideas, then.
Are you sure the problem really is in the echo-restoring sequence ?
Maybe the problem happen later in your program, or...
--
cw|s
------------------------------
Date: Thu, 15 Apr 1999 10:45:17 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Password encryption
Message-Id: <MPG.117fc58c74824986989690@news.idt.net>
Well, you need to supply a little more info. If you are using the latest
version of Apache on that NT box, there is now a program that comes with
the dist. that is the equiv. of htpasswd for unix. (1.3.6) Check the
release notes. If you are using a not so latest verison of Apache, you
don't even need to encrypt your passwords... Security you say? Why are
you using NT then?
Daniel
In article <371499a1@news.uk.ibm.net>, vvb@ibm.net says...
>
> Hi,
>
> I need to be able to create .htaccess and .htpasswd files on the fly. To do
> this, I thought I'd use a perl script where you can enter a userid and
> password, and that would then create the needed files.
> Problem is that I don't see any way to create the password file. I know in a
> Unix environment, there's this command 'htpasswd' that you can use, but as
> far as I know, there's no win32 variant of it (I'm using WinNT).
>
> Thanks,
>
> Vincent Vanbiervliet
> http://learn.ibm.be
>
>
>
------------------------------
Date: Thu, 15 Apr 1999 13:34:30 GMT
From: TimeSpinner@hotmail.com
Subject: Re: Perl 5 DBI MySQL Win32 Package?
Message-Id: <7f4pt5$f01$1@nnrp1.dejanews.com>
Kevin, Thanks for your reply. I already had Perl installed and I was just
looking for the Mysql package modules, which I don't understand how come the
package modules alone are not available via www.mysql.com off of their web
page.
I did find them, however. They were in the www.mysql.com Contrib library.
I installed them and all is well. Thanks again for your reply.
-TS
In article <m3vheymt9t.fsf@jibsheet.com>,
Kevin Falcone <kevinfal@seas.upen.edu> wrote:
>
> timespinner@my-dejanews.com writes:
> > Does anyone know if there is a Win32 package for Perl 5 out to work with a
> > Win32 MySQL database? If so, where can this be obtained?
>
> From the same place you got Win32 Mysql. A little further down the
> page there are links to a Perl compiled for Win32 with DBI::DBD for
> Mysql, and there are also links to MyODBC so that you can talk to the
> database through ODBC. These are about 3 lines below where you
> doenload mysql for Win32
>
> http://www.mysql.org/download.html
>
> -kevin
>
> --
> Kevin Falcone
> kevinfal@seas.upenn.edu
>
> SIGTHTBABW: a signal sent from Unix to its programmers at random
> intervals to make them remember that There Has To Be A Better Way.
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 15 Apr 1999 13:42:46 GMT
From: ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources)
Subject: Re: Perl Development Environment
Message-Id: <q1mR2.15$Hu2.447@typhoon.nyu.edu>
In article <Pine.LNX.4.04.9904111427250.20923-100000@localhost.pants.org>,
aaron@soltec.net (Aaron) writes:
> I think more of what we mean is
>
> integrated debugger - when I say integrated, I want to step through the code, display watched variables, all the things that perl -d gives us now, but available inside the editor (much like Perlbuilder)
>
Perl has a built in debugger. This is NOT part of the developmentment editor. Read the perl docs.
> possibly a class hierchary panel (like in some of the Visual microsoft tools)
> - I know that at least something to let us know what functions we've defined
> (and maybe even what prototypes we've declared) would be absolutely great
>
These are standard unix tools. Try opening X and use a couple of terminals.
> I would like the ability to use whatever editor I wished. I like VIm some
> folks like Vile some like Emacs and there are probably pico
> zealots out there
Use whatever editor you choose? What does this have to do with anything.
>
> as I type this out, I'm thinking that possibly it wouldn't be terriblyi
> hard to do with tcl/TK or perl/TK
>
> though speed, would it be fast enough?
>
> I've never written a GUI app for *nix so I'm not sure
>
> as I talk about this
>
> I'm thinking that this would be a pretty good project.
>
> Anyone want to join with me in an attempt?
>
>
> Aaron
> -----
> It snowed a lot out here.
> -Kathy, Aaron, Avi, Vern
>
>
It's been done already. Look over you X bin directory and wish been directory.
Aaron, I hate to be blustery, but franking, everytime a Winodws "programer"
touches a unix box and complains that they are missing a Delphi interface I
want to puke. It takes more time to learn that junk then it does to focus on
programing. And stepping through code is vertually useless, but has become
a crutch for programers who really don't understand what they are doing.
Stop programming anything more today. Then get the book called
UNIX TOOLS
Rewad it and study it inside out.
With debuggers, RCS control, VIM, grep make, autoconfig etc etc etc.
there is just no need for a complex GUI. You and your VI editor
(and your brain) make the most powerful development enviorment possible.
Ruben
------------------------------
Date: Thu, 15 Apr 1999 08:37:12 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Regex Q?
Message-Id: <ohm4f7.7p7.ln@magna.metronet.com>
Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote:
: <andrewg6969@my-dejanews.com> wrote:
: > catbert:/export/home 192800 13224 177648 7% /mnt
: >
: > What is wrong with this line that it doesn't pass over the line containing
: > "catbert:" ?
: >
: > last if ($Line !~ /\w:\//); # ditch Local entries
: If you want to break out of the loop on the catbert: line, you don't
: want to negate the value of the match:
: last if ($Line =~ m{\w:/});
And if you want to allow more than a single word character
before the colon, then you need to say so :-)
last if ($Line =~ m{\w+:/});
^
^
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Apr 1999 14:20:50 +0200
From: "Andrea Borgogelli Avveduti" <borgo@indi.it>
Subject: PerlIS and system command: please help me
Message-Id: <7f4ll7$d6q$1@nslave1.tin.it>
Hi Expert
I use Perl for win32 and PerlIS on a NT server.
This is one of my CGI:
$inputfile = "N:\\filename.doc";
$outputfile = "C:\\dir\\subdir\\filename2.doc";
system "copy \"$inputfile\" \"$outputfile\"";
where N is a network drive.
My CGI doesn't work with PerlIS but works if i execute it with the Perl
command.
Why ? How can I do it working ?
If I change the network drive N: with the local drive C: all work fine.
Thank you.
Andrea (borgo@indi.it)
Please write me back at this address: borgo@indi.it
------------------------------
Date: Thu, 15 Apr 1999 12:41:21 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Printing a file
Message-Id: <3715E074.41B1C465@home.com>
[posted & mailed]
Carlos Ramirez wrote:
>
> Try:
>
> local $/;
> open FILE,$filename or die "Could not open $fielname : $!\n";
^^^^
But don't forget -w and 'use strict' to catch common typos like this.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 15 Apr 1999 14:05:56 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Question about variables, and Perl in general
Message-Id: <7f4ro4$372$1@nclient3-gui.server.ntli.net>
I have a slight problem with a scalar. I'm inserting a value into a table
in MySQL, which has an auto_increment field. This basically means I can
tell it to insert 0, and it will instead take the next highest number and put
that in the table instead. I can then get that number by calling a method.
However, the number seems to be too big for a scalar to handle, and so it
needs to be treated as a string. Any ideas on how to do this? Here is an
example of the code.
my $query = "INSERT INTO foo VALUES (0, 'Test')";
my $sth = $dbh->query($query) or warn "Can't $query\n";
my $id = $sth->insertid;
The insertid method returns the number I was talking about. However instead
of getting a 13 digit number, I get a 10 digit number. Any ideas on how
to get the real number?
Secondly, and less importantly, does anyone know where to send suggestions
for changes/improvements to the Perl language to? I have a few ideas that I'd
like someone who is involved in developing Perl to look over and ridicule :)
Thanks in advance,
Aidan
------------------------------
Date: 15 Apr 1999 14:31:47 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Re: Question about variables, and Perl in general
Message-Id: <7f4t8j$3bq$1@nclient3-gui.server.ntli.net>
Sorry about the double post, my connection died to my news server, and I
didn't think the article had been posted.
Aidan
------------------------------
Date: 15 Apr 1999 10:48:40 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Re: Question about variables, and Perl in general
Message-Id: <m3lnfuuegn.fsf@joshua.panix.com>
Aidan Rogers <aidan@salvador.blackstar.co.uk> writes:
> However, the number seems to be too big for a scalar to handle, and
> so it needs to be treated as a string.
You seem to be confused about what a scalar is and about how Perl
handles data typing. I think you need to read two things: _Learning
Perl_ (published by O'Reilly), and the perldata man page (which comes
with perl).
> Secondly, and less importantly, does anyone know where to send
> suggestions for changes/improvements to the Perl language to?
You should know the language intimately before you worry about
improving it. By the time you know the language that well, you'll
certainly know who to talk to about such improvements. See the
www.perl.com page for pointers to the appropriate mailing lists.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Thu, 15 Apr 1999 10:39:55 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Registry Information
Message-Id: <MPG.117fc4432852226a98968f@news.idt.net>
heh, ruthless... ruthless...
Daniel
In article <37146e64.0@newsread3.dircon.co.uk>, gellyfish@gellyfish.com
says...
> alan rogers <arogers@rational.com> wrote:
> > Hi,
> >
> > I wonder if anybody out there could help me.
> > I need to get information from the NT Registry and pass it into a
> > variable so I use in my program
> > This is the registry information is this
> > HKEY_LOCAL_MACHINE\SOFTWARE\ATRIA\ClearCase\CurrentVersion\ProductHome
> >
>
> Would you believe there is a module Win32::Registry that comes with the
> ActivePerl distribution.
>
> /J\
>
------------------------------
Date: 15 Apr 1999 14:29:37 GMT
From: Aidan Rogers <aidan@salvador.blackstar.co.uk>
Subject: Scalar length and general Perl questions
Message-Id: <7f4t4h$39o$1@nclient3-gui.server.ntli.net>
I have a slight problem with a scalar. I'm inserting a value into a table
in MySQL, which has an auto_increment field. This basically means I can
tell it to insert 0, and it will instead take the next highest number and put
that in the table instead. I can then get that number by calling a method.
However, the number seems to be too big for a scalar to handle, and so it
needs to be treated as a string. Any ideas on how to do this? Here is an
example of the code.
my $query = "INSERT INTO foo VALUES (0, 'Test')";
my $sth = $dbh->query($query) or warn "Can't $query\n";
my $id = $sth->insertid;
The insertid method returns the number I was talking about. However instead
of getting a 13 digit number, I get a 10 digit number. Any ideas on how
to get the real number?
Secondly, and less importantly, does anyone know where to send suggestions
for changes/improvements to the Perl language to? I have a few ideas that I'd
like someone who is involved in developing Perl to look over and ridicule :)
Thanks in advance,
Aidan
------------------------------
Date: Thu, 15 Apr 1999 13:22:13 +0200
From: Ernst <ernstc@post3.tele.dk>
Subject: Re: SQL and the ODBC module
Message-Id: <3715CBE5.EBA63ABA@post3.tele.dk>
Hi
If you want to insert you cannot use the where clause
If you want to Update, your syntax is wrong
Ernst
leejola@my-dejanews.com wrote:
> I am using the ODBC module to interface with and Access 97 database for a
> web-based project. I need to use an "INSERT INTO" statement to append a new
> record to the database. I was using the statement shown below and yet still it
> doesn't work. Any assistance given to help solve this problem would be greatly
> appreciated.
>
> $db->Sql("INSERT INTO tblPayeeList (Payee, Address, City, PayeeDescr, AcctNum,
> Phone) VALUES ('$PayeeName', '$Address', '$City', '$PayeeType', '$AccountNum',
> '$Phone') WHERE Username = '$LoginName'");
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 15 Apr 1999 08:21:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: stripping html tags
Message-Id: <dkl4f7.7p7.ln@magna.metronet.com>
suribond@my-dejanews.com wrote:
: Is there an built in utility in perl(or any other language)
: that removes the html tags from a html file and gives only its
: text content.
Perl FAQ, part 9:
"How do I remove HTML from a string?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 15 Apr 1999 16:06:11 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: stripping html tags
Message-Id: <3715F253.289BE11E@datenrevision.de>
Abigail wrote:
>
> suribond@my-dejanews.com (suribond@my-dejanews.com) wrote on MMLIII
> September MCMXCIII in <URL:news:7f3p7m$kae$1@nnrp1.dejanews.com>:
> ;; dear sirs,
> ;; Is there an built in utility in perl(or any other language)
> ;; that removes the html tags from a html file and gives only its
> ;; text content.
>
> No, of course not. Perl is totally unaware of the existance of
> HTML, PDF, GIF and MIDI. There are rumours that it can handle
> beer though.
>
> However, there are modules on CPAN that you can use.
And scripts, such as tchrist's striff-tummel (aka striphtml) one.
Cheers,
Philip
------------------------------
Date: Thu, 15 Apr 1999 12:23:54 +0100
From: "Matt" <info@blue.uk.com>
Subject: sub's
Message-Id: <7f4i19$2mc$1@starburst.uk.insnet.net>
Hello
Is there anything wrong with the next line?
&{$hash{'key'}}();
This is not a quiz, the line does work, I just wondered if I'm doing
something not quite proper.
Many thanks
Matt
------------------------------
Date: 15 Apr 1999 13:38:51 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: sub's
Message-Id: <3715dddb@newsread3.dircon.co.uk>
Matt <info@blue.uk.com> wrote:
>
> Is there anything wrong with the next line?
>
>
> &{$hash{'key'}}();
>
>
> This is not a quiz, the line does work, I just wondered if I'm doing
> something not quite proper.
>
What do you mean 'something not quite proper' - if you intend to be accessing
a subroutine a reference to which is in a hash then that is fine if you
dont intend to do that then you'll have to explain.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: Thu, 15 Apr 1999 13:03:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: sub's
Message-Id: <3715e374.271274@news.skynet.be>
Matt wrote:
>s there anything wrong with the next line?
>
>&{$hash{'key'}}();
>
>This is not a quiz, the line does work, I just wondered if I'm doing
>something not quite proper.
It's proper alright.
Know that there's an alternative equivalent syntax:
$hash{'key'}->();
Bart.
------------------------------
Date: 15 Apr 1999 14:20:16 GMT
From: <bbense+comp.lang.perl.misc.Apr.15.99@telemark.stanford.edu> ;
Subject: Re: Typeglobs broken by threaded perl???
Message-Id: <7f4sj0$58d$1@nntp.Stanford.EDU>
In article <7f2psn$pe0$1@news.nist.gov>,
Bruce R Miller <miller@altaira.cam.nist.gov> wrote:
>In article <7f2ls4$n7c$1@nntp.stanford.edu>,
> <bbense+comp.lang.perl.misc.Apr.14.99@telemark.stanford.edu> ; writes:
>[...]
>>- - Global variables and threads don't play nice. I think the design
>>change follows the principal of least suprise. If you use $_ as a
>>read-only variable in the local scope, ( like 99% of the existing
>>perl code does ) , you won't see any difference btw thread-enabled
>>and unthreaded perl.
>
>Hmm, most of the (non-library) code I've looked at treats $_ as something
>to be eaten from, rather than just read; lots of stuff like
> s/^patterns// && do something($1...)
- - This kind of thing is the 99% use I meant. By read-only I meant that
$_ never appears on the left hand side of an assignment statement.
>
>'Course maybe I've been looking at the wrong code..:>
>Not that I'm advocating it either... sometimes you just inherit
>questionable software...
- - I don't think that use is all that questionable.
>
>>- - The problem arises when you actually try and use threads. If $_
>>is global, chaos ensues when you attempt to use $_ in the usual
>>manner.
>
>If the threads dont want to share $_, can't they just put a
> local($_)
>somewhere near the beginning of each thread? Then each thread would
>see its own binding of $_ ??
>Or not? Maybe I'm thinking too lispy? (been known to happen!)
>
- - Local doesn't work like you're thinking. I'm not sure if I
understand it entirely myself, but local is not local in the
sense most programmers think of it as. If my understanding is
correct, a "local" variable still has an entry in the global
symbol table. "local foo" works like an autopackage command, ie.
give me an entry in the global symbol table that uses scope
to create an entry and alias foo to that entry.
- - "my" does the right thing in this context, but since my is lexical
you'd need to do my "$_" at every change of scope. This is exactly
how threaded perl behaves.
- - The way that perl manages symbols is pretty non-inituitive to
someone that started in lisp or C. I'm still not positive that
my explaination above is entirely correct.
- - Booker C. Bense
Version: 2.6.2
iQCVAwUBNxX1nQD83u1ILnWNAQFLugQApZC7wNSobRON7NU67xqBgYscvnHeCX+e
d17zA2UL4PvhF4/yeK27HGg4M/GkaG3wCiV1Z/maONjEbtvEf5/T0LEnMsP4kdKe
RI0LWhtXKidp1p0dsMZjE4sH8eHbFDpaSTiW4ZZPUZSQ6YKxX4KbV7WXCOZeDfF0
HULjEpjMqLI=
=NDCT
-----END PGP SIGNATURE-----
------------------------------
Date: 15 Apr 1999 10:43:41 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: jbritain@home.com (Jim Britain)
Subject: Re: want regex to set a value in place of a procedure
Message-Id: <m3ogkqueoy.fsf@joshua.panix.com>
jbritain@home.com (Jim Britain) writes:
> if ($value =~ s/.*([0-5]).*/$1/){}else{$value=''}
$value = $value =~ /([0-5])/ ? $1 : '';
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Thu, 15 Apr 1999 15:49:02 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Whats wrong with this?
Message-Id: <3715EE4E.9F56611D@datenrevision.de>
billy_collins@my-dejanews.com wrote:
>
> Hi all, can someone tell me whats wrong with this code!
>
> ______ <SNIP> _____
>
> #!/usr/local/bin/perl5
> $n = `man pico`;
>
> print "Content-type: text/html\n\n";
> print <<EndOfHtml;
> <html><body>
> $n
> </body></html>
> EndOfHtml
>
> ______ </SNIP> _____
For one thing, you probably don't want to use text/html but rather
text/plain, so that you can dispense with <html><body> etc., and also
have newlines interpreted correctly.
Cheers,
Philip
------------------------------
Date: Thu, 15 Apr 1999 22:35:37 +1000
From: "Matthew B. Kennedy" <m.kennedy@ieee.org>
Subject: Why a complex numbers package?
Message-Id: <7f4m5e$d59$1@dove.qut.edu.au>
Can anyone tell me when they last used the complex numbers package in a Perl
script?
Coming from an engineering background, I find it amuzing to consider that an
implementation of complex numbers might be useful in this sort of language.
Does this package exist in the standard set merely because it could be
written?
I might be too cynical, but I'd love to hear where it may have been used in
a script. Examples please, if you got 'em.
Matt :-)
------------------------------
Date: 15 Apr 1999 13:06:28 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: Why a complex numbers package?
Message-Id: <7f4o8k$hmu$1@uwm.edu>
Matthew B. Kennedy <m.kennedy@ieee.org> wrote:
: Can anyone tell me when they last used the complex numbers package in a Perl
: script?
: Coming from an engineering background, I find it amuzing to consider that an
: implementation of complex numbers might be useful in this sort of language.
: Does this package exist in the standard set merely because it could be
: written?
: I might be too cynical, but I'd love to hear where it may have been used in
: a script. Examples please, if you got 'em.
No, unfortunately I learned c++ before I learned perl, and
all my complex-number manipulations are done with that.
If I had the time, I'd bring it all over into perl: actually,
considering the time it takes me to debug my c++ code, I
suppose I do have the time...but not the nerve to begin such
an undertaking
But I wouldn't use the complex numbers package--I'd translate
the one I wrote in c++, and my own vectors/matrix classes
too. Sure they're clumsy but they work for me.
I'll never be a JAPH, but perl is good to its barely
competent users, too.
--thelma
: Matt :-)
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5390
**************************************