[18559] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 727 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 20 09:05:37 2001

Date: Fri, 20 Apr 2001 06:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <987771913-v10-i727@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 20 Apr 2001     Volume: 10 Number: 727

Today's topics:
    Re: Can't open file, dies <webmaster@webdragon.unmunge.net>
    Re: Document Format [not explicitly perl related] <webmaster@webdragon.unmunge.net>
        gmtime and daylight savings time? <andrew@nextra.cz>
    Re: help for a basic hash value access question <webmaster@webdragon.unmunge.net>
        hitcounter <kris.v@net2view.be>
        How to use Perl subroutines/submodules from other serve (Tony Van der Voort)
    Re: How to use Perl subroutines/submodules from other s <ubl@schaffhausen.de>
    Re: https module ros@ros.com
    Re: Java&Perl or Java by itself? (Markus Laire)
        MHonArc helps needed <scv@vlink.com>
    Re: MHonArc helps needed (EED)
    Re: Multi dimensional array dimensions <jonni@ifm.liu.se>
    Re: Multi dimensional array dimensions (Randal L. Schwartz)
        Perl as scripting language for C app <mcra98@esc.cam.ac.uk>
    Re: Premature end of script headers? <urael@craavaxvynzcv.arg>
    Re: regexp matching with optional part <jonni@ifm.liu.se>
    Re: regexp matching with optional part <wyzelli@yahoo.com>
    Re: regexp matching with optional part <wyzelli@yahoo.com>
    Re: regexp matching with optional part <wyzelli@yahoo.com>
    Re: regexp matching with optional part <bart.lateur@skynet.be>
    Re: REgexp with variable (Bernard El-Hagin)
    Re: REgexp with variable <peb@bms.umist.ac.uk>
        Service <pellegrini@erste.at>
    Re: Service <wyzelli@yahoo.com>
    Re: So what do YOU use Perl for? <hermann@holzerath.de>
        Spoofing a http referer <ballmann@co-de.de>
    Re: Spoofing a http referer (Rafael Garcia-Suarez)
    Re: unicode-impressions <flavell@mail.cern.ch>
    Re: unicode-impressions <pilsl_@goldfisch.at>
    Re: unicode-impressions <flavell@mail.cern.ch>
    Re: use strict & require... <bart.lateur@skynet.be>
    Re: use strict & require... (Damian James)
        What is a correct prototype for a subroutine w/o argume (EED)
        while loop <pef@trasra.noXX>
    Re: while loop <wyzelli@yahoo.com>
    Re: while loop <graham.wood@iona.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 20 Apr 2001 10:21:42 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Can't open file, dies
Message-Id: <9bp2jm$clu$2@216.155.32.48>

In article <9bo6fs$g3b$2@bob.news.rcn.net>,
 ebohlman@omsdev.com (Eric Bohlman) wrote:

 | Jim Kroger <minorseventhSPAMBLOCK@earthlink.net> wrote:
 | > Thanks everyone for the help....
 | 
 | > Can't help but wonder what a statistician uses Perl for....
 | 
 | An awful lot of statistical work involves re-organizing and grouping data.  
 | Perl is great at that sort of thing.

For a good example of that sort of thing, look for Greg Bacon's regular 
posts to comp.lang.perl.misc giving stats for this group. :-)

IIRC, he has made the source available as well.

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: 20 Apr 2001 10:19:52 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Document Format [not explicitly perl related]
Message-Id: <9bp2g8$clu$1@216.155.32.48>

In article <tduqj95anrq913@corp.supernews.com>,
 Chris Stith <mischief@velma.motion.net> wrote:

 | Christopher E. Stith
 | For the pleasure of others, please adhere to the following
 | rules when visiting your park:
 |     No swimming.  No fishing.  No flying kites.  No frisbees.
 |     No audio equipment. Stay off grass.  No pets. No running.

heh. You might add "Don't bogart the potato salad." :-) 

*flee*

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Fri, 20 Apr 2001 12:31:00 +0200
From: Andrew Zhilenko <andrew@nextra.cz>
Subject: gmtime and daylight savings time?
Message-Id: <3AE00FE4.93DE4BD9@nextra.cz>

Hello!

Something is weird on my server (Solaris8). I want to convert
local time into GMT time. Somehow it seems that perl functions
ignore daylight savings time settings (even if it seems to be
ok in OS):
(I'm in Praha, it's Central European Time, which is now GMT+2):

andrew@heimdall:/var/rrdtool$echo $TZ
CET
andrew@heimdall:/var/rrdtool$zdump GMT CET
GMT  Fri Apr 20 10:22:21 2001 GMT
CET  Fri Apr 20 12:22:21 2001 CEST

andrew@heimdall:/var/rrdtool$perl test.pl 
Fri Apr 20 11:22:24 2001 GMT
           ^^ I was expecting 10 to be there...
Fri Apr 20 12:22:24 2001 CEST

andrew@heimdall:/var/rrdtool$cat test.pl 
#!/usr/bin/perl -w
use locale;
use POSIX qw(strftime);
print strftime('%c GMT', gmtime)."\n";
print strftime('%c %Z', localtime)."\n";

Any suggestions?

WBR, Andrew 
-- 
Andrew Zhilenko, AZ283-RIPE
System Manager
Nextra Czech Republic, s.r.o. http://www.nextra.cz
V Celnici 10  / CZ - 117 21 Praha 1 / Czech Republic
Tel: +420/2/96 355 169
E-Mail: andrew.zhilenko@nextra.com
see Disclaimer http://www.nextra.cz/disclaimer/


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

Date: 20 Apr 2001 10:13:28 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: help for a basic hash value access question
Message-Id: <9bp248$clu$0@216.155.32.48>

In article <m34rvkvvra.fsf@mumonkan.sunstarsys.com>,
 Joe Schaefer <joe+usenet@sunstarsys.com> wrote:

 | > You get a list of references.  The "\" operator distributes over
 | > a list.  I have yet to find that useful...
 | 
 | Actually it's pretty useful for binding columns within DBI:
 | 
 |     use base "DBI::st";
 | 
 |     sub bind_hash {
 |         my ($self, $hash_ref) = @_;
 |         $self->bind_columns( \ @{$hash_ref}{ @{$self->FETCH("NAME")} }  );
 |     }
 | 
 |   ...
 | 
 |     $sth->execute;
 | 
 |     my %results;
 |     $sth->bind_hash(\%results);
 | 
 |     print %results while $sth->fetch; # whatever
 | 
 |   ...

Hey, that's slick.. Mind if I swipe that for my "sketchbooks" ? 

I've got a massive fetch from a rather modest sql database (some 3700 
entries) whose ultimate "picture" in a HOHOL looks something like 

$master_map_list{$gametype}{$filename} = 
    [$filename, $title, $size, $review_ref_ID, $rating]; 

( 5 gametypes, and each file has the other items associated with it, so 
this 'picture' built itself rather nicely once the folks here helped me 
grok references and anonymous hashes and HOHOL's :)

*pondering how I'd maneuver the existing script into a nice little slick 
object method like that...*

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Fri, 20 Apr 2001 15:05:02 +0200
From: "Kris van der Mast" <kris.v@net2view.be>
Subject: hitcounter
Message-Id: <3ae033e5$0$3125$456d72a3@news.skynet.be>

Hi,

I'm looking for some scripts that would really help me out.

When a <a href> ... </a>  is clicked it should detect this action and put
this in a text-file.

another script must be able to read this text file.

Please help me out.

Thanks in advance, Kris.




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

Date: Fri, 20 Apr 2001 10:09:19 GMT
From: tvdv@advalvas.be (Tony Van der Voort)
Subject: How to use Perl subroutines/submodules from other server
Message-Id: <3ae00aaf.5340546@news.skynet.be>

Hello,

I'm trying to make a perl script (CGI) with subroutines in a separate
file, using the instruction 'require'. This works very good. BUT... I
want to install this separate file on another server. The reason I
will do this, is to protect the code of the subroutines. The 'require'
instruction does not work here. Can some-one explain me, how I can
solve this problem ?

Many thanks in advance and kind regards,
Tony.


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

Date: Fri, 20 Apr 2001 13:09:21 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: How to use Perl subroutines/submodules from other server
Message-Id: <3AE026F1.50A9FF7@schaffhausen.de>

Tony Van der Voort schrieb:
> 
> Hello,
> 
> I'm trying to make a perl script (CGI) with subroutines in a separate
> file, using the instruction 'require'. This works very good. BUT... I
> want to install this separate file on another server. The reason I
> will do this, is to protect the code of the subroutines. The 'require'
> instruction does not work here. Can some-one explain me, how I can
> solve this problem ?

If you want to protect the code you might want to use a secure connection.
You _could_ do all of that with LWP and eval or do, but I suggest you'd
rather write safe code so you dont need to protect it.

->malte


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

Date: Fri, 20 Apr 2001 10:07:48 GMT
From: ros@ros.com
Subject: Re: https module
Message-Id: <3ae00999.501441@news.mundo-r.com>

Should't work, or at least would be very agent-dependant


	You should use lwpcook. It has a module that works as  a
breeze. 

	use LWP::UserAgent

The documentation is in
http://www.perldoc.com/perl5.6/lib/lwpcook.html

Best wishes
David Pardo

On Fri, 20 Apr 2001 08:00:37 +0100, "Ciaran McCreesh"
<keesh@users.pleaseremovethisbit.sourceforge.net> wrote:

>In article <bsND6.600618$Pm2.9966350@news20.bellglobal.com>, "G. White"
><whiteg2000@hotmail.com> wrote:
>> http://username:password@mysite.com
>> 
>> I've never tried this with https but I'm guessing it should work.
>
>Probably not. It might, but it shouldn't. If the site is using https for
>security, they should _require_ encrypted transactions. There's a big
>diffence between supplying a username and password through HTTP (rfc2616)
>using the authorisation stuff in rfc2617 and a full-blown https (rfc2260)
>transaction.
>
>Essentially, https is http with some more headers thrown in. The problem
>is, the http message usually contains another http message, which can be
>encrypted in a number of ways, which contains the stuff you'd actually
>want...
>
>Regards,
>Ciaran
>
>-- 
>Ciaran McCreesh
>mail:    keesh@users.sourceforge.net
>web:     http://www.opensourcepan.com/



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

Date: Fri, 20 Apr 2001 12:19:14 GMT
From: markus.laire@nic.fi (Markus Laire)
Subject: Re: Java&Perl or Java by itself?
Message-Id: <Xns90899BD4A3290markuslairenicfi@192.89.123.233>

akiyomiya@hotmail.com wrote in <9bnmrs$4fm$1@news.netmar.com>:

>I took Java2 class (10 weeks) that covered the basic and I am ready to
>take a next Java class.
>
>At the same time, I feel like I need to improve my Perl skill.
>
>However, I am wondering if there are many advantages learning/improving
>Perl as well as learning Java.   Are there many things that I cannot do
>in Java, but can do in Perl?  If so, please let me know in more details.
>  
>
>Since the technology is changing so fast, I cannot afford spending a lot
>of time learning every language,  so I like to know the pros and cons of
>learning Perl in addition to Java.
>

I'd suggest learning both languages.
I'm currently programming small (few thousand lines of code) game-server 
which uses Java for UI and perl for most of the data processing.

I use a lot of text-files for setups and so perl is a lot better than java 
as perl is designed to work with textfiles.


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

Date: Fri, 20 Apr 2001 11:01:05 GMT
From: "news" <scv@vlink.com>
Subject: MHonArc helps needed
Message-Id: <RFUD6.33729$xN4.2436963@news1.sttls1.wa.home.com>

Does any body use MHonArc?

I bought an internet account, where I can build web sites. I want to store
mails and news in an archive.
Please show me how to install MHonArc onto my account so I can send email to
my archive using MHonArc.

Thank you very much.





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

Date: Fri, 20 Apr 2001 14:02:56 +0200
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: MHonArc helps needed
Message-Id: <3AE02570.F4418630@eed.ericsson.se>

news wrote:
> 
> Does any body use MHonArc?
> 
> I bought an internet account, where I can build web sites. I want to store
> mails and news in an archive.
> Please show me how to install MHonArc onto my account so I can send email to
> my archive using MHonArc.

Have you checked the installation instructions on the MHonArc web site?


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

Date: Fri, 20 Apr 2001 12:48:25 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Multi dimensional array dimensions
Message-Id: <9bp45i$h82$1@newsy.ifm.liu.se>

> With
> $length_vertical=@muxxer;
>
> I get the "vertical length" of the array (in this case 3), but to get
> the orizontal length  (in this case 6)? How can I get this ?
>

$length_horizontal=@{@muxxer[0]};

Will give you the length of the first array in the array of references to
arrays...

However if the arrays have different length there isn't any well defined
horizontal width. Maximum width cound be found by:

my $max_horizontal;
for (@muxxer) {
    $max_horizontal=@{$_} if ($max_horizontal<@{$_});
}
/jN
--
_______________________________
Jonas Nilsson




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

Date: 20 Apr 2001 05:32:28 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Multi dimensional array dimensions
Message-Id: <m1itjz4uqr.fsf@halfdome.holdit.com>

>>>>> "Jonas" == Jonas Nilsson <jonni@ifm.liu.se> writes:

Jonas> $length_horizontal=@{@muxxer[0]};

That's @{$muxxer[0]}.

It's VERY RARE to ever need an array slice (@...[]) with a single element
in the slice.  It's so rare that it's a warnable (-w) offense.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Fri, 20 Apr 2001 14:06:55 +0100
From: "Martin Craig" <mcra98@esc.cam.ac.uk>
Subject: Perl as scripting language for C app
Message-Id: <9bpc57$alm$1@pegasus.csx.cam.ac.uk>

Hi,

Apologies if there's already good documentation on this elsewhere - I 
couldn't find it.

I have a C application & want to use Perl as a scripting language. I was 
going to use Guile, but I don't think the people I'm aiming it at are
likely to know this language, wheras Perl looks ideal. I've read about how
to embed a perl interpreter in C, however I need to make some of my C
functions available to the embedded perl. Is there something like
gh_new_procedure() to do this?

I have read about calling C libraries from perl, but this is a running
program, not a library, so I'm not clear about if I can use this.

Thanks to anyone who can help,

Martin.


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

Date: Fri, 20 Apr 2001 22:33:34 +0930
From: Henry <urael@craavaxvynzcv.arg>
Subject: Re: Premature end of script headers?
Message-Id: <urael-6AE8C6.22333420042001@news.metropolis.net.au>

In article <987597390.17318@itz.pp.sci.fi>, Ilmari Karonen 
<usenet11432@itz.pp.sci.fi> wrote:

>>> I would also generally suggest putting "use CGI::Carp" before any of 
>>> the other "use" statements, since any errors before it won't get
>>> sent to the browser.
>>
>> Out of curiosity, would the following be a 'acceptable' approach?
>>
>> BEGIN {
>>  use CGI::Carp qw(carpout fatalsToBrowser);
>>  carpout(STDOUT);
>> }
>> use CGI qw(:standard);
> 
> Yes, except that you don't really want to carpout(STDOUT).

Actually, I do.  I want _everything_ to go to the browser.


> That will send any warnings straight to the browser, which will
> probably treat them as HTML syntax errors.

Ah, if you use regular Carp that's what may happen, but CGI::Carp puts a 
minimalistic wrapper around the error to make it digestable to browsers.  
In addition, all <angle brackets> are replaced with &gt; &lt; codes - so 
I don't think any (modern) browser is likely to barf.


>Use warningsToBrowser() instead.

Fully intend to... as soon as I upgrade to 5.6.1.

Henry.


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

Date: Fri, 20 Apr 2001 12:52:17 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: regexp matching with optional part
Message-Id: <9bp4cq$h87$1@newsy.ifm.liu.se>

> x-abc-x  -> return abc
> x-foo    -> return foo
> bar-x    -> return bar
> baz      -> return baz
> x--x     -> fail
>
> Can this be done easily in a single regexp? The closest I came was
>
> /^(x-)?(.+?)(-x)$/

if  /^(x-)?(.+?)(-x)?$/ {$result=$2} else {&fail};
/jN


--
_______________________________
Jonas Nilsson




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

Date: Fri, 20 Apr 2001 20:50:52 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regexp matching with optional part
Message-Id: <yUUD6.5$uu4.1978@vic.nntp.telstra.net>

"Ronald Fischer" <ronald.fischer.gp@icn.siemens.de> wrote in message
news:7qfwv8gq6pk.fsf@icn.siemens.de...
>
> I'm trying to write a regexp matching which should cut off an optional
leading
> "x-" or trailing "-x". the following cases:
>
> In any case, the extracted part (after cutting off the leader or trailer)
> should consist of at least one character; otherwise, the regexp should
> fail. Example:
>
> x-abc-x  -> return abc
> x-foo    -> return foo
> bar-x    -> return bar
> baz      -> return baz
> x--x     -> fail
>
> Can this be done easily in a single regexp? The closest I came was
>
> /^(x-)?(.+?)(-x)$/
>
> but this does not work (understandably) for the last case, "x--x". Of
course I
> could check the borderline case separately, but I wonder if there is a
simple
> way to do it.

Change the + to a * and you need the last -x to be optional as well.

With '1 or more anything' you match the - in the last case which prevents
the -x from matching.  With a 0 or more anything, you can match the last -x
even if nothing matches the central portion.  You definitely need it
non-greedy, but you already did that.

print "$2\n if /^(x-)?(.*?)(-x)$/;

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';






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

Date: Fri, 20 Apr 2001 20:57:21 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regexp matching with optional part
Message-Id: <g%UD6.7$uu4.1831@vic.nntp.telstra.net>

"Jonas Nilsson" <jonni@ifm.liu.se> wrote in message
news:9bp4cq$h87$1@newsy.ifm.liu.se...
> > x-abc-x  -> return abc
> > x-foo    -> return foo
> > bar-x    -> return bar
> > baz      -> return baz
> > x--x     -> fail
> >
> > Can this be done easily in a single regexp? The closest I came was
> >
> > /^(x-)?(.+?)(-x)$/
>
> if  /^(x-)?(.+?)(-x)?$/ {$result=$2} else {&fail};

That still prints a -x for the last case, notwithstanding the syntax error
resulting from the lack of parens around the condition.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Fri, 20 Apr 2001 21:00:11 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regexp matching with optional part
Message-Id: <Z1VD6.8$uu4.2047@vic.nntp.telstra.net>

"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:yUUD6.5$uu4.1978@vic.nntp.telstra.net...
> "Ronald Fischer" <ronald.fischer.gp@icn.siemens.de> wrote in message
> news:7qfwv8gq6pk.fsf@icn.siemens.de...
> >
>
> print "$2\n if /^(x-)?(.*?)(-x)$/;

Oops.. missed a closing quote there...and where has my question mark gone
huh? CUT AND PASTE you idiot!  :)

print "$2\n" if /^(x-)?(.*?)(-x)?$/;

Wyzelli (looking silly and wiping egg....)
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Fri, 20 Apr 2001 11:44:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regexp matching with optional part
Message-Id: <4b80et84ln89u9ef3ffclm3ti3s458coa0@4ax.com>

Ronald Fischer wrote:

>Can this be done easily in a single regexp? The closest I came was
>
>/^(x-)?(.+?)(-x)$/
>
>but this does not work (understandably) for the last case, "x--x". Of course I
>could check the borderline case separately, but I wonder if there is a simple
>way to do it.

Replace the "+" with a "*"?

-- 
	Bart.


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

Date: Fri, 20 Apr 2001 10:24:53 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: REgexp with variable
Message-Id: <slrn9e03a2.sm7.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 20 Apr 2001 11:23:53 +0200, Gianpaolo Pontarolo
<pontarolo@warpstudio.ch> wrote:
>
>Hi,
>
>I have a regexp with inside a variable is it possible to have this and
>how ?
>
>Here the code :
>
>while (.....) {
>
>        s /Hi $nome / Good Morning $nome / ;
>        ....
>}
>
>the variable $nome changes during the loop .....
>
>how can i put a variable in a such regexp ????

Did you try it the way you wrote it above? What happened?

Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: Fri, 20 Apr 2001 12:18:58 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: REgexp with variable
Message-Id: <3AE01B22.48C517C1@bms.umist.ac.uk>

Gianpaolo Pontarolo wrote:
> 
> Hi,
> 
> I have a regexp with inside a variable is it possible to have this and
> how ?
> 
> Here the code :
> 
> while (.....) {
> 
>         s /Hi $nome / Good Morning $nome / ;
>         ....
> }
> 
> the variable $nome changes during the loop .....
> 
> how can i put a variable in a such regexp ????

have you tried implementing what you've just suggested?

Paul


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

Date: Fri, 20 Apr 2001 12:32:46 +0200
From: "Roland Pellegrini" <pellegrini@erste.at>
Subject: Service
Message-Id: <987763162.170447@newsmaster-04.atnet.at>

Hi !

How can i register a perl-script as an service under WinNT ?
I need this for running perl-scripts in background.



Thank for your help

Roland




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

Date: Fri, 20 Apr 2001 20:43:49 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Service
Message-Id: <XNUD6.4$uu4.1848@vic.nntp.telstra.net>

"Roland Pellegrini" <pellegrini@erste.at> wrote in message
news:987763162.170447@newsmaster-04.atnet.at...
> Hi !
>
> How can i register a perl-script as an service under WinNT ?
> I need this for running perl-scripts in background.

Yes.  This is in the activestate FAQ.  You need the NT resource kit to do
it.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Fri, 20 Apr 2001 13:11:30 +0200
From: Hermann Fass <hermann@holzerath.de>
Subject: Re: So what do YOU use Perl for?
Message-Id: <3AE01962.BC90947E@holzerath.de>

For me Perl is usefull for:
- Evaluation of all kinds of logfiles (putting the results in text- or
html-files).
- Generation of static HTML-files from data plus templates.
- As a command-line tool (sometimes just because I forgot how to do it in
grep or awk)
- CGI too, but we migrated many CGI-applications to PHP4 now for the
designers' sake)

Herm.




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

Date: Fri, 20 Apr 2001 12:08:54 +0200
From: "Bastian Ballmann" <ballmann@co-de.de>
Subject: Spoofing a http referer
Message-Id: <20010420.120853.620145550.659@pc035.co-de.de>

Hi @ll!!
I have downloaded the Bundle::LWP and have read most of the manual but I
still dont know how to spoof a http referer.
Can anyone explain that to me, please?
Greetz

Basti


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

Date: 20 Apr 2001 11:18:02 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Spoofing a http referer
Message-Id: <slrn9e06ol.t89.rgarciasuarez@rafael.kazibao.net>

Bastian Ballmann wrote in comp.lang.perl.misc:
} I have downloaded the Bundle::LWP and have read most of the manual but I
} still dont know how to spoof a http referer.
} Can anyone explain that to me, please?

Use the LWP::UserAgent class to perform your HTTP request and add a
Referer header in the HTTP::Request object with the push_header()
method.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 20 Apr 2001 12:37:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: unicode-impressions
Message-Id: <Pine.LNX.4.30.0104201227070.31737-100000@lxplus003.cern.ch>

On Fri, 20 Apr 2001, Bart Lateur wrote:

> A link to my favourite website on the subject might be handy:
> <http://www.czyborra.com>.

I'll second that recommendation; I already point to it from my own
pages.

> In fact, these pages pretty much contain most
> you'll ever need to know,

About Unicode (and other character codings) in theory, yes, as well as
offering practical resources.  However, as you say in your next point:

> except of course that the info isn't
> web/browser oriented.

Indeed.  I've found a lot of fundamental misconceptions about how HTML
uses Unicode (i.e basically RFC2070).  Lots of people confidently
believe they understand what's going on and that there's just some
detail that escapes them; but when you try to explain the detail it
turns out to make no sense within their terms of reference, and it's
then awfully hard to convince them that they need to re-examine their
misconceptions.  (The term "character set" seems to be one of the key
issues.  Anyone who is convinced that the MIME attribute "charset"
specifies the "character set" in HTML is pretty much doomed, IMHO.)



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

Date: Fri, 20 Apr 2001 13:36:21 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: unicode-impressions
Message-Id: <MPG.154a3d9c530ddf86989829@news.inode.at>

In article <Pine.LNX.4.30.0104201227070.31737-100000@lxplus003.cern.ch>, 
flavell@mail.cern.ch says...
> 
> Indeed.  I've found a lot of fundamental misconceptions about how HTML
> uses Unicode (i.e basically RFC2070).  Lots of people confidently
> believe they understand what's going on and that there's just some
> detail that escapes them; but when you try to explain the detail it
> turns out to make no sense within their terms of reference, and it's
> then awfully hard to convince them that they need to re-examine their
> misconceptions.  (The term "character set" seems to be one of the key
> issues.  Anyone who is convinced that the MIME attribute "charset"
> specifies the "character set" in HTML is pretty much doomed, IMHO.)
> 

:) IMHO there are two sort of people out there:
One doesnt know anything about unicode and has to cost-analyze a 
multilanguage-platform within the next 2 weeks. This is what happened to 
me and I dealed with it by taking charset as 'character set' and convinced 
myself that my used tools handle all this unicode- and charsetstuff 
without me having a close look to it. As I stated on my page and as you 
might have noticed in this group: I didnt even know what to ask, what 
terms to use when I started the challenge.
The other group want to know more about it, about the background and the 
standards and know what is really going on. This is what I hope to be in a 
few month, when the project is in state of realization.

You see, this describes a very deep problem in modern IT-society. People 
only know what they are talking about when its already too late ;)
I think this is why we have software like we have :)

peter

ps: In my brain there is no much distance between 'charset' and 'character 
set' and I hope I am not pretty much doomed like you says. At least I know 
that I dont know anything about this stuff. (But at least I know more than 
my competitors)



-- 
pilsl@
goldfisch.at


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

Date: Fri, 20 Apr 2001 14:05:30 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: unicode-impressions
Message-Id: <Pine.LNX.4.30.0104201353490.31737-100000@lxplus003.cern.ch>

On Fri, 20 Apr 2001, peter pilsl wrote:

> ps: In my brain there is no much distance between 'charset' and 'character
> set' and I hope I am not pretty much doomed like you says.

es war gar nicht persoenlich gemeint  ;-)

When the MIME standards were set, it was usual to choose a character
coding that corresponded to the character repertoire that was needed,
and a font that was laid out according to just that character coding.

Thus the distinction between the various concepts of repertoire, font,
"document character set" (in the SGML sense) and character coding were
confused, and the MIME parameter for the character coding was called
"charset".  This was a long time ago now.

According to HTML4 (following RFC2070) the "document character set" in
HTML is always iso-10646/unicode, and this always determines the
correct numbers to be used in &#bignumber; representations, NO MATTER
which character coding is used.

My attempts to throw more light on this start with
http://ppewww.ph.gla.ac.uk/~flavell/charset/quick
and go on to http://ppewww.ph.gla.ac.uk/~flavell/charset/internat.html

Jukka Korpela also has discussion of these issues.

Of course, I understand what you're saying about getting results when
under time pressure.  But sometimes the aggregate effort can be less
if one is allowed to learn what one's doing, alongside the actual
practice.

viel Spass noch



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

Date: Fri, 20 Apr 2001 11:41:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: use strict & require...
Message-Id: <b580eto0ph13ej0bfucmu298o8g2i74aor@4ax.com>

Matt wrote:

>Then try to print a var created in the global.pl file I get the "Global
>symbol bla requires..." errors message. Can you get round this?

The easiest is to put those vars in the main package, by prepending "::"
to the variable name.

	$::foo = 1;

-- 
	Bart.


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

Date: 20 Apr 2001 12:17:47 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: use strict & require...
Message-Id: <slrn9e0a4f.3vd.damian@puma.qimr.edu.au>

Bart Lateur chose Fri, 20 Apr 2001 11:41:53 GMT to say this:
>Matt wrote:
>
>>Then try to print a var created in the global.pl file I get the "Global
>>symbol bla requires..." errors message. Can you get round this?
>
>The easiest is to put those vars in the main package, by prepending "::"
>to the variable name.
>
>	$::foo = 1;
>

I'll second that. I have a bunch of loosely connected systems that contain
lines like:

	warn 'blah' if $main::debug;

Cheers,
Damian
[ Constants? What are they? ]
-- 
@:=grep!($;+=m!$/|#!),split//,<DATA>;@;=0..$#:;while(@;){for($;=@;;--$;;){;(
$:=rand$;+$|)==$;&&next;@;[$;,$:]=@;[$:,$;]}push@|,shift@;if$;[0]==@|;select
$,,$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__
Just another Perl Hacker # rev 3 -- a JAPH in progress, I guess...


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

Date: Fri, 20 Apr 2001 14:02:00 +0200
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: What is a correct prototype for a subroutine w/o arguments
Message-Id: <3AE02538.26E0450@eed.ericsson.se>

Hi,

I have a subroutine db_connect which isn't supposed to take
any arguments:

  sub db_connect;
 ...
  $dbh   = db_connect;
 ...
  sub db_connect ()
  {
      return DBI -> connect ("dbi:Sybase:server=$DBSERV", $DBUSER, $DBPASS,
                             { RaiseError => 1, 
                               AutoCommit => 1, 
                               ChopBlanks => 1, });
  }

However the perl 5.6.0 comlains:

  perl -cwT delivery-subsystems.cgi
  [Fri Apr 20 13:57:50 2001] delivery-subsystems.cgi: Prototype mismatch: sub main::db_connect vs () at delivery-subsystems.cgi line 359.
  delivery-subsystems.cgi syntax OK

So I have to change the prototype above to

  sub db_connect ();

which helps (perl doesn't complain). I wonder if 
there is such prototype-type at all:  sub my_sub;
And if there is, what's the difference to the: sub my_sub ();

Also I wonder, what is the correct protoype for subroutines 
used with the "sort" keyword (like print sort &my_sub ...).

Thank you in advance
Alex


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

Date: Fri, 20 Apr 2001 13:18:28 +0200
From: "P.Eftevik" <pef@trasra.noXX>
Subject: while loop
Message-Id: <3AE01B04.5EC9143F@trasra.noXX>

A WHILE loop is browsing through a text file - line by line,
searching for a pattern.

If there is a pattern match, I'd like to examine the  p r e v i o u s
line of the text file.

So how can I manipulate what's the "pending line" of the browsed text
file ??

thanx for hints

Pefte




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

Date: Fri, 20 Apr 2001 21:08:57 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: while loop
Message-Id: <u9VD6.9$uu4.1986@vic.nntp.telstra.net>

"P.Eftevik" <pef@trasra.noXX> wrote in message
news:3AE01B04.5EC9143F@trasra.noXX...
> A WHILE loop is browsing through a text file - line by line,
> searching for a pattern.
>
> If there is a pattern match, I'd like to examine the  p r e v i o u s
> line of the text file.
>
> So how can I manipulate what's the "pending line" of the browsed text
> file ??

Read a line, store it in a variable. (do you need to examine the first
line?)
Read another line, examine it, if a match, do stuff with the line in the
var...

If you can examine the first line and then on match do something with a non
existent (empty variable) you can do it all in one loop.  A simple
conditional test should help with that anyway.

One solution may look a little like this (semi pseudo code):

#!/usr/bin/perl -w
use strict;

open (FILE, '<myfile.here') or die "Cant do it Captain $!";
my $line_var;
while (<FILE>){
    if (/some_condition/){ # test  for your condition in the current line
        if ($line_var){ # if we have a stored line (the previous line)
            print $line_var; # do stuff with the stored line;
        }
    }
    $line_var = $_; # stick the current line in the var
}

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';






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

Date: Fri, 20 Apr 2001 12:36:37 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: while loop
Message-Id: <9bp71s$ru4$1@spider.iona.com>


P.Eftevik <pef@trasra.noXX> wrote in message
news:3AE01B04.5EC9143F@trasra.noXX...
> A WHILE loop is browsing through a text file - line by line,
> searching for a pattern.
>
> If there is a pattern match, I'd like to examine the  p r e v i o u s
> line of the text file.
>
> So how can I manipulate what's the "pending line" of the browsed text
> file ??
>
> thanx for hints
>
> Pefte
Rather than trying to examine something you haven't read yet, save something
that you have!

Either save the last line before you read a new one:
while(<FILE>){
    if(/matched pattern/){
        # $lastline contains the previous line so look at that
    }
    $lastline=$_;
}

or use an array and a for loop instead.
@contents=<FILE>;
for($line=0;$line<=$#contents;$line++){
    if($contents[$line] =~ /pattern matched/){
        $contents[$line-1]; # will give you the line you want to look at
    }
}

Graham Wood




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 727
**************************************


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