[13145] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 555 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 16 13:07:26 1999

Date: Mon, 16 Aug 1999 10:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 16 Aug 1999     Volume: 9 Number: 555

Today's topics:
        <== importing hash symbols from one package to another  <khowe@performance-net.com>
    Re: <== importing hash symbols from one package to anot (Anno Siegel)
    Re: <== importing hash symbols from one package to anot (Bart Lateur)
        Array, Subroutine question soccerreferee@hotmail.com
    Re: Array, Subroutine question (Bart Lateur)
    Re: automatic text formatting for 80 chars a line (J. Moreno)
    Re: automatic text formatting for 80 chars a line (Anno Siegel)
        CGI problem <jdupayrat@webraska.com>
        continual reading of file <djanisse@northrock.bm>
    Re: HARASSMENT -- Monthly Autoemail (Gil Harvey)
    Re: HARASSMENT -- Monthly Autoemail (Gil Harvey)
    Re: HARASSMENT -- Monthly Autoemail (Gil Harvey)
    Re: HARASSMENT -- Monthly Autoemail miker3@ix.netcom.com
    Re: HARASSMENT -- Monthly Autoemail (I R A Darth Aggie)
    Re: HARASSMENT -- Monthly Autoemail (John Stanley)
    Re: HARASSMENT -- Monthly Autoemail (John Stanley)
        How to get the Envoriment parameters recorded? <yu@microcal.com>
    Re: moving perl modules on Win98 <jpeterson@office.colt.net>
        Pb with connect() on win98 luc@sky.fr
    Re: perl on linux <aqumsieh@matrox.com>
    Re: perl on linux <aqumsieh@matrox.com>
    Re: Perl on Novell Novonyx. (print "Location: http://ww <msprinsk@pct.edu>
    Re: Perl Programmers' Web Design "Difficulties" (Warren Jones)
        Perl Services mknickelbein@my-deja.com
    Re: Perl Services <gellyfish@gellyfish.com>
    Re: s/// and interpolation <sariq@texas.net>
    Re: s/// and interpolation (Anno Siegel)
        unpacking - help <Rockett@Audiotel.com>
    Re: unpacking - help <Rockett@Audiotel.com>
        Uploading? Please help! <daniel.vesma@thewebtree.com>
    Re: Why use Perl when we've got Python?! <cmcurtin@interhack.net>
    Re: Why use Perl when we've got Python?! <cmcurtin@interhack.net>
    Re: Why use Perl when we've got Python?! (Alan Curry)
    Re: Why use Python when we've got Perl? (Aahz Maruch)
    Re: Writing lines to file twice or more (newbie questio zchon@my-deja.com
        Wrong thread - apologies <paseymo@ix.netcom.com>
    Re: Wrong thread - apologies (Marcel Grunauer)
    Re: Wrong thread - apologies (Bart Lateur)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Mon, 16 Aug 1999 12:54:03 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: <== importing hash symbols from one package to another ==>
Message-Id: <coWt3.45842$5r2.94562@tor-nn1.netcom.ca>

How do you go about importing a hash symbol into another package? Exporter
does this for subroutines, but doesn't seem to with hashes.

ex:
package one;
%hash = ('Color'=>'Red');

To access the hash from another package you have to do the following:

package main;
use one;
%hash = %one::hash;

Is there a way to automate this, so that $one::hash is automatically made
available in the namespace from which called the one package was called?
(main, in this case)

ex:
package main;
use one;
print $hash{'Color'};


Thanks.






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

Date: 16 Aug 1999 16:11:04 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: <== importing hash symbols from one package to another ==>
Message-Id: <7p9d6o$2ui$1@lublin.zrz.tu-berlin.de>

Kevin Howe <khowe@performance-net.com> wrote in comp.lang.perl.misc:
>How do you go about importing a hash symbol into another package? Exporter
>does this for subroutines, but doesn't seem to with hashes.
>
>ex:
>package one;
>%hash = ('Color'=>'Red');
>
>To access the hash from another package you have to do the following:
>
>package main;
>use one;
>%hash = %one::hash;
>
>Is there a way to automate this, so that $one::hash is automatically made
>available in the namespace from which called the one package was called?
>(main, in this case)
>
>ex:
>package main;
>use one;
>print $hash{'Color'};

perldoc Exporter

Anno


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

Date: Mon, 16 Aug 1999 16:22:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: <== importing hash symbols from one package to another ==>
Message-Id: <37b838e6.256389@news.skynet.be>

Kevin Howe wrote:

>How do you go about importing a hash symbol into another package? Exporter
>does this for subroutines, but doesn't seem to with hashes.
>
>ex:
>package one;
>%hash = ('Color'=>'Red');
>
>To access the hash from another package you have to do the following:
>
>package main;
>use one;
>%hash = %one::hash;

That is wrong. You make a COPY of the hash. It is not the same hash.

What you can do, is assign the reference to the original hash, to the
typeglob in main. That will only affect the hash entry in the typeglob
(as explained in the "Advanced Perl Programming" book).

	*hash = \%one::hash;

Now, it is the SAME hash.

>Is there a way to automate this, so that $one::hash is automatically made
>available in the namespace from which called the one package was called?
>(main, in this case)

Yes. Do something like this in you import sub in the module.

	sub import {
		my $package = (caller)[0]; # "main"
		no strict 'refs';
		*{$package.'::hash'} = \%hash;
	}

Do "use one;", and your %one::hash will be accessible through
%main::hash.

BTW if you're wondering: it's this mechanism that Exporter automates.

	Bart.


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

Date: Mon, 16 Aug 1999 15:01:35 GMT
From: soccerreferee@hotmail.com
Subject: Array, Subroutine question
Message-Id: <7p9948$6pi$1@nnrp1.deja.com>

I'm looking for a little guidance understanding some code.  I've
been picking up PERL at a decent pace but this one has me stumped.

The PERL Cookbook 4.11 gives:

   @friends = qw(Peter Paul Mary Jim Tim);
   ($this, $that) = shift2(@friends);

   sub shift2 (\@) {
   return splice(@{$_[0]}, 0, 2);
   }

I have tried to run the code, but $this and $that come back as null,
and @friends remains unchanged.

If I change the subroutine to read:

   sub shift2 (\@) {
   @tmp = splice(@_, 0, 2);
   return @tmp;
   }

This gives me $this and $that populated as I would expect, however it
does not affect the @friends array.  (I would expect the array to be 2
items smaller as a result of the splice.)

Anyone see what I'm missing?  Any help is appreciated.  Thanks!


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 16 Aug 1999 15:33:31 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Array, Subroutine question
Message-Id: <37b92ef1.2822925@news.skynet.be>

soccerreferee@hotmail.com wrote:

>   @friends = qw(Peter Paul Mary Jim Tim);
>   ($this, $that) = shift2(@friends);
>
>   sub shift2 (\@) {
>   return splice(@{$_[0]}, 0, 2);
>   }
>
>I have tried to run the code, but $this and $that come back as null,
>and @friends remains unchanged.

Euh... Shouldn't you switch the order? I.e. define the sub *first*, and
put the sub call below that.

Alternatively, put this before your first sub call:

	sub shift2 (\@);

	Bart.


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

Date: Mon, 16 Aug 1999 12:25:00 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: automatic text formatting for 80 chars a line
Message-Id: <1dwmpd6.baqbtixh1tbvN@roxboro0-0021.dyn.interpath.net>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

> Michael Scheferhoff  <m.scheferhoff@gmx.de> wrote in comp.lang.perl.misc:
> >Hello,
> >
> >does anybody know how to format a text so that I have 80 characters in a
> >line. Is there a command for this?
> 
> Suppost your long line is in $long (no linefeed), such as
> 
> my $long = '0123456789' x 23;
> 
> then collect the <= 80 character parts in @parts:
> 
> my @parts;
> for ( my $i = 0; $i < length $long; $i += 80 ) {
>   push @parts, substr( $long, $i, 80);
> }

One of the big reasons to keep a line length of under 80 is because you
are dealing with email or usenet messages -- in which case they may
contain quoted lines, in which cases that fails miserably.

Modify your input like so, and then see what you get.

my $long = ('>  > ' . ('0123456789' x 9) . "-\n") x 23;

You might want to take a look at this message: 
   <http://www.deja.com/=dnc/getdoc.xp?AN=420141009>

-- 
John Moreno


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

Date: 16 Aug 1999 16:32:04 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: automatic text formatting for 80 chars a line
Message-Id: <7p9ee4$312$1@lublin.zrz.tu-berlin.de>

J. Moreno <planb@newsreaders.com> wrote in comp.lang.perl.misc:
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
>> Michael Scheferhoff  <m.scheferhoff@gmx.de> wrote in comp.lang.perl.misc:
>> >Hello,
>> >
>> >does anybody know how to format a text so that I have 80 characters in a
>> >line. Is there a command for this?
>> 
>> Suppost your long line is in $long (no linefeed), such as
>> 
>> my $long = '0123456789' x 23;
>> 
>> then collect the <= 80 character parts in @parts:
>> 
>> my @parts;
>> for ( my $i = 0; $i < length $long; $i += 80 ) {
>>   push @parts, substr( $long, $i, 80);
>> }
>
>One of the big reasons to keep a line length of under 80 is because you
>are dealing with email or usenet messages -- in which case they may
>contain quoted lines, in which cases that fails miserably.

There are dozens of reasons to fold long lines, all with different
requirements.  Michael didn't specify any.

Anno


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

Date: Mon, 16 Aug 1999 17:10:58 +0100
From: "JduPayrat" <jdupayrat@webraska.com>
Subject: CGI problem
Message-Id: <7p99gm$kr4$1@minus.oleane.net>

Hello,

I have upgraded recently from perl (Active state) to 5.003_07 to 5.005_03
and  have CGI problems. When I try to execute a CGI perl complains:
Can't locate module myModule.pl at @INC (c:\perl\lib, c:\perl\lib\site, .)

I have to put:
use 'myDirectory';

to have perl find the module (the module is in the same dir than the CGI). I
thougth  perl couldn't  find the current directory but when I put these
lines in my script, it reports the rigth path:

open(LOG,'>myLog');
print LOG ,`cd` ;           #I am on winNt
close LOG;

any ideas ?

ps: My web server is IIS 3.0 and I use perl ISAPI.






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

Date: Mon, 16 Aug 1999 16:48:30 GMT
From: "Darren Janisse" <djanisse@northrock.bm>
Subject: continual reading of file
Message-Id: <yhXt3.2115$1B5.125845@monger.newsread.com>


Hello,

     I am fairly new to Perl and am attempting to write a perl script which
parses data from a sendmail log file.  Is it possible to have a file open in
perl for continual processing (i.e. perl would keep the maillog file open
and read any new data which is added to it)?

Any suggestions would be greatly appreciated!

Thank-you,
Darren




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

Date: Mon, 16 Aug 1999 15:49:40 GMT
From: gh@netquick.net (Gil Harvey)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37b832f6.74608552@news.interpath.net>

On 16 Aug 1999 13:35:24 GMT, fl_aggie@thepentagon.com (I R A Darth
Aggie) wrote:


>
>You post a question to misc.for-sale.widgets, 'cause you want to know
>what the going rate for a Model 31 widget is. You get several in-group
>postings, but you also get several in email. Some tell you what you want
>to know, some others inquire if you're in the market to buy, and some
>else asks if you're selling.
>
>Common link: your original posting about a Model 31 widget.
>
>Someone else sees your posting, and sends email that they've plenty of
>Model 41's, 51's and 61's at LOW LOW PRICES. *That* is unsolicited,
>because you *never* asked about those models.
>
>Does that make sense?
>
Nope - None...


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

Date: Mon, 16 Aug 1999 15:51:26 GMT
From: gh@netquick.net (Gil Harvey)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37b83334.74669838@news.interpath.net>

On 16 Aug 1999 13:37:34 GMT, fl_aggie@thepentagon.com (I R A Darth
Aggie) wrote:


>Yep. By posting to Usenet, by implication, you are *soliciting* comments
>upon your postings. Some of which may be posted to Usenet, and some of
>which may show up in your in-box...
>
>I'm sure you wheren't told that, but it is Usenet practice...

    BullShit!! It may say that, but in 8 years on usenet I've not seen
it. 


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

Date: Mon, 16 Aug 1999 15:52:28 GMT
From: gh@netquick.net (Gil Harvey)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37b83398.74770549@news.interpath.net>

On 16 Aug 1999 13:44:07 GMT, fl_aggie@thepentagon.com (I R A Darth
Aggie) wrote:


>I'll accept your apology for that smear any time once you figure out
>that the culture of Usenet says that email-followups to a posting is
>acceptable.

   Acceptable by convention maybe, common practice - No.


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

Date: Mon, 16 Aug 1999 16:01:05 GMT
From: miker3@ix.netcom.com
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7p9cjp$9jp$1@nnrp1.deja.com>

In article <slrn7rg5h7.nhi.fl_aggie@thepentagon.com>,
  fl_aggie@thepentagon.com (I R A Darth Aggie) wrote:
> On Mon, 16 Aug 1999 06:13:35 GMT, Michael Rubenstein
<miker3@ix.netcom.com>, in
> <37b7a952.701300396@nntp.ix.netcom.com> wrote:
>
> + I R A Darth Aggie has taught them that it is OK to send spam to
> + anyone who posts on usenet.  After all, posting on usenet is an
> + invitation for unsolicited email.
>
> I'll accept your apology for that smear any time once you figure out
> that the culture of Usenet says that email-followups to a posting is
> acceptable.

You will not get an apology to accept.

There is no way one can reasonably interpret Tom's message as an email
followup.  A followup contains the subject of the post it is following
up in the subject line.

Furthermore, using the guise of a followup for spam or harrassment is
not reasonable.  Do you honestly believe that spam is OK if it starts
off with "In response to your usenet posting, ..."

I'm sorry to have to be the one to tell you this, but you no longer have
a good name for me to smear.  If you ever had one, it was lost when you
started making excuses for Tom's harrassment.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 16 Aug 1999 16:39:41 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <slrn7rgfqd.oav.fl_aggie@thepentagon.com>

On Mon, 16 Aug 1999 15:49:40 GMT, Gil Harvey <gh@netquick.net>, in
<37b832f6.74608552@news.interpath.net> wrote:
+ On 16 Aug 1999 13:35:24 GMT, fl_aggie@thepentagon.com (I R A Darth
+ Aggie) wrote:
+ 
+ 
+ >
+ >You post a question to misc.for-sale.widgets, 'cause you want to know
+ >what the going rate for a Model 31 widget is. You get several in-group
+ >postings, but you also get several in email. Some tell you what you want
+ >to know, some others inquire if you're in the market to buy, and some
+ >else asks if you're selling.
+ >
+ >Common link: your original posting about a Model 31 widget.
+ >
+ >Someone else sees your posting, and sends email that they've plenty of
+ >Model 41's, 51's and 61's at LOW LOW PRICES. *That* is unsolicited,
+ >because you *never* asked about those models.
+ >
+ >Does that make sense?

+ Nope - None...

Then you shouldn't be on Usenet.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>


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

Date: 16 Aug 1999 17:00:16 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7p9g30$d2r$1@news.NERO.NET>

In article <slrn7rg50r.nhi.fl_aggie@thepentagon.com>,
I R A Darth Aggie <fl_aggie@thepentagon.com> wrote:
>Someone else sees your posting, and sends email that they've plenty of
>Model 41's, 51's and 61's at LOW LOW PRICES. *That* is unsolicited,
>because you *never* asked about those models.

It is in response to your posting in USENET. Either posting to USENET is
an invitation for email responses or it is not. "Email responses" is a
lot broader than the limited example you claimed is relevant. Asking
about Model 31's mean you have in interest in Widgets, and if you are
using a Model 31 today, you might be interested in trading up. And
knowing the prices for other models can guide you in setting a price on
the 31.



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

Date: 16 Aug 1999 17:02:44 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7p9g7k$d7p$1@news.NERO.NET>

In article <slrn7rg54u.nhi.fl_aggie@thepentagon.com>,
I R A Darth Aggie <fl_aggie@thepentagon.com> wrote:
>Yep. By posting to Usenet, by implication, you are *soliciting* comments
>upon your postings. 

No. YOU may be soliciting such comments, but not everybody feels the
same way you do. And guess what? They have as much right to feel the way
they do as you do. What they don't have, and are not trying to force
upon you by telling you to stop posting to USENET, is the right to force
their opinion on you.

>I'm sure you wheren't told that, but it is Usenet practice...

No, it is not. It is your practice, maybe. It is not universal.



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

Date: Thu, 12 Aug 1999 15:54:19 -0400
From: Larry Yu <yu@microcal.com>
Subject: How to get the Envoriment parameters recorded?
Message-Id: <37B3266A.8970EAA3@microcal.com>

Hello,
I want to record the download record. Is there a way put the user's
reffer page into that log? How to get that information.
I use Perl script to write a log file.

Thanks
Larry



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

Date: Mon, 16 Aug 1999 16:30:06 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: moving perl modules on Win98
Message-Id: <i0Xt3.119$u07.895@news.colt.net>

Gary Valley <gvalley@mitre.org> wrote:
> Hi,

> I have a win98 machine with ActivePerl build 518 on it.  I am trying to
> move the win32::process module from this machine to a winnt 4.0 wkstn
> machine.  The winnt machine only has the perl executable on it, (i.e.
> the perl executable was just copied to c:\perl\ and that directory put
> in the path).  The user does not want to install perl on their machine.
> (Don't ask me why...)  Once i've moved the appropriate files (win32.pm

Don't. Perl is not a toy language. The perl executable on it's own is a random
file, it is not in any sense 'perl'. Do not waste your time installing broken
half hearted perl installations. Would you attempt to run a java program
with 90% of the java classes removed? Would you consider developing C programs
on a machine without stdio.h?

Explain to your manager that your task is impossible unless a current version
of perl is installed on the NT machine.

If you manager is under the impression that the whole point of perl is to be
used as messy quick fix duct tape, ask your manager to boil his or her head.
(Politely, of course).

perl.exe is 'perl' in the same sense that System32.dll is NT.



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

Date: Mon, 16 Aug 1999 16:33:14 GMT
From: luc@sky.fr
Subject: Pb with connect() on win98
Message-Id: <7p9ega$b24$1@nnrp1.deja.com>

Hi,
I just get this module who connect to a server, this program is
perfectly working on linux with perl 5..
I can't make it work on win98
I have a connect: error with an unknown error...
Is there any difference between Unix and Win98 connect() in perl?
Could someone help me please?


use socket;
sub connect_to
{
    local(*FD, $arg1, $arg2) = @_;
    local($from, $to)   = ($arg1, $arg2); ## for one interpretation.
    local($host, $port) = ($arg1, $arg2); ## for the other
    local(@from);

    if (defined($to) && length($from)==16 && length($to)==16) {
	@from = ($from);
	## ok just as is
    } elsif (defined $host) {
       $to = &get_addr($host, $port);
	return qq/unknown address "$host"/ unless defined $to;
	@from = ($ENV{'NetworkHost'}, $ENV{'NETWORKHOST'}, &my_addr,
		 $ENV{'HOST'}, 'localhost');
    } else {
	return "unknown arguments to network'connect_to";
    }

    return "connect_to failed (socket: $!)"  unless &my_inet_socket
(*FD);
    local($bind_ok) = 0;
    foreach $from (@from) {
	next if !defined $from;
	$from = &ifconfig($1) if $from =~ m/^ifconfig:\s*(.*)/;
	$from = &get_addr($from, 0) if length($from) != 16;
	$bind_ok = 1, last if bind(FD, $from);
    }
    return "connect_to failed (bind: $!)" unless $bind_ok;
    return "connect_to failed (connect: $!)" unless connect(FD, $to);

The problem is probably here.......^



    local($old) = select(FD); $| = 1; select($old);
    undef;
}
sub get_addr
{
    local($host, $port) = @_;
    return $addr{$host,$port} if defined $addr{$host,$port};
    local($addr);

    if ($host =~ m/^\d+\.\d+\.\d+\.\d+$/) {
	$addr = pack("C4", split(/\./, $host));
    } elsif ($addr = (gethostbyname($host))[4], !defined $addr) {
        local(@lookup) = `nslookup $host 2>&1`;
	if (@lookup)
	{
#	    local($lookup) = join('', @lookup[2 .. $#lookup]);

	    local($lookup) = join('', @lookup);
	    # remove the nameserver from the output.
	    $lookup =~ s/Server.*\nAddress.*//g;

	    if ($lookup =~ m/Address:\s*(\d+\.\d+\.\d+\.\d+)/) {
	        $addr = pack("C4", split(/\./, $1));
	    }
	}
	if (!defined $addr) {
	    ## warn "$host: SOL, dude\n";
	    return undef;
	}
    }
    $addr{$host,$port} = pack('S n a4 x8', 2, $port, $addr);
}



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 16 Aug 1999 10:47:29 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: perl on linux
Message-Id: <x3yg11jrddr.fsf@tigre.matrox.com>


abigail@delanet.com (Abigail) writes:

> Ala Qumsieh (aqumsieh@matrox.com) wrote on MMCLXXI September MCMXCIII in
> <URL:news:x3ywvv29qy5.fsf@tigre.matrox.com>:
> ,, 
> ,, Haven't heard of the -p and -n flags? or even the -i flag?
> ,, 
> ,, 	% perl -pi -e 's/\cM//g' oldscript.pl > fixedscript.pl
> 
> Well, you may have heard of the -i flag, but do you know what it does?
> 
> I would use either:
> 
>    	% perl -pi -e 's/\cM//g' oldscript.pl
> 
> or
> 
>    	% perl -p  -e 's/\cM//g' oldscript.pl > fixedscript.pl

Yikes. I know what -i does of course. I just wasn't paying too much
attention when I typed my response :)

> And I would use a shell where the default prompt is `$', but that's
> beside the point.

I like %.

Ala



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

Date: Mon, 16 Aug 1999 10:49:43 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: perl on linux
Message-Id: <x3yemh3rda0.fsf@tigre.matrox.com>


GoodfriB@jntf.osd.mil (James R. Goodfriend) writes:

> % perl -pie 's/\r//g' script.pl

That should really be:

	% perl -pi -e 'y/\r//' script.pl

If there is something after the '-i', perl takes it as the extension
of the backup copy it creates. So it doesn't see the '-e'.

HTH,
Ala



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

Date: Mon, 16 Aug 1999 11:12:05 -0400
From: Matt Sprinsky <msprinsk@pct.edu>
Subject: Re: Perl on Novell Novonyx. (print "Location: http://www....") doesn't  work.
Message-Id: <37B82A45.D032CCE@pct.edu>

No dice.  shit.

kayec wrote:
> 
> Sounds like your Web Server is adding it's own HTTP headers....
> Normally i have to specify my own headers when printing to the browser:
> 
> sub startHTML {
>  print "HTTP/1.0 200 Ok\n";
>  print "Content-type: text/html\n\n";
>  print "<html>\n<html>\n <head>..........[snip]";
> 
> When i do what your trying to do i use this:
> 
> #######################################################
> # Forward to a new HTML document
> sub jumpTo {
>  my($page) = @_;
>  print "HTTP/1.0 302 Found\n";
>  print "Location: $page\n\n";
>  exit 0;
> }
> 
> Hope this helps....
> 
> Matt Sprinsky wrote in message <37B451FC.DE302015@pct.edu>...
> >Running netware 5 server, 256 ram, 500 PIII processor, Novonyx (netscape
> >& novell) the following code SHOULD work.
> >
> >[snipped: parse stuff]
> >
> >$url = $FORM{'url'};
> >
> >if ($url eq "")
> >{
> >print ("Location: $ENV{'HTTP_REFERER'}\n\n");
> >}
> >else
> >{
> >print ("Location: $url\n\n");
> >}
> >exit;
> >
> >it should take you to the $url if $url ne "".. right?  wrong.. instead,
> >it prints
> >
> >"Location: http://www.pct.edu/homepage/facustaf.htm" in the browsers
> >main viewing window.  seems like the server is sending out a content
> >type code before the script can print out the location command.
> >
> >any ideas?
> >
> >
> >
> >-- Matt
> >
> >"I'd rather be using unix"
> >
> >Matt Sprinsky
> >Pennsylvania College of Technology
> >Computer Services Department
> >msprinsk@pct.edu / 570-326-3761 x 7098

-- 

Matt Sprinsky
Pennsylvania College of Technology
Computer Services Department
msprinsk@pct.edu / 570-326-3761 x 7098


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

Date: 16 Aug 1999 09:23:03 -0700
From: wjones@tc.fluke.com (Warren Jones)
Subject: Re: Perl Programmers' Web Design "Difficulties"
Message-Id: <7p9dt7$d44$1@frogstar.tc.fluke.com>

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> And contrary to what was said, I think the new www.perl.com looks
> HORRIBLE.  The characters are far too small on my browser, and
> changing the settings doesn't seem to change the size.

Yes, the new www.perl.com is certainly sub-optimal.  However,
I configured Netscape to "Use my default fonts, overriding document
specified font", and it looks much better.

> Bad design.  Very bad design.  And completely ADA-non-compliant.
> (You can get into legal trouble for that, you know.)
> 
> These are all things that irk me about the "media wranglers"
> that are trying to take over the net.

Amen!

--------------------------------------------------------------------
Warren Jones              | To keep every cog and wheel is the first
Fluke Corporation         | precaution of intelligent tinkering.
Everett, Washington, USA  |                          -- Aldo Leopold


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

Date: Mon, 16 Aug 1999 15:15:25 GMT
From: mknickelbein@my-deja.com
Subject: Perl Services
Message-Id: <7p99u3$7bj$1@nnrp1.deja.com>

Please see our new site at http://perlservices.com/
Thanks,
Mark


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 16 Aug 1999 16:55:13 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Services
Message-Id: <37b83461_2@newsread3.dircon.co.uk>

mknickelbein@my-deja.com wrote:
> Please see our new site at http://perlservices.com/

And I was so filled with hope when I saw 'use CGI;' in the "Upload Helper"
then it all went a bit pear shaped - but I did think that:

   if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
   $filenotgood = "yes";
   }

was rather enterprising anyway.

/J\
-- 
"Of course I smoke pot, but I'm not in favour of legalizing it. The
working classes do little enough as it is..." - Jonathan Aitken


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

Date: Mon, 16 Aug 1999 10:23:38 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: s/// and interpolation
Message-Id: <37B82CFA.C0FB89B0@texas.net>

Christopher Conway wrote:
> 
> In article <x3yyaff1yyb.fsf@tigre.matrox.com>,
>   Ala Qumsieh <aqumsieh@matrox.com> wrote:
> > When was the last time you checked out perlre? I advise you to go
> > ahead and read it once more.
> 
> I have read perlre recently. Many times. The only portion
> that seems relevant ("How can I quote a variable to use in
> a regexp?") is quoted below. 

<snipped nonsense rant and FAQ quote>

> 
> Chris

1)  Ala's reply was not to your post.  
2)  Stop being so defensive.
3)  The FAQ you quoted is (surprise!) from the FAQ...not perlre.  This
would indicate that you are posting questions about regexen *without*
reading perlre.

- Tom


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

Date: 16 Aug 1999 15:41:53 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: s/// and interpolation
Message-Id: <7p9bg1$2sd$1@lublin.zrz.tu-berlin.de>

Christopher Conway  <chris_conway@my-deja.com> wrote in comp.lang.perl.misc:
>In article <x3yyaff1yyb.fsf@tigre.matrox.com>,
>  Ala Qumsieh <aqumsieh@matrox.com> wrote:
>> When was the last time you checked out perlre? I advise you to go
>> ahead and read it once more.
>
>I have read perlre recently. Many times. The only portion

If you did, you didn't really pay attention.  See below.

>that seems relevant ("How can I quote a variable to use in
>a regexp?") is quoted below. If you had been following the
>discussion up to now, you would know that this is not
>relevant -- the question here is how to make perl
>interpolate backreference variables within a variable
>on the right-hand side of the s/// operator, or how do
>you get perl to interpolate within an interpolated
>variable?

From perldoc perlre:

       When the bracketing construct ( ... ) is used, \<digit>
       matches the digit'th substring.  Outside of the pattern,
       always use "$" instead of "\" in front of the digit.

The right hand side of s/// is outside of the pattern.  What else
do you need to know?

Anno


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

Date: Mon, 16 Aug 1999 10:15:34 -0500
From: Rockett Crawford <Rockett@Audiotel.com>
Subject: unpacking - help
Message-Id: <0B2FB28D16E1B40D.2E6BE596F092070B.8BFCE8E912F5467A@lp.airnews.net>


I am trying to convert a Perl script to run on an Active server
page.

I had to use the following to get the query string:

$args = $Request->ServerVariables("QUERY_STRING");

In the test that I am doing this returns a 26 byte string in
length whereas a hard coding:

$args = "amt=100000&int=7.5&apr=7.8&trm=30";

returns a 33 byte length which is correct

Both hard coding and query string print out exactly the
same but the query string version will not parse correctly.

Is the query string packed? If so how do I unpack it?

thanks,

Rockett Crawford
AudioTel Corp



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

Date: Mon, 16 Aug 1999 11:11:02 -0500
From: Rockett Crawford <Rockett@Audiotel.com>
Subject: Re: unpacking - help
Message-Id: <6D4EA10BEFC3AA9A.8AE68C67253AF2E0.2A4D7813D6DF71CC@lp.airnews.net>


It looks like this isn't a matter of packing after all.

When I used substr I pulled this string out:
"Win32::OLE=HASH(0x1aa1718)"

Does this mean that the real string is elsewhere?
If so, how can I get it into a string variable?

thanks,
Rockett Crawford


Rockett Crawford wrote:

> I am trying to convert a Perl script to run on an Active server
> page.
>
> I had to use the following to get the query string:
>
> $args = $Request->ServerVariables("QUERY_STRING");
>
> In the test that I am doing this returns a 26 byte string in
> length whereas a hard coding:
>
> $args = "amt=100000&int=7.5&apr=7.8&trm=30";
>
> returns a 33 byte length which is correct
>
> Both hard coding and query string print out exactly the
> same but the query string version will not parse correctly.
>
> Is the query string packed? If so how do I unpack it?
>
> thanks,
>
> Rockett Crawford
> AudioTel Corp



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

Date: Mon, 16 Aug 1999 16:59:26 +0100
From: "Daniel Vesma" <daniel.vesma@thewebtree.com>
Subject: Uploading? Please help!
Message-Id: <7p9ccs$a9o$1@gxsn.com>

Hi,

I need some help. I want to add an upload feature to my new database script.
It just needs to upload one file at a time (each will be no more than a MB).
The files will be in winZip format.

If anyone could point me toward a tutorial or a nice easy script (well
documented) that I could use to see how it's done.

It only needs to run on UNIX.

Thanks lots

Daniel Vesma
http://www.thewebtree.com
http://www.thewebtree.com/daniel-vesma





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

Date: 16 Aug 1999 11:33:52 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <xlxiu6fivtr.fsf@gold.cis.ohio-state.edu>

>>>>> On Sat, 14 Aug 1999 03:36:48 GMT,
    jstevens@bamboo.verinet.com (John Stevens) said:

John> You, Tom, are not the average.

OK.  I'd like to see Perl code that I did not write that is harder for 
me to read than Python code that I did not write. 

Perhaps I'm not average, either.  (Perhaps no experienced Perl
programmers are average.  Let's ponder that a moment. :-)

John> The sheer number, the number of levels (beginner, intermediate,
John> novice), the time necesary to climb the Perl learning curve, the
John> speed at which particular bits of Perl syntax get
John> forgotten. . . are all quantifiable.

I strongly believe that the importance of learning curves is grossly
overstated.  I wouldn't use Unix if learning curve were the criteria
for goodness.  I wouldn't use English if learning curve were the
criteria for utility.

If learning curve were the One True Criterion, I'd use a Mac and speak 
Esperanto.  I might well be the most boring person alive.

John> I used Perl constantly, and almost exclusively, for two years.
John> Now, I have trouble remembering, and reading Perl.  The same
John> complaint has been voiced to me by my students.

Find someone who has been doing C++ for two years.  They'll probably
have the same problem.  Any large language will have cases where you
need to think about how to use it in a particular case, especially if
you're used to working in one area of the language and then move to a
problem in another...

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: 16 Aug 1999 11:43:04 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <xlxg11jivef.fsf@gold.cis.ohio-state.edu>

>>>>> On Sat, 14 Aug 1999 16:58:33 GMT,
    jstevens@bamboo.verinet.com (John Stevens) said:

TomC> I think your newsreader is buggy.  Better fix it.

John> Nope.  The news reader is fine.  You need to check your news
John> server.

No, the reader is not.  It miswrapped some of your lines.  Check
message <news:37B46412.B78F60F4@basho.fc.hp.com>, this paragraph in
particular:

> Excuse, but this is a bad comparison.  Columnarization requirements
> existed
> in Fortran to fit the limits of the compiler technology available at the
> time.
> Indentation requirements exist in Python to fit the needs of the
> programmer.

News servers are NOT responsible for the formatting of message
bodies.  That's the client's job.

-- 
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/


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

Date: Mon, 16 Aug 1999 17:04:46 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <OwXt3.4340$x04.225884@typ11.nn.bcandid.com>

In article <37B49CBA.772D9783@basho.fc.hp.com>,
John W. Stevens <jstevens@basho.fc.hp.com> wrote:
>Tom Christiansen wrote:
>> If I feed 42 into Perl's standard input for the following code:
>> 
>>     $n = readline(*STDIN);
>>     print $n + 19;
>> 
>> Then I simply get "61" out my standard output.  It's quite obvious what
>> I meant to do, so Perl applies its dweomer to DWIM.
>
>On the other hand, of course:
>
>$a = "t";
>print $a + 3, "\n"
>
>prints:
>
>3

You've run into a known bug. See perl(1):

BUGS
       The -w switch is not mandatory.

The workaround for that bug is pretty simple: always use -w.

If you'd used -w, you would have seen a warning to the effect that "t" is not
a number, so you shouldn't be trying to add it to anything.

On the more general question of overloading +, it stinks. "+" is a math
symbol. It shouldn't be used for operations that don't somehow correspond to
the mathematical concept of addition.

If a sane language were ever to allow + on strings, it should work like this:

"one" + "one" == "two"
"One" + "One" == "Two"
"1" + "1" == "2" # perl already does this one correctly!
"apples" + "oranges" generates a fatal exception, of course.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: 16 Aug 1999 15:59:39 GMT
From: aahz@netcom.com (Aahz Maruch)
Subject: Re: Why use Python when we've got Perl?
Message-Id: <7p9chb$col@dfw-ixnews21.ix.netcom.com>

In article <37B81135.1B598171@strs.co.uk>,
Ian Clarke  <I.Clarke@strs.co.uk> wrote:
>
>Ok, so your point is that I was inciting flames, but that is not in
>itself a bad thing.  I can live with that.

Yes, it is a bad thing.  It may sometimes be a necessary thing, but
inciting flames is always bad.
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)


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

Date: Mon, 16 Aug 1999 15:21:26 GMT
From: zchon@my-deja.com
Subject: Re: Writing lines to file twice or more (newbie question)
Message-Id: <7p9a99$7n5$1@nnrp1.deja.com>

In article <7p27oh$k49$1@murdoch.acc.Virginia.EDU>,
  mdz4c@node9.unix.Virginia.EDU (Matthew David Zimmerman) wrote:
> In article <7p1nga$8u2$1@nnrp1.deja.com>,  <zchon@my-deja.com> wrote:
> >  Any help would be greatly apperciated (This is
> >my first really perl program, no way like
> >learning how to swim then by being thrown in the
> >deep end)
>
> Right! Of course, by diving into this group, you may be swimming in
> shark-infested waters... :)
>
> We really need to see your code (a reasonable, relevant snippet of it,
> say about 20 lines?) before we can help you fix it.
>
> Matt

But its better to swim with the sharks then the guppies (unless you
don't have thick skin )

Anyways... here is where the file is read in and written out everything
in between is just formatting the text

WARNING! NEWBIE CODE BELOW!!!

#!C:\perl\bin\perl.exe

######Open the data file for reading
     open (INFILE, 'data4.txt') or die "can't open for read: $!";

######Open the second data file for editing
	 open (OUTFILE, '+>data3.txt') or die "can't open for read: $!";

     printf("The datafile is open\n");
     while ($text = <INFILE>) {
	   chomp($text);
       @mylist = split /.{0,0}/, $text;
     if($mylist[1]!=' '){



FORMATTING CODE
FORMATTING CODE
(simply moving characters from @mylist to different positions in
@newlist)


     }
	}
#########Form the text array into a string and write it to the OUTFILE
	 $textout = join("",@newlist);
	 printf(OUTFILE "%s", $textout);
	 printf(OUTFILE "\n");
     $textout = " ";
	 @checklist=@newlist;
  }
  close(OUTFILE);
  close(INFILE);


      Sean

PS Sorry about the double post, I'll remove the other one...


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 16 Aug 1999 11:05:26 +0100
From: Pauline Seymour <paseymo@ix.netcom.com>
Subject: Wrong thread - apologies
Message-Id: <ant1610260b0#mt$@paseymo.ix.netcom.com>

> In article <slrn7regvj.81j.abigail@alexandra.delanet.com>, Abigail
> <URL:mailto:abigail@delanet.com> wrote:> Pauline Seymour (paseymo@ix.netcom.com) 
> wrote on MMCLXXV September
> MCMXCIII in <URL:news:ant150938b49#mt$@paseymo.ix.netcom.com>:
>
> -- I have bought myself a win98 laptop,
> 
> Why are you posting this in the thread named "Help with CGI and Perl"?
> 
Actually there was no indication in either the news editor or the 
address box on my machine that this would get into the wrong thread 
and in fact my computer put it in a thread of its own when I scanned 
the newsgroup this morning so this effect is very much software 
dependent.

However a check of the outgoings file using a text editor did indeed
show a couple of extra lines (normally not observable)  indicating that
I had simply hit the reply button on the particular article I was reading
and edited it rather than bring up a new window. 

I will cease this lazy practice forthwith and thanks to Abigail for 
pointing it out the problem, even if in a somewhat less than polite 
manner.

PS: when I asked my computer to reply to Abigail's posting the only
newsgroup it wanted to post to was "alt.idiots".   I think my software
had taken offence!!! 

-------
Pauline



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

Date: Mon, 16 Aug 1999 15:35:26 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Wrong thread - apologies
Message-Id: <37be3dc6.11520585@news>

On Mon, 16 Aug 1999 11:05:26 +0100, Pauline Seymour
<paseymo@ix.netcom.com> wrote:

>PS: when I asked my computer to reply to Abigail's posting the only
>newsgroup it wanted to post to was "alt.idiots".   I think my software
>had taken offence!!! 

No, Abigail has taken offence by setting the follow-up accordingly.
Another field that's easy to miss on some newsreaders.


Marcel
-- 
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'


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

Date: Mon, 16 Aug 1999 15:29:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Wrong thread - apologies
Message-Id: <37b82db3.2504799@news.skynet.be>

Pauline Seymour wrote:

>PS: when I asked my computer to reply to Abigail's posting the only
>newsgroup it wanted to post to was "alt.idiots".   I think my software
>had taken offence!!! 

No. I'm pretty sure Abigail added a Followup-To header. Yup:

>Followup-To: alt.idiots

	Bart.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 555
*************************************


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