[11742] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5342 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 9 15:07:27 1999

Date: Fri, 9 Apr 99 12:00:22 -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           Fri, 9 Apr 1999     Volume: 8 Number: 5342

Today's topics:
    Re: =~tr / / /; problem <uri@home.sysarch.com>
    Re: Anyone help with reading from data file?  Read here (Larry Rosler)
        Best Way to handle data from a form <greg2@surfaid.org>
    Re: Cannot execute PerlScript in ASP ncollins1@my-dejanews.com
    Re: Finding country by Perl on Linux <cassell@mail.cor.epa.gov>
        form to email mails twice <firetips@taconic.net>
    Re: Glob Problem <Wm.Blasius@ks.sel.alcatel.de>
    Re: Glob Problem <cassell@mail.cor.epa.gov>
    Re: HELP! Code needed for line of best fit?!?!? <cassell@mail.cor.epa.gov>
    Re: Hotmail's Homepages <smiles@wfubmc.edu>
    Re: How can perl scripts support drag-n-drop in Win32 e <Allan@due.net>
    Re: How do you pass cmd line parameter? (M.J.T. Guy)
        Incrementing a hash value. <grichard@uci.edu>
    Re: Incrementing a hash value. <jonsmirl@mediaone.com>
    Re: Is Javascript better than Perl? <cassell@mail.cor.epa.gov>
    Re: Most elegant random string generator? (and => oddit (M.J.T. Guy)
    Re: No echo on a socket connection (Christopher Allene)
    Re: Perl conception <cassell@mail.cor.epa.gov>
    Re: Privacy for slaves forced to use a proxy/firewall t foj@nym.alias.net
    Re: Privacy for slaves forced to use a proxy/firewall t (Cam Penner)
    Re: SORT BY DATE <jglascoe@giss.nasa.gov>
    Re: Stripping html tags within perl (Larry Rosler)
        Transfering mldbm databases from windows to unix joel@testtutor.com
    Re: Trouble with DBI and Oracle (Darren Greer)
    Re: Trouble with DBI and Oracle (Darren Greer)
    Re: Very large regular expressions (M.J.T. Guy)
    Re: Win-32 / Unix CGI question (Larry Rosler)
    Re: Yet another regexp question (Sam Holden)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 09 Apr 1999 14:04:02 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: =~tr / / /; problem
Message-Id: <x7d81dsmb1.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> 13:49:13 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
  >> lr@hpl.hp.com (Larry Rosler) writes:

  >> And I hate to disagree with you :-)
  >> My version of the perlfunc doc says:
  >> 
  >> tr///   The translation operator.  Same as y///. See the
  >> perlop manpage.
  >> 
  >> What's happening there?

  LR> What's happening is that the docs were changed for version 5.005_02.

  LR> After reviewing the other submissions to this thread and the dictionary 
  LR> definitions of 'translate' and 'transliterate', I now think this change 
  LR> was ill-advised, and that 'translate' comes closer to what is meant.

  LR> Consider some other capabilities of 'tr' than simply character-to-
  LR> character replacement (my ad hoc definitions):

  LR> /d : Translate any of a set of characters to no character.

  LR> /s : Translate a sequence of identical characters to one character.

  LR> The verb 'transliterate' simply wouldn't do here, I think.

oh, we are changing our minds, are we? welcome back from the dark side
of the force, larry. :-)

i posted about this to the p5p news gateway but no one seems to have read
it. i may email it instead.

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


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

Date: Fri, 9 Apr 1999 11:44:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Anyone help with reading from data file?  Read here.
Message-Id: <MPG.1177ea8124233f1f98987d@nntp.hpl.hp.com>

In article <370a2bfe@news.greatbasin.net> on Tue, 6 Apr 1999 08:42:30 -
0700, Freaky <D@nt.Email.Me> says...
> Does anyone know how to read a data file in reverse order? I use the format
> open (HEADERREAD, "$file3") or die "Unable to open...
> and it will only read in normal order.  Im just curious if theres a way to
> reverse it.  Thanks.

All the other responses to this post have read the entire file into a 
list, then reversed the elements.  This is fine for reasonably sized 
files; in fact, it is trivial.

For huge files (for example, server logs), a more sophisticated approach 
is required.  I suggest you search this newsgroup in DejaNews for 
keywords 'read file backwards' (I found 103 messages).  In particular, 
look at a module 'Backwards.pm' that Uri Guttman has developed.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 09 Apr 1999 19:30:28 +0100
From: Greg Griffiths <greg2@surfaid.org>
Subject: Best Way to handle data from a form
Message-Id: <370E4744.6289BCF2@surfaid.org>

I have a database generated HTML form that listed all the item in the
database and asks you to select which ones you want to collect, the HTML
is as follows :

<tr><td width="25%">Aberdeen CU</td><td width="25%"
align="center"><INPUT TYPE="checkbox"  NAME="1"></td>
<td width="25%">Aberdeen MethSoc</td><td width="25%"
align="center"><INPUT TYPE="checkbox"  NAME="72"></td></tr>
<tr><td width="25%">Aberdeen Revelation (Rock Gospel)</td><td
width="25%" align="center"><INPUT TYPE="checkbox"  NAME="256"></td>

I need a way of handling them on the server side, I need them in
something that I can loop through as I need to do an INSERT query for
each, but my copy of Form-mail etc are all a bit mangled. The Pseudo
code is as follows :

if we have a positive value in the box
	INSERT
else
	IGNORE

my problem is that the number of entries is not fixed.

Hope that this is clear enough for you all.

thanks in advance for the help.


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

Date: Fri, 09 Apr 1999 18:01:51 GMT
From: ncollins1@my-dejanews.com
Subject: Re: Cannot execute PerlScript in ASP
Message-Id: <7elfac$t2a$1@nnrp1.dejanews.com>

In article <370DB710.7F6B9BAC@eml.ericsson.se>,
  Matt Sergeant <matthew.sergeant@eml.ericsson.se> wrote:
> ncollins1@my-dejanews.com wrote:
> >
> > I installed ActivePerl on my WinNT (IIS 4.0) server.  I want to be able to
> > send an mail message from a form.  For testing I hardcoded variable's values
> > (once this works I will pass them from the form).  I am not able to run the
> > below .asp page when the .html form is submitted.  However when I copied the
> > PerlScript code into .pl file (deleted the <% and %> tags) and ran it from
> > the command line the email was successfully send.  So my guess is that ASP
> > does not know where to look for PerlScript on my computer.  How can I make
> > ASP know about PerlScript location?
>
> You need to give more information.
>
> What version of ActivePerl?
build 509
> What error message?
The MS IE was freezing
> What makes you think it's because ASP doesn't know about the "PerlScript
> location"?
Because I was able to execute the same script from the command line
>
I fixed it by doing two things:
1. downloading build 513.  That made my "Hello, world!" script work (with
ActivePerl 509 it was not working) but the email script still made IE freeze
when executed)
2.  Strange enough but when I placed
$Response->write("Your email is sent!");
at the very end of the script that fixed it.

Thanks.

Natalia


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 09 Apr 1999 11:03:46 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Finding country by Perl on Linux
Message-Id: <370E4102.538EFB8C@mail.cor.epa.gov>

Tim Burgess wrote:
> 
> Hi all,
> 
> I'm writing a Perl script that needs to work out which country
> it's running in(!). The script will be primarily for Linux
> (Debian) boxes and I thought about using the timezone data
> but there are multiple countries in a single timezone. I'd
> prefer not to use any modules as I can't guarantee that
> anything but base Perl will be on the box...
> 
> I imagine there must be a way using internationalisation
> but I've haven't scripted any in code previously. Last resort
> is to ask the user.... and hope they speak English :)
> --
>  _Tim Burgess_____________________Ba.App.Sc.(Hons) RMIT__
> | InterCollegiate Network Administrator                 |
> | Ormond College, University of Melbourne               |
> | Parkville, VIC 3052 Australia                         |
> |_Mail:tim@ormond.unimelb.edu.au_____Ph: 03-9344-1212___|

I think you'll want to read through the perllocale manpage.  
'perldoc perllocale' should get you there.  Can you depend on the
setlocale() function in the user's system's C library?  If not
then you may have to fall back on your 'last resort'.

You might be interested in the latest issue of The Perl Journal.
Sean Burke and Jordan Lachler have a great article on localizing
Perl programs.

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Fri, 09 Apr 1999 14:38:54 -0400
From: steve schwarz <firetips@taconic.net>
Subject: form to email mails twice
Message-Id: <370E493E.D7144D91@taconic.net>

hi

i'm very new to perl, i have a very simple form whose sole purpose is to
take data from a field and email to an adress.  it works but it emails
twice (the first mailing is correct, the second mailing shows a portion
of what is supposed to be sent).

the form in the html doc looks like this



<form method="post" action="http://www.firetips.com/cgi-bin/link.cgi">
<pre><b>
enter address here HTTP://WWW.<input type="text" name="http" size=20>
<input type="submit" value="Request">

</b></pre>
  </form>






THE perl doc looks like this

#!/bin/perl
                                require "cgi-lib.cgi";
                                &ReadParse(*form_data);

                                require "ftsubs.cgi";

$mailprogram = "/bin/sendmail -t";

open (MAIL,"|$mailprogram");
print MAIL "To: $mail\n";
print MAIL "Subject: 'Link Request'\n\n";
print MAIL qq!
   $form_data{'http'} \n
   http://www.$form_data{'http'} \n

!;
close MAIL;





THE  ftsubs.cgi document which is required is this

#!/bin/perl

$mail = "firetips\@firetips.com";


am i doing something wrong in my script that is causing the mail program
to mail twice or is there possibly a problem with the network


mike cardeiro




  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
    http://www.newsfeeds.com/       The Largest Usenet Servers in the World!
---------== Over 72,000 Groups, Plus    Dedicated  Binaries Servers ==--------


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

Date: Fri, 09 Apr 1999 19:22:25 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: Re: Glob Problem
Message-Id: <370E3751.15FB7483@ks.sel.alcatel.de>

Martin wrote:
> 
> >Works fine for me with perl5.005_02 on intel linux and sparc solaris...
> 
> I'm using Perl5.004_04 could that be the problem?
> 
> Martin

I tried with Perl5.004 under Solaris 4.1 - works for me too!


Wm
-- 
 ...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!


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

Date: Fri, 09 Apr 1999 11:30:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Glob Problem
Message-Id: <370E475F.FB5E1B6B@mail.cor.epa.gov>

Martin wrote:
> 
> Hi!
> 
> I'm having a problem with globs. I've written a script (CGI but this
> isn't a CGI problem as the problem occurs when run from the
> command line). Although the script works fine on an NT server, it
> doesn't work fully on a Unix server and I believe this is because
> of the globs. I tested the following:
> 
> perl -e "print join(' ',<*>)"  on Windows NT Server
> perl -e 'print join(" ",<*>)'  on Unix Server
> 
> On the NT server, it did as I expected, printed the directory listing
> with a space between each file name. On the Unix server nothing was
> printed at all.
> 
> Martin

Hmm.  I was expecting to see that the problem was on the win box.
Well, this works for me just fine.  Here's my system:

cassell@jett 237% perl -v  

This is perl, version 5.004_04 built for sun4-solaris

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.


What are you running?  Oh, and I won't insult your intelligence by
asking
if there are any files in the unix directory where you tried this...

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Fri, 09 Apr 1999 11:23:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: HELP! Code needed for line of best fit?!?!?
Message-Id: <370E4594.57E72D58@mail.cor.epa.gov>

Andrew Weller wrote:
> 
> Dear All,
> 
> I need to write some code that basically filters out a set of points.
> 
> With a scattering of points how does one 'filter-out' (average) the unwanted
> points and is left with a line of best fit, which can then be saved to a
> file?
> 
> Thanks loads,
> 
> Andy

Andy, I can try to provide some help here, but this is a really vaguely
written request.  I will have to make some assumptions about your goals.

First, I'm assuming you do not really want a 'filter' on a set of
points,
but rather a some sort of outlier-detection system followed by a linear
(or possibly non-linear) regression package.

[1] How can you assess outliers based on the science of the problem?
    That is the most effective way to start your problem.  Statistical
    screening for outliers is fraught with dangers for the unwary.
    Let me just point out that in astrophysics, all the *interesting*
    data are those outliers.  You may not want to discard anything.

[2] Is this really a simple linear regression problem?  Are all the
    underlying statistical and scientific assumptions met?  If so,
    there are some Stat::* modules on CPAN which will do your dirty
    work for you.  If you need something more sophisticated, you might
    need to look at the Math::Matrix or PDL modules.  You may
    actually be asking for an implementation of LOESS, whether you're
    aware of that or not.

[3] Hmm.  I seem to have painted myself into a corner.  My best advice
    now is to take your problem to a consulting statistician in the
    math or stat or math sciences department there at Keele, and ask
    for a face-to-face consultation.

HTH,
David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Thu, 08 Apr 1999 13:49:01 -0400
From: Steve Miles <smiles@wfubmc.edu>
Subject: Re: Hotmail's Homepages
Message-Id: <370CEC0D.7618C926@wfubmc.edu>

I use Netscape Communicator 4.51 and can see the source for all of Hotmail's pages. I
think there is no way to protect the html source code - if there were, EVERYONE (or at
least most compainies) would hide it.

Steve Miles
http://www.groundbreak.com

Patrick Fong wrote:

> Hi
>
> I know the answer to this question may violate copyright laws, but perhaps
> someone could give me a hint about the answer.
>
> If anyone has been to Hotmail.com, and tried to view the source to their
> homepages, you will not be able to. How does someone protect other people
> from viewing the source to their homepages? (I have seen this question in
> a FAQ at irt.org and the answer is you cant).Perhaps someone would know? I
> am very interested in it because of the security issues involved in it.
>
> Oh btw, where can I find out about protecting pages from being viewed? As
> in password protect a page? I know of JavaScript capabilities and to some
> extent Perl. I have looked in developer.netscape.com and found nothing and
> also Perl.com. Perhaps someone who is doing WWW stuff professionally may
> be able to point me in the right direction.
>
> Tnx in advance
>
> P.
>
> *************************************************************************************
> So how?
>
> *************************************************************************************

--
=============================================
Steve Miles (smiles@wfubmc.edu)
----> http://www.groundbreak.com  <----
Wake Forest University School of Medicine
5019 Hanes, Medical Center Blvd.
Winston-Salem, NC 27157
Phone: 336.716.0454     FAX: 336.716.7200
=============================================




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

Date: Fri, 9 Apr 1999 14:53:30 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: How can perl scripts support drag-n-drop in Win32 environment?
Message-Id: <7eli48$ab6$1@camel25.mindspring.com>

:Robert Miller wrote in message <7ele0a$61k$1@Masala.CC.UH.EDU>...:To the
:gurus...
:
:Under Activeware Perl for Win32, I have a script that runs OK from the
command :line (i.e. - perl.exe script.pl arg1.txt). Is there some simple way
to create a shortcut :or other GUI object that I can drop "arg1.txt" on to
do the same thing? I haven't :seen anything about this in the Perl Win32
FAQ.
:
In your Activeware distribution you received a batch program named pl2bat.
Just run pl2bat on your Perl script.

At the prompt simply type: pl2bat script.pl
and the batch file script.bat will be created.  Now you can just drag
arg1.txt on script.bat and you are off and running.

HTH

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
'Out, out brief candle!
Life's but a walking shadow,
a poor player, that struts and frets his hour upon the stage,
And then is heard no more; It is a tale, told by an idiot,
full of sound and fury, signifying nothing'
 - MacBeth





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

Date: 9 Apr 1999 18:51:04 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How do you pass cmd line parameter?
Message-Id: <7eli6o$9u2$1@pegasus.csx.cam.ac.uk>

Steve Swett <swett@ncats.net> wrote:
>How do you pass a command line parameter from one program to another?
>
>#!/usr/bin/perl -w
>use diagnostics;
>$parm1=$argv[0];

Make that $ARGV[0].   Perl identifiers are case sensitive.
Since you're using -w, you should have got a warning about $argv[0]
not being defined.

And you may prefer to write instead

 $parm1 = shift;


Mike Guy


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

Date: Fri, 9 Apr 1999 11:24:14 -0700
From: "Gabriel Richards" <grichard@uci.edu>
Subject: Incrementing a hash value.
Message-Id: <7elgdl$d7p@news.service.uci.edu>

Hi.

I want to read in a text file and tally up strings that are the same. So my
idea was to create a hash with the strings as the keys and increment the
value associated with the key everytime it comes up again. I get this error
from perl -w:

"Useless use of numeric eq in void context...at line 11."

Here's the code:

 if (exists($tally{$line})) {$tally{$line} += 1} #line 11
 else {$tally{$line} = 1}

What does the error message mean? How can I increment the value associated
to $tally{$line}? Thanks.

Gabe




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

Date: Fri, 9 Apr 1999 14:28:58 -0400
From: "Jon Smirl" <jonsmirl@mediaone.com>
Subject: Re: Incrementing a hash value.
Message-Id: <TFrP2.4999$tY1.2995@wbnws01.ne.mediaone.net>

I had the same problem and decided that -w does not always make things
cleaner and clearer.

Which is more obvious and better performing?

 if (exists($tally{$line})) {$tally{$line} += 1} else {$tally{$line} = 1}

or

$tally{$line}++;

--
Jon Smirl
jonsmirl@mediaone.net

Gabriel Richards <grichard@uci.edu> wrote in message
news:7elgdl$d7p@news.service.uci.edu...
> Hi.
>
> I want to read in a text file and tally up strings that are the same. So
my
> idea was to create a hash with the strings as the keys and increment the
> value associated with the key everytime it comes up again. I get this
error
> from perl -w:
>
> "Useless use of numeric eq in void context...at line 11."
>
> Here's the code:
>
>  if (exists($tally{$line})) {$tally{$line} += 1} #line 11
>  else {$tally{$line} = 1}
>
> What does the error message mean? How can I increment the value associated
> to $tally{$line}? Thanks.
>
> Gabe
>
>




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

Date: Fri, 09 Apr 1999 11:45:26 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Is Javascript better than Perl?
Message-Id: <370E4AC6.8490C06A@mail.cor.epa.gov>

Macrosheep wrote:
> 
> I'm doing a project for an Independent Study at WPI.  I was wondering if anyone
> had feedback concerning Java's pluses and minuses vs. Perl as a script
> language?

You seem to have Java and Javascript confused.  Or was your title a
typo?
Java and Javascript are *very* different beasts.  If you're thinking
about
so-called scripting languages, then you presumably mean Javascript
instead
of Java.  You'll want to get this very clear before you turn in your
paper,
or your profs will do more than just flame you over the Net.  :-)

> For example, do you think Java's more client-based processing is preferable to
> Perl's server-based?

I don't think that client-based vs server-based is really the best way
to
characterize Javascript vs Perl.
 
> Are script languages something that helps usability of the web, or are they
> simply technological marvels that we do because we can, without realizing that
> the average American has a slow internet connection and many have slow
> computers (where Java can be quite annoying).

Actually, Java and Javascript can be pretty annoying on fast machines
too.
that's why lots of people have both turned off within their browsers.
And the script features of Perl go far beyond web bandwidth.  The
*important* thing about Perl as a script instead of compiled program
[at least for me] is that you avoid the dreaded
write-compile-link-curse-
debug-repeat cycle that is so painfulyl common with languages like C++
that one has to spend big wads of $$ on IDE's.

> Any feedback, positive or negative would be appreciated.  Thanks.
> 
> --Macrosheep

Then I suggest you pop on over to www.perl.org and find their web page
comparing languages.  That may help you.


And remember that the information you get over the Internet is worth
exactly what you paid for it.  In other words:

Sturgeon's Law: 90% of everything is crap.  [Theodore Sturgeon]
Cassell's Internet Corollary:  Sturgeon was being generous.

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 9 Apr 1999 18:46:01 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Most elegant random string generator? (and => oddity)
Message-Id: <7elht9$9ic$1@pegasus.csx.cam.ac.uk>

In article <7eel3t$lbq@llama.swcp.com>, Tramm Hudson <hudson@swcp.com> wrote:
>And since map supplies list context, my parentheses on (1..$nchar)
>were superfluous.

Wrong.   Parentheses do not determine context (except in three special
cases).    Parentheses merely override operator precedence.
So the parentheses are superfluous, but not for the reason given.

RTFM to find the three special cases.


Mike Guy


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

Date: Fri, 9 Apr 1999 20:08:16 +0100
From: cwis@dial.oleane.com (Christopher Allene)
Subject: Re: No echo on a socket connection
Message-Id: <1dq042h.6n8yo65140gpN@[192.168.1.2]>

<kevin_collins@my-dejanews.com> wrote:

>     I am trying to write a simple socket daemon that will pass data via a
> network port. I have the basic daemon running fine, but I need to figure out
> how I can prompt the user for a password without having the password echoed to
> the client.

You need to use the option negociation procedure described within the
RFC854 - Telnet protocol -- assuming you're telnet'ing to your server
which is probably what you want.
I know of a Net::Telnet module available from CPAN, but since I didn't
take a look at it, I don't know if it would suit your need. 

I am currently writing a server application for MacOS computers which
would allow remote users to "telnet" and execute some basic commands.
Since fork() is not implemented in MacPerl, I do my work with IO::Select
and sysread(). I buffer the data til I get a newline and then send it
back to a callback function after having processed it with that
_preprocess subroutine:

sub _preprocess {
    my $telnet = shift;
    my $handle = $telnet->{HANDLE};
    $_ = shift;

    s/\n\r/\n/go;
    s/\r/\n/go;

    while (/\377/o) {
        if (s/([^\377]?)\377\375(.|\n)/$1/o) {
            if (ord ($2) != 1) {
                print $handle "\377\374$2";
            }
        } elsif (s/([^\377]?)\377\373(.|\n)/$1/o) {
            if (ord ($2) != 1) {
                print $handle "\377\376$2";
            }
        } elsif (s/([^\377]?)\377\366/$1/o) { 
            print $handle "\n\rNo, I'm too busy shoting chickens right
now\n\r";
        } else {
            s/([^\377]?)\377[\374\376](.|\n)/$1/o;
            s/([^\377]?)\377./$1/o;
        }
    }

    s/\377\377/\377/go;
    return (/\n/o, $_);
}

Using this subroutine, you turn the echo off with something like that:

    print $handle "Password: \377\373\001";

and you turn it back on with:

    print $handle "\377\374\001\n\r";

(NB: as told above, this is to be run on MacOS, you'll need to do some
work to the \n and \r as their value are swapped in MacPerl, MacOS using
a carriage return to separate lines in text files; for example a CRLF is
\n\r on MacOS and would be \r\n on Unixes.)

> Please email me directly, I am not a subscriber of this news group yet.

Courtesy copy mailed.

-- 
cw|s


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

Date: Fri, 09 Apr 1999 11:54:08 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl conception
Message-Id: <370E4CD0.98594FC0@mail.cor.epa.gov>

Aaron wrote:
> 
> Hi
> 
> I had someone tell me the other day that people don't use perl because of its large footprint
> 
> He went on to say that Java had a smaller footprint because it loaded its classes dynamically by nature
> 
> I was curious as to how much truth is here and how much is a misconception
> 
> It would seem to me that Java would by far have a larger footprint since the JVM would take up memory on top of the code it was executing
> 
> but Perl is in some ways the same way
> 
> is there a document that points to memory consumption difference between the two languages?
> 

Oooh!  My eyes hurt from trying to read those long lines.  Sorry, but
the
Usenet standard is around 72 chars per line.  Okay?

Now then.  Some Javabean is yanking your chain.  Perl can do dynamic
class
loading too.  But that shouldn't alter the footprint as I understand it.
On the other hand, Perl does make a deliberate tradeoff of space to save 
time.  A Perl hash of 10,000 key/value pairs might take up a lot more
room
than a Java struct of the same info.  But what difference does this make
on 
machines with 64M RAM and virtual memory?  Your machine probably has a
lot more RAM is it is new.  More important than that is the painful
slowness of Java in most apps.  Check out Kernighan and Pike's latest
book, and then hit your 'someone' over the head with the example in
there,
where Java seriously underperformed against every other language listed.

Java has its good points.  As does Perl.  Use a hammer on nails and a
screwdriver on woodscrews.
 
David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Fri, 09 Apr 1999 17:51:00 GMT
From: foj@nym.alias.net
Subject: Re: Privacy for slaves forced to use a proxy/firewall to access the net?
Message-Id: <7elem2$shu$1@nnrp1.dejanews.com>


>In article <923647485.631.6@news.remarQ.com>,
>  ran@netgate.net wrote:
>> In <7ejqpi$ibv$1@nnrp1.dejanews.com>, foj@nym.alias.net writes:
>>
>> >All the tight-assed admin will see is a link to a certain IP address or web
>> >site, and packets that look like gibberish in the data area.
>>
>> And,  of course,  s/he will immediately lose all interest in what's
>> contained in those packets.
>>

As they should, right?

>> >Employees have a copyright over their emails
>>
>> Not the ones produced on company time,  they don't.

"A 'work made for hire' is -
(1) a work prepared by an employee within the scope of his or her employment;"

Thus email outside the scope of my employment is my work. And just because I
make a "work" on someone elses computer doesn't mean I have automatically
transferred my copyright to them.

>> And not the ones
>> produced "off the clock" using company resources,

See above.

>>if you happen to live
>> in California (and probably most other jurisdictions, but that happens
>> to be where I work, so that's the one I familiarized myself with).
>>

The totalitarian micromanagers are everywhere I agree - thus the added need
for protection for the individual.

>> > - and yet employers monitor
>> >them.
>>
>> Which has nothing to do with copyright.
>>

It does have something to do with wiretapping. Check out:

http://www.madcapps.com/writings/email.htm

and

http://www.zdnet.com/zdtv/thesite/0197w4/work/work379_012197.html

and

http://www.zdnet.com/zdtv/thesite/0197w4/work/work379jump6_012197.html

and

http://www.mu.edu/dept/webboard/messages/68.html

>> >I consider
>> >uncensored net access at my work to be a requirement for my presence.
>>
>> How nice of the folks at DejaNews to provide that little perk.  You
>> should stay on their good side:  you're not likely to find it at many
>> other employers.

Am I on their bad side? Dejanews is a highly valuable & useful public posting
service. No I am not an employee. No I'm not spamming anyone. No I'm not
flaming anyone. No I'm not libeling anyone.

Are you an employee of remarQ?

>>Of course,  they make you put their little banner ad
>> on everything you post,  but that's a small price to pay for all that
>> free porn,  eh?

Is this all really all about access to "porn?" No. And Dejanews does not
transfer binary attachments in Usenet in any case.

>>
>> Um,  you *do* work for DejaNews,  right?

No more than you are an employee of RemarQ.

>>You're not posting this from
>> there,  using a proxy server in Italy,  and directing email replies to
>> an anonymous remailer,  because *you* want help circumventing a firewall
>> at work,  right?  Of *course* you aren't.

I want to help "circumvent" ALL firewalls from blocking people from FULL
Internet access. No not by hacking them. By using the available technologies
to get through them to places outside that can help us all with FULL and
UNCENCORSED net access - and to encrypt the data stream such that the
operators of these firewalls & proxies can't tell what the person is looking
at or where they are really going.

As we have a global network, the stuffy nose people who want to censor net
access at work, also affect the net access of those in WHOLE COUNTIRES who
MUST use a firewall or proxy to access the net.

<snip>
>> >It seems there are a lot of similarities between totalitarian countries and
>> >father-knows-best tight-assed companies who censor their employees Internet
>> >activities.
>>
>> Only to someone so abysmally ignorant and self-centered he has no idea
>> how soft a life he's got.
>>

Only to those who realize that censorship & firewall blocking at your company
has implications for EVERYONE on the network EVERYWHERE.

Only to those who realize that employers should use OTHER methods to
determine whether their employees are doing anyone useful for the company,
besides illegally (or at the very least unethically) wiretapping their
network traffic.

Only those who realize that access to as much of the totality of human
knowledge as is possible is the best way for us to progress as a species. Some
people ONLY have Internet access at work. Let's say they use their computer
DURING lunch or DURING a break to browse some sex site - that type of activity
should be IGNORED by an ETHICAL and REASONABLE employer.

<clip>
>> No doubt the people trying to avoid being captured and tortured by the
>> secret police will be eternally grateful for your sharing the tools you
>> developed so you could sneak out for a little mid-afternoon
>> cyber-nookie...

Encryption & anonymity has various values: Exposure to more of the totality
of human knowledge; Enhancing a natural process of evolution on the various
cultures of the world, puritanical and otherwise; shining the light of day
upon "secret" documents held closely by certain cults, and etc.

>>
>> >Learn to trust your employees enough to leave them alone.
>>
>> Learn to be worthy of that trust,  by not skulking around like a thief,
>> trying to learn how to steal what you can't obtain through honest
>> negotiation.

If only "honest negotiation" were possible with many employers and government
officials.

When they belittle the value of free and open and uncensored net access at
work and at home (depending on where you live), where is the starting point
for an open dialog with such people?

There is none, at least for now, until what they see as the tyranny of
radically different ideas seeps more into their corporate and country
cultures. I want as much "seeping" as possible!

-------------------------------- end of debate text

If you know of some way for perl to play a role in the following setup, please
let me know:

1. Have a server setup with SSL.
2. People come to a page on the server.
3. People enter in a web address.
4. A script or program of some sort gets the page the user wanted and sends it
out to them over the SSL connection - all the while not changing the URL up at
the top of the user's browser. Perhaps the URL could change if it only
reflected an address which could NOT be viewed by someone else - to determine
where the user was going.
5. The script also adjusts the links in the document such that they are
referenced back to the server.

Can perl act as the "script" above?


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 09 Apr 1999 18:17:34 GMT
From: Cam.Penner@pleasedontspamgoldmedalsystems.com (Cam Penner)
Subject: Re: Privacy for slaves forced to use a proxy/firewall to access the net?
Message-Id: <MPG.1177e40ff5dd25529898e8@news.lngly1.bc.wave.home.com>

In article <7elem2$shu$1@nnrp1.dejanews.com>, foj@nym.alias.net says...

<snip debate I won't involve myself in>

> 
> If you know of some way for perl to play a role in the following setup, please
> let me know:
> 
> 1. Have a server setup with SSL.
> 2. People come to a page on the server.
> 3. People enter in a web address.
> 4. A script or program of some sort gets the page the user wanted and sends it
> out to them over the SSL connection - all the while not changing the URL up at
> the top of the user's browser. Perhaps the URL could change if it only
> reflected an address which could NOT be viewed by someone else - to determine
> where the user was going.
> 5. The script also adjusts the links in the document such that they are
> referenced back to the server.
> 
> Can perl act as the "script" above?

Uh, if the network admins that you are trying to get around can't see 
where you are going or sniff your packets do you really think they'll 
give up or lose a single second of sleep?  They'll just put your initial 
"anonomizer site" in the banned list and deny all access to it.  Network 
admin's 1, you 0.  It's a one liner in almost any firewall.
-- 
Cam


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

Date: Fri, 09 Apr 1999 14:40:17 -0400
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Larry Rosler <lr@hpl.hp.com>, bababozorg@aol.com
Subject: Re: SORT BY DATE
Message-Id: <370E4991.AF94C93D@giss.nasa.gov>

[courtesy copy of post sent to Larry and "Bababozorg"]

Larry Rosler wrote:
> 
> Oh, here we go again.  There is absolutely nothing wrong with
> representing a year as a two-digit number, in applications where the
> problem CONTEXT can determine the correct century unambiguously.

Okay, I'll bite:  Bababozorg, what is your problem context?
Does your problem domain involve past/present/future dates?
Is it even *slightly* conceivable that your code will be
around a year from now?

At any rate, here's a line of Perl for you:

sub for_sort { sprintf "%02d%02d%02d", (split '-', shift)[2,0,1] }

obviously this breaks if you've the years, say, 1996 and 2003 
being represented by "96" and "3", resp.

here's another line:

@sorted = sort { for_sort($a) cmp for_sort($b) } @dates;

or perhaps faster:

@sorted = map { $_->[0] }
              sort { $a->[1] cmp $b->[1] }
                   map { [$_, for_sort($_)] }
                       @dates;

	Jay Glascoe


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

Date: Fri, 9 Apr 1999 11:20:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Stripping html tags within perl
Message-Id: <MPG.1177e4bc1f586abc98987c@nntp.hpl.hp.com>

In article <VEqP2.6114$x43.10691@nntpserver.swip.net> on Fri, 9 Apr 1999 
19:19:14 +0200, Fredrik Larsson <nils@hotmail.com> says...
> $NAME2 = $NAME;
> $NAME2 ~= s/<.*?>//g;    # erases all html-tags in the string
> 
> $NAME2 now contains the same as $NAME but without all html-tags

Not if they cross lines, as in the original post.

One might use

    s/<.*?>//gs

or

    s/<[^>]*>//g

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 09 Apr 1999 18:15:12 GMT
From: joel@testtutor.com
Subject: Transfering mldbm databases from windows to unix
Message-Id: <7elg3a$tsd$1@nnrp1.dejanews.com>

I am building a mldbm backed web site and would like to build the databases
on my local windows system and then upload them to the unix web server (which
also uses perl with the mldbm module added on) instead of having to build
them all on-line. I have tried uploading both in ASCI and bianry modes but
the uploaded database is not considered a mldbm database by the perl program
on the webserver. I recieve an error of 'file already exists' when it tries
to open/make the database.

Any ideas as to how I can surmount this problem?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 09 Apr 1999 18:01:32 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Re: Trouble with DBI and Oracle
Message-Id: <370e4059.318376260@news.qgraph.com>

Could you take a look at my next post (further down the list, where I
have posted the output from perl -d.  Let me know if anything jumps
out at you?

Darren


On Fri, 09 Apr 1999 08:28:44 +0100, Richard H <rhrh@hotmail.com>
wrote:

-->Darren Greer wrote:
-->> 
-->> My program still locks up in the same spot...so I am now suspecting
-->> that there are issues with the way DBI talks with our Oracle install.
-->> sqlplus works, the "make test" worked for DBI, and svrmgrl works as
-->> well.  But thanks for the help anyway....looks like Ill have to find
-->> other ways to talk to ORacle,
-->
-->Argh, dont!, you're nearly there!
-->
-->It took me about ten+ versions of the:
-->-->$dbh = DBI->connect($Database, $Username, $Password, $Driver)
-->combination to get it working on our unix system,
-->once you get over this hurdle youre sorted.
-->
-->Richard H



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

Date: Fri, 09 Apr 1999 18:06:49 GMT
From: drgreer@qtiworld.com (Darren Greer)
Subject: Re: Trouble with DBI and Oracle
Message-Id: <370e41a7.318709910@news.qgraph.com>

By the way...I am running Oracle 7.3.4, if that makes a difference?

Darren


On Fri, 09 Apr 1999 08:28:44 +0100, Richard H <rhrh@hotmail.com>
wrote:

-->Darren Greer wrote:
-->> 
-->> My program still locks up in the same spot...so I am now suspecting
-->> that there are issues with the way DBI talks with our Oracle install.
-->> sqlplus works, the "make test" worked for DBI, and svrmgrl works as
-->> well.  But thanks for the help anyway....looks like Ill have to find
-->> other ways to talk to ORacle,
-->
-->Argh, dont!, you're nearly there!
-->
-->It took me about ten+ versions of the:
-->-->$dbh = DBI->connect($Database, $Username, $Password, $Driver)
-->combination to get it working on our unix system,
-->once you get over this hurdle youre sorted.
-->
-->Richard H



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

Date: 9 Apr 1999 18:30:06 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Very large regular expressions
Message-Id: <7elgve$8v7$1@pegasus.csx.cam.ac.uk>

Rick Delaney  <rick.delaney@home.com> wrote:
>
>I wonder how reliable it is, though, to expect pos to not be reset when
>$regex changes.  This seems pretty handy but I don't recall seeing this
>documented anywhere.

pos() is a property of the string, not of the regex.   So it isn't
meaningful to talk about "when $regex changes".


Mike Guy


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

Date: Fri, 9 Apr 1999 11:04:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Win-32 / Unix CGI question
Message-Id: <MPG.1177e109d797898398987b@nntp.hpl.hp.com>

In article <370E3588.ED5A3B45@mail.cor.epa.gov> on Fri, 09 Apr 1999 
10:14:48 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Peter Jukel wrote:
> > can anyone tell me if it is possible to develop a CGI perl script on a
> > Windows 95 machine and run it on a UNIX web server?
> 
> Yes, you can.  But there are a few caveats.  You'll have to make sure
> that any paths hard-coded into your program are changed for the unix
> box.  You'll have to make sure you ftp the file in ASCII rather than
> binary mode, or it will have weird ^M characters at the end of every
> line.  Those kinds of things.  

Or you can use a text editor (such as 'vim') that has no problem reading 
and writing files in Unix mode.

> Other than that, it's a breeze.  Perl is a *very* portable language.

All true.  And don't rely on the set of system commands being the same, 
unless you have a POSIX-compliant set of commands installed on the 
Windows 95 machine.

`perldoc perlport` has a lot more to say about all of this.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 9 Apr 1999 18:39:28 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Yet another regexp question
Message-Id: <slrn7gsiav.p31.sholden@pgrad.cs.usyd.edu.au>

On Fri, 09 Apr 1999 12:31:23 -0500, Clinton Wolfe <clwolfe@indiana.edu> wrote:
>Thanks for the help, everyone.
>Using your suggestions for the regexp, something like
>$reg = "(?is)^[\n]*<img(?!([^>])*alt)";
>works just fine.

You fail to match <img src="images/asphalt.gif">
                                 ^^^

>
>Yes, it is perverse to do this using regexp's.  I do use a Parser to
>find links in the HTML (and then to check them).
>	I choose to stick with regexp's because I'd like to be able to let the
>robot run "forever", looping over itself.  With a delay of 2 minutes
>between GET's, it will take the robot about 4 days to traverse my site
>(of about 2500 html files), at which point it starts over.  Using a
>parser would require me to alter the script, stop the robot, and restart
>it every time I change my mind about what I'm looking for in the files. 
>True, this time I'm looking for properties of an HTML tag.  But I may
>also want to look for all occurences of the word Ultrix throughout the
>website, regardless of where it appears in the file.
>	By storing regexps as strings in a PostgreSQL database, I can alter
>what I'm looking for on the fly.  The downside is that I will have some
>truly horrific regexp's in the database.  

Why not go a step further and store perl code in the database that the 'robot'
evals. Something as simple as having the code return an anonymnous subroutine,
which takes the file as an argument and stores whatever it does in the
database would be just as easy as storing a regex in the database.

It would, however, be much more powerful, allowing you to do things that
are impossible to do with a regex, and also do lots of things at once.

>	HTML::Parser would be a much more elegant solution, but I don't see how
>I could get the same "on the fly" functionality.  Plus, this way I get
>to exercise my regexp writing ability.  A good thing.

By storing code in the database instead of just regular expressions. Then you
get to exercise all your perl writing ability. A good thing.

-- 
Sam

You are bordering on ridiculous if you think you need to support your
premises.  Such an argument is an infinite regression.
 	--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>


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

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

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