[10304] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3897 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 5 23:07:13 1998

Date: Mon, 5 Oct 98 20:00:19 -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           Mon, 5 Oct 1998     Volume: 8 Number: 3897

Today's topics:
    Re: CGI.pm objects <mp@mkt2mkt.com>
    Re: Error Message....GD.pm (Martien Verbruggen)
    Re: Help with Embedding Perl into multiple instance in  <sugalskd@netserve.ous.edu>
    Re: HELP with variable naming <howel88@cyberway.com.sg>
    Re: HELP with variable naming (David A. Black)
    Re: HELP with variable naming (David A. Black)
        How do you use the perl compiler? <ChrisA@ile.com>
    Re: How to open a command that pipes both in and out ?? (Tad McClellan)
    Re: How to pass a hash array to a sub program (Brand Hilton)
    Re: How to pass a hash array to a sub program (Larry Rosler)
    Re: How to pass a hash array to a sub program <matt@whiterabbit.co.uk>
        idealab! programmer position romac9464@my-dejanews.com
    Re: libnet bundle and Net::SMTP <Paul.Coleman@CoSeCo.com>
    Re: Matching Smallest Instance of a Pattern (Abigail)
    Re: Matching Smallest Instance of a Pattern (Abigail)
    Re: Matching Smallest Instance of a Pattern (Larry Rosler)
    Re: Matching Smallest Instance of a Pattern (Abigail)
    Re: Matching Smallest Instance of a Pattern (Larry Rosler)
    Re: Matching Smallest Instance of a Pattern <psdspss@execpc.com>
    Re: Memory Usage Modual [sic] Module <eashton@bbnplanet.com>
    Re: Newbie Question about launching new browser window (Craig Berry)
        Page Break. <psdspss@execpc.com>
    Re: Perl and Novell Netware v4 (Michael Congdon)
    Re: Perl and Novell Netware v4 <eashton@bbnplanet.com>
    Re: Perl and Novell Netware v4 (Rich)
        please check my CGI.pm/Perl Syntax <mp@mkt2mkt.com>
        Please help me!! Connecting to Oracle <hovi@mtco.com>
        Reaction Times (K. Finstad)
        regular expression <sford@home.com>
    Re: send geroge reese (was Re: Call for Participation:  (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 05 Oct 1998 16:40:32 -0800
From: madame philosophe <mp@mkt2mkt.com>
To: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: CGI.pm objects
Message-Id: <361966EA.D423477C@mkt2mkt.com>

Hi Jonathan,

Ok I checked out your email and here's a question.  (Any onle else  please join
in if you care to impart your wisdom!)

If I've created an object in the main routine of a perlscript with say 5
parameters from the form input (the $q object) and I pass $q to a subroutine
like this:

sub spawn {

local($q) = shift;

$child = new CGI($q);

In the new object $child I only want to use 3 of the five original params...

QUESTION 1:
How would I discard the 2 I don't want?

I know there's CGI.pm's delete() method, but I can't tell if this deletes a
param, the value of the param or both.

QUESTION 2:
What is a quick stub for assigning a scalar to the value of a param?

I know I can do:

$scalar = $q->param('name');

but what if I have a long list of params?

do I have to do something like this:

$scalarA = $q->param('name1');
$scalarB = $q->param('name2');
$scalarC = $q->param('name3');
$scalarD = $q->param('name4');
$scalarE = $q->param('name5');
$scalarF = $q->param('name6');
 ..etc.

???

I know you can retrieve names of the params like this:

@names = $q->param();

but how to assign to a hash rather than only this array for the set param keys?

I know there is this stub below too, but it's not secure:

foreach $name (param()) {

    $value = param($name)
}

Thanks again,

mp





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

Date: Mon, 05 Oct 1998 23:20:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Error Message....GD.pm
Message-Id: <SucS1.14$tR1.109435@nsw.nnrp.telstra.net>

In article <36181107.45DD0D4C@bestweb.net>,
	Eugene <yrsow@bestweb.net> writes:

> [Sun Oct 4 14:23:28 1998] GD.pm:
> [Sun Oct 4 14:23:28 1998]
> FileHandle.pm:
> Can't load
> '/y/r/yrsow/.perl_pm/i386-freebsd/auto/GD/GD.so'

Indeed. GD is not installed correctly. I suspect that you just copied
the GD.pm file to your modules directory. GD also needs a compiled
part.

You either have to download the sources of GD, and read the README,
which tells you to do something like:

# perl Makefile.PL
# make
# make test
# make install

or you try to find a binary distribution for your platform and perl
version, and install that.

Oh, and make sure all the permissions on the files are set correctly.
You need to be able to read them.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd.       | selective about it's friends.
NSW, Australia                      | 


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

Date: 6 Oct 1998 00:40:56 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: Help with Embedding Perl into multiple instance in different threads?
Message-Id: <6vbouo$n9b$1@news.NERO.NET>

Victor Lu <victorl@egSoftware.com> wrote:
: Has anyone tried to embed perl into multiple threads such that each thread
: runs a seperate perl instance.  concurrently.

If you use the latest perl (5.005_02) compiled with MULTIPLICITY defined,
you ought to be able to do this as long as no two threads are in the perl
lexer at the same time. (You're in the lexer during a string eval,
require, and while your program is being initially parsed)

Use at your own risk right now, though--I don't think it's been really
heavily beaten upon.

					Dan


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

Date: Tue, 06 Oct 1998 08:51:37 +0730
From: Hongwei <howel88@cyberway.com.sg>
Subject: Re: HELP with variable naming
Message-Id: <3619709F.8C460689@cyberway.com.sg>

Andrew Perrella wrote:

> Hello,
>
>     I have an array (called name_array) with 9 keys and values.  All of
> the keys are of the form 1_1_i where i is a number from 0-8.
>
> I want to associate a scalar with each array value.  All of my scalars
> have the form $ai where i is the same as above.
>
> So:
> $a0 = $name_array{'1_1_0'};
> $a1 = $name_array{'1_1_1'};
>
> etc.
>
> I am trying to write a for loop that goes through my array and
> automatically creates these scalars and sets these values.  I could do
> the 8 by hand, however in the future I will be dealing with many more
> values.
>
> The code I have tried is below but doesn't work at all.
>
> for ($i=0; $i != @key_list; $i++){
>  $a.$1 = $name_array{'1_1_.$i'};
>
>  }
>
>   If someone can help that would be great.
>
> thanks,
>
> Andrew Perrella
> ap85@cornell.edu

  $loop = 9;
   for $i (0 .. $loop)
   {
       $b = "a$i";
        $$b = $name_array{"1_1_$i"};
   }



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

Date: Mon,  5 Oct 1998 21:27:52 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: HELP with variable naming
Message-Id: <6vbrmo$gmt$1@earth.superlink.net>

Hello -

Andrew Perrella <ap85@cornell.edu> writes:

>Hello,

>    I have an array (called name_array) with 9 keys and values.  All of
>the keys are of the form 1_1_i where i is a number from 0-8.

>I want to associate a scalar with each array value.  All of my scalars
>have the form $ai where i is the same as above.

>So:
>$a0 = $name_array{'1_1_0'};
>$a1 = $name_array{'1_1_1'};

>etc.


>I am trying to write a for loop that goes through my array and
>automatically creates these scalars and sets these values.  I could do
>the 8 by hand, however in the future I will be dealing with many more
>values.

>The code I have tried is below but doesn't work at all.

>for ($i=0; $i != @key_list; $i++){
> $a.$1 = $name_array{'1_1_.$i'};

> }


First of all, if you want to tweak your code and get it to work:

my %name_array = qw(1_1_0 oneoneoh 1_1_1 oneoneone);
my @key_list = keys %name_array;

for my $i (0..@key_list) { ${"a$i"} = $name_array{"1_1_$i"} }


However, I'd be willing to bet that this isn't at all the best way to
do whatever you're trying to do.  You'd probably be much better off using
multidimensional hashes, and assign to an array:

$a[0] = $name_array{1}{1}{0};

or perhaps, if would comport with your later expansion:

$a[0] = $name_array{110};

or something along those lines.  You're doing too much of the work here;
you need to let Perl do more of it.


David Black
dblack@saturn.superlink.net



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

Date: Mon,  5 Oct 1998 22:20:08 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: HELP with variable naming
Message-Id: <6vbuoo$p76$1@earth.superlink.net>

dblack@saturn.superlink.net (David A. Black) writes:

>for my $i (0..@key_list) { ${"a$i"} = $name_array{"1_1_$i"} }

Whoops, make that  (0..$#key_list)


David Black
dblack@saturn.superlink.net


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

Date: Mon, 5 Oct 1998 19:55:48 -0600 
From: Chris Anderson <ChrisA@ile.com>
Subject: How do you use the perl compiler?
Message-Id: <2CD4D1A956A0D111B04100805F6F312CBA64E6@email.ile.com>

I have the ActiveState Perl v5.00.502 on Windows 95 (I've also tried on
NT 4.0) and I can't get the compiler to work. All the documentation I've
seen makes it sound pretty idiot proof- just type "perlcc a.pl" and
you'll get an executable. So, I guess I'm an idiot because it's not
working. The perl syntax checks out OK, and it creates the code but
chokes on compiling with the message "Couldn't open !"- it's missing a
filename in the error message.
It seems like there must be some setup required (and I'm guessing that's
what I'm missing), but I haven't seen any documentation on that.
Any help would be appreciated

Thanks,
Chris



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

Date: Mon, 5 Oct 1998 18:42:14 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to open a command that pipes both in and out ???
Message-Id: <mglbv6.p5j.ln@flash.net>

Aleksey Zvyagin (zal@rest.ru) wrote:

: I want to do following:
: to open the command by 'open' function that this command will be piped by
: opened file descriptor and pipes this file descriptor. I thought to do this
: as:

: open DESCR, "|program|";


   Perl FAQ, part 8:

      "How can I open a pipe both to and from a command?"


: Please,  to send your copy answer to my E-mail: zal@rest.ru


   The answer is already on your hard disk, so I'll just post it here.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 5 Oct 1998 23:14:04 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: How to pass a hash array to a sub program
Message-Id: <6vbjrs$7p24@mercury.adc.com>

In article <36193FFC.BF5C898D@home.com>,
Douglas Galbraith  <douglas@home.com> wrote:
>Hello, and thanks for the help;
>
>How do you pass a hash array to a subprogram?  Below is an example that
>I
>can't get to work.

First, a little terminology.  It's a hash, not a hash array.  You see,
Perl has hashes and it has arrays, and they aren't the same thing.  If
you call hashes "hash arrays", people will get confused.

Now, on to the problem.  Your problem here is a misunderstanding of
how arguments are passed to subroutines.  Arguments are passed in
"@_".  "%_" is not a hash synonym for this.  "man perlsub" or "perldoc
perlsub" and read it very carefully.  I also stuck a line in your
subroutine that makes it work.  Not sure how useful it will be to you,
but hopefully it will help you understand.

Have fun!

>-------------------------------------------------------------
>
>my %hash_array = (
>                  "one"   => "1",
>                  "two"   => "2",
>                  "three" => "3"
>                 );
>
>print "Here is the hash array in the main program:\n";
>while (my ($key,$value) = each %hash_array) {print "$key=$value\n";}
>print_hash(%hash_array);
>
>sub print_hash
>{
> print "Here is the hash array passed into the subprogram:\n";

%_ = @_;   # kludge to make line below work.

> while (my ($key,$value) = each %_) {print "$key=$value\n";}
>}
>
>-------------------------------------------------------------


-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: Mon, 5 Oct 1998 16:47:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to pass a hash array to a sub program
Message-Id: <MPG.1082fa7b84de4469897e4@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <6vbjrs$7p24@mercury.adc.com> on 5 Oct 1998 23:14:04 GMT, 
Brand Hilton <bhilton@tsg.adc.com> says...
> In article <36193FFC.BF5C898D@home.com>,
> Douglas Galbraith  <douglas@home.com> wrote:
 ...
> >while (my ($key,$value) = each %hash_array) {print "$key=$value\n";}
> >print_hash(%hash_array);
> >
> >sub print_hash
> >{
> > print "Here is the hash array passed into the subprogram:\n";
> 
> %_ = @_;   # kludge to make line below work.
> 
> > while (my ($key,$value) = each %_) {print "$key=$value\n";}
> >}

The following fix is better.  It avoids any copying of the hash, which is 
copied *twice* as you have chosen to fix the problem!

    print_hash(\%hash_array);

 ...

    while (my ($key,$value) = each %{$_[0]}) {print "$key=$value\n";}


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


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

Date: Tue, 06 Oct 1998 01:37:03 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: Douglas Galbraith <douglas@home.com>
Subject: Re: How to pass a hash array to a sub program
Message-Id: <3619662F.3B156D0A@whiterabbit.co.uk>

Hi Douglas,

Almost right except that within the subroutine you should use

%values = @_;

Want an example?

$val{"this"}="that";
$val{"that"}="this";
$val{"there"}="here";

showvalues (%val);

sub showvalues {
	%values = @_;
	foreach (keys %values) {
		print "The value of $_ is $values{$_}\n";
	}
	return;
}

There you go.

Matt
--





Douglas Galbraith wrote:
> 
> Hello, and thanks for the help;
> 
> How do you pass a hash array to a subprogram?  Below is an example that
> I
> can't get to work.
> 
> thanks,
> DGalbra862@aol.com
> 
> -------------------------------------------------------------
> 
> my %hash_array = (
>                   "one"   => "1",
>                   "two"   => "2",
>                   "three" => "3"
>                  );
> 
> print "Here is the hash array in the main program:\n";
> while (my ($key,$value) = each %hash_array) {print "$key=$value\n";}
> print_hash(%hash_array);
> 
> sub print_hash
> {
>  print "Here is the hash array passed into the subprogram:\n";
>  while (my ($key,$value) = each %_) {print "$key=$value\n";}
> }
> 
> -------------------------------------------------------------

-- 
Matt's daily comic strip
Porridge and Fartcakes
http://www.whiterabbit.co.uk/cartoons


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

Date: Mon, 05 Oct 1998 23:53:23 GMT
From: romac9464@my-dejanews.com
Subject: idealab! programmer position
Message-Id: <6vbm5j$dv0$1@nnrp1.dejanews.com>

Seeking a very smart programmer w/a BS in Computer Science or equivalent
experience/skills. Must be very strong in C/C++, Java, or Perl. Expertise in
Perl CGI will win you fame, glory, more money & stock options.

You will write & maintain CGI scripts & other supporting code for websites.
You will be part of a growing, highly motivated team, & you will be
responsible in a large part for the company's success. Expect to submit
samples of your code & to write a sample routine at the interview.

Please reply to charlie@idealab.com

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


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

Date: Mon, 5 Oct 1998 19:21:20 -0400
From: "-Paul Coleman" <Paul.Coleman@CoSeCo.com>
Subject: Re: libnet bundle and Net::SMTP
Message-Id: <36195559.0@news3.paonline.com>

Hi,
My ISP is using Win NT 4.0, IIS 3.0 and Perl 5.001.  The libnet bundle I
found at CPAN will work by itself but has many dependencies.  Is there a
version of Vars.pm that will work on 5.001?  I couldn't fond anything on
CPAN.  Does anyone know what and where the other dependencies are the will
allow  SMTP.pm to work on 5.001?
Thanks,
Paul Coleman

Elaine -HappyFunBall- Ashton wrote in message
<36193805.47C3740@bbnplanet.com>...
>-Paul Coleman wrote:
>
>> Where can I find the libnet bundle so that I can use Net::SMTP?
>
>Have you tried CPAN? http://www.perl.com
>
>e.
>
>And did you get what you wanted from this life,
>even so? I did.  And what did you want?
>To call myself beloved, to feel myself
>beloved on the earth.               -R. Carver-




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

Date: 5 Oct 1998 23:04:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <6vbj97$dho$1@client3.news.psi.net>

Jim McAtee (jmcatee@mediaodyssey.com) wrote on MDCCCLXI September
MCMXCIII in <URL:news:36193b24.148782707@news.supernews.com>:
++ How do I match the smallest instance of a pattern?

That's a hard question, for which there isn't much support in
Perls regex machine.

++                                                     I'm trying to
++ replace a filename within an html image tag as follows.  The pattern
++ I've tried below matches from the first '/' through the end of the
++ '.gif' file extension.
++ 
++ $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/xyz.gif"
++ width=110 height=29></a>'
++ 
++ s|/.*?\.gif|/abc.gif|;

Exactly.

You might want to use HTML::Parser, parse the HTML text, and replace
the src attributes of the IMG elements. That's the best option; any
regex that doesn't take context into account will bite you sooner or
later.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: 5 Oct 1998 23:06:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <6vbjd7$dho$2@client3.news.psi.net>

Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXI September MCMXCIII in
<URL:news:MPG.1082e086b87ce6a99897e1@nntp.hpl.hp.com>:
++ 
++ 
++    s|/[^/]+\.gif|/abc.gif|;
++  
++ will match from the *last* '/' through the end of the '.gif' file 
++ extension.


<a href = "/alpha/beta/gamma.htm"><img src = "xyz.gif" width = 110
height = 29></a>



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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

Date: Mon, 5 Oct 1998 16:30:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <MPG.1082f66b3ac290f89897e3@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <6vbjd7$dho$2@client3.news.psi.net> on 5 Oct 1998 23:06:15 
GMT, Abigail <abigail@fnx.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXI September MCMXCIII in
> <URL:news:MPG.1082e086b87ce6a99897e1@nntp.hpl.hp.com>:
> ++ 
> ++ 
> ++    s|/[^/]+\.gif|/abc.gif|;
> ++  
> ++ will match from the *last* '/' through the end of the '.gif' file 
> ++ extension.
> 
> 
> <a href = "/alpha/beta/gamma.htm"><img src = "xyz.gif" width = 110
> height = 29></a>

Of course, that observation has little to do with the problem statement:

!> $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/xyz.gif"
!> width=110 height=29></a>'
!> 
!> s|/.*?\.gif|/abc.gif|;

However, just for completeness, I guess:

  s|[^/"'\s]+\.gif(?=[>"'\s])|abc.gif|i;

covers a few more pathological situations.

Your move...

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


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

Date: 6 Oct 1998 02:47:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <6vc0bi$fgf$1@client3.news.psi.net>

Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXI September MCMXCIII in
<URL:news:MPG.1082f66b3ac290f89897e3@nntp.hpl.hp.com>:
++ [Posted to comp.lang.perl.misc and a copy mailed.]
++ 
++ In article <6vbjd7$dho$2@client3.news.psi.net> on 5 Oct 1998 23:06:15 
++ GMT, Abigail <abigail@fnx.com> says...
++ > Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXI September MCMXCIII in
++ > <URL:news:MPG.1082e086b87ce6a99897e1@nntp.hpl.hp.com>:
++ > ++ 
++ > ++ 
++ > ++    s|/[^/]+\.gif|/abc.gif|;
++ > ++  
++ > ++ will match from the *last* '/' through the end of the '.gif' file 
++ > ++ extension.
++ > 
++ > 
++ > <a href = "/alpha/beta/gamma.htm"><img src = "xyz.gif" width = 110
++ > height = 29></a>
++ 
++ Of course, that observation has little to do with the problem statement:
++ 
++ !> $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/xyz.gif"
++ !> width=110 height=29></a>'
++ !> 
++ !> s|/.*?\.gif|/abc.gif|;

Well, if you consider only the given line as a posibility, why bother
with a regex?

        $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/abc.gif"
        width=110 height=29></a>'

will do.

Somehow, I don't think the person asking the original question only
wanted to change one specific occurance.

++ 
++ However, just for completeness, I guess:
++ 
++   s|[^/"'\s]+\.gif(?=[>"'\s])|abc.gif|i;
++ 
++ covers a few more pathological situations.
++ 
++ Your move...

<a href="/alpha/beta/gamma.htm"><img src="/graphics/x'z.gif"
width=110 height=29></a>



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Mon, 5 Oct 1998 19:47:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <MPG.1083249c28cbf8ac9898a0@nntp.hpl.hp.com>

In article <6vbjd7$dho$2@client3.news.psi.net> on 5 Oct 1998 23:06:15 
GMT, Abigail <abigail@fnx.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXI September MCMXCIII in
> <URL:news:MPG.1082e086b87ce6a99897e1@nntp.hpl.hp.com>:
> ++ 
> ++ 
> ++    s|/[^/]+\.gif|/abc.gif|;
> ++  
> ++ will match from the *last* '/' through the end of the '.gif' file 
> ++ extension.
> 
> 
> <a href = "/alpha/beta/gamma.htm"><img src = "xyz.gif" width = 110
> height = 29></a>

Of course, that observation has little to do with the problem statement:

!> $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/xyz.gif"
!> width=110 height=29></a>'
!> 
!> s|/.*?\.gif|/abc.gif|;

However, just for completeness, I guess:

  s|[^/="'\s]+\.gif(?=[>"'\s])|abc.gif|i;

covers a few more pathological situations.

Your move...

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


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

Date: Mon, 05 Oct 1998 22:06:07 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Matching Smallest Instance of a Pattern
Message-Id: <6vc0qh$rqp@newsops.execpc.com>

Since the pattern matching operators are greedy, they try to match as
much
as possible. So mark the string that needs to be replaced.

Try this
$str =~ s(graphics/xyz.gif) (graphics/abc.gif)i;
Here graphics serves a marker and parenthesis is used as a delimiter.

Hope this helps.
Deva

Jim McAtee wrote:

> How do I match the smallest instance of a pattern?  I'm trying to
> replace a filename within an html image tag as follows.  The pattern
> I've tried below matches from the first '/' through the end of the
> '.gif' file extension.
>
> $_ = '<a href="/alpha/beta/gamma.htm"><img src="/graphics/xyz.gif"
> width=110 height=29></a>'
>
> s|/.*?\.gif|/abc.gif|;
>
> Thanks,
> Jim





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

Date: Mon, 05 Oct 1998 23:00:39 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Memory Usage Modual [sic] Module
Message-Id: <36194D1E.4D9AB5B7@bbnplanet.com>

For benchmarking you might also have a look in the lastest TPJ for an
article on this very topic by brian d foy.

e.

Da primeira vez era a cidade
           Da segunda o cais e a eternidade
						- Jobim -


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

Date: 5 Oct 1998 23:09:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Newbie Question about launching new browser window
Message-Id: <6vbjjk$426$1@marina.cinenet.net>

Bradley Basden (basden@imagun.com) wrote:
: I am new to PERL and have used it to to create pages on the fly
: successfully. My questions is this. I would like the script to launch a
: child window similar to the javascript window.open command. It has to launch
: a second browser window rather than replacing the current page. It also has
: to launch the child window without the browser buttons, scrollbars, etc. If
: anyone can point me in the right direction, it would be appreciated.

This isn't a Perl question; it's nothing that Perl can do directly.  You
can have Perl generate HTML containing the Javascript code to accomplish
this, but to Perl it's just more string data it's tossing around.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Mon, 05 Oct 1998 21:23:08 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Page Break.
Message-Id: <6vbua0$ovh@newsops.execpc.com>

I need to produce a report using Perl.

In the header portion of the report, there is a variable
information(Dept No).
Whenever the Dept No changes, a page break(new page) should be induced.

How to do this ?

Deva




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

Date: Tue, 06 Oct 1998 01:38:22 GMT
From: mscongdon@hotmail.com (Michael Congdon)
Subject: Re: Perl and Novell Netware v4
Message-Id: <3619744a.9148414@news.bewellnet.com>

Thanks for responding so fast.  I appreciate it.  Unfortunately, I
don't have a copy of the manual.  I am working on a project remotely.
Do you know where I could find extensive documentation?  Or do you
know the answer to these.  I'm baffled.  Thanks again

On Mon, 05 Oct 1998 18:52:03 GMT, Elaine -HappyFunBall- Ashton
<eashton@bbnplanet.com> wrote:

>Michael Congdon wrote:
>
>> Our company is using a Novell Netware 4.0 server and I'm trying to use
>> publish our web site using a Perl database script.  I'm wondering what
>> the default ROOT directory is in NetWare.
>
>I'm sure the OS came with a manual. 
>
>e.
>
>So the Earth endures, in every petty matter
>And in the lives of men, irreversible.
>And it seems a relief. To win? To lose?
>What for, if the world will forget us anyway. -C. Milosz-



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

Date: Tue, 06 Oct 1998 02:00:10 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Perl and Novell Netware v4
Message-Id: <36197732.90FB9A8B@bbnplanet.com>

Michael Congdon wrote:

> Thanks for responding so fast.  I appreciate it.  Unfortunately, I
> don't have a copy of the manual.  I am working on a project remotely.
> Do you know where I could find extensive documentation?  Or do you
> know the answer to these.  I'm baffled.  Thanks again

Darling, you have many choices to find the answer that you seek. Have
you tried going to http://www.novell.com or even perusing a manual in a
bookstore? If you are quite that baffled should you be in the field?
Novell has been around for quite some time and there are many places to
ask this question. You must want to work for the answer. There is no
silver platter here.

e.

Agora eu ja sei
Da onda que se ergueu no mar
E das estrelas que esquecemos de contar
O amor se deixa surpreender
Enquanto a noite vem nos envolver	-jobim-


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

Date: 6 Oct 1998 01:48:33 GMT
From: richm@ucesucks.mulveyr.roc.servtech.com (Rich)
Subject: Re: Perl and Novell Netware v4
Message-Id: <slrn71itmr.r89.richm@ll.aa2ys.ampr.org>

On Mon, 05 Oct 1998 18:04:09 GMT, Michael Congdon <mscongdon@hotmail.com> wrote:
>Our company is using a Novell Netware 4.0 server and I'm trying to use
>publish our web site using a Perl database script.  I'm wondering what
>the default ROOT directory is in NetWare.
>
>Also, when do you use "sys:" in the PATH.
>

   That's odd, I could have sworn that comp.os.netware was three
doors down the hall, on the left.

- Rich

--
Rich Mulvey                                         
My return address is my last name, 
   followed by my first initial, @mulveyr.roc.servtech.com        
http://mulveyr.roc.servtech.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa


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

Date: Mon, 05 Oct 1998 19:30:39 -0800
From: madame philosophe <mp@mkt2mkt.com>
Subject: please check my CGI.pm/Perl Syntax
Message-Id: <36198EBA.247CE507@mkt2mkt.com>

Is this syntax correct?

Thanks in advance!

mp
--------

sub spy {

 local $q = shift;
 local $activity_path;

 my $spy_entry = new CGI($q);
 my(@spy_set, $stuff, $log_row);

 foreach ($spy_entry->param() =~
/^(person|action|contribution|email|date)$/) {

  push(@spy_set, map{ $stuff = $spy_entry->param($_) });

   $log_row = join( ' ][ ', @spy_set);

  }

 sysopen(LOG, "$activity_path", O_WRONLY|O_APPEND, 0660) ||
log_error('LOGTRACK_ERR',$spy_entry);

 flock(LOG, LOCK_EX);

 $spy_entry->save($log_row);

 close LOG;

 flock(LOG, LOCK_UN);

}#end of spy()





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

Date: Tue, 06 Oct 1998 02:08:17 GMT
From: hovi <hovi@mtco.com>
Subject: Please help me!! Connecting to Oracle
Message-Id: <3619967C.DBEAFB9B@mtco.com>

        I am a new Perl user.  I need to get connected to Oracle through
Perl.  I am using Windows 95 and the newest version of Perl.  Please
e-mail me back with help if you could.  Thank You.

c_hovious@hotmail.com



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

Date: Mon, 05 Oct 1998 20:21:12 -0700
From: kfinstad@unm.edu (K. Finstad)
Subject: Reaction Times
Message-Id: <kfinstad-0510982021130001@ppp-145.unm.edu>

Hi,
I'm relatively new to Perl, and was wondering if there is anything built
in (or available as a module) that will let Perl record responses from the
keyboard or mouse with millisecond resolution.  Any help is appreciated.

-Kraig Finstad


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

Date: Tue, 06 Oct 1998 02:30:42 GMT
From: Steven Ford <sford@home.com>
Subject: regular expression
Message-Id: <361980D1.25554A91@home.com>

shouldn't this regx work?

if (@achFiles =~ /$file/){
 Do something....}

I want to check and see if a file is in a list of valid filenames. This
is how I initialized @achFiles:

@achFiles = (
	"filename1.ach",
        "filename2.ach",
	"filename3.ach",
        "filename4.ach");

Well, it didn't work for me, any suggestions?

- Steven Ford


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

Date: 6 Oct 1998 00:05:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: send geroge reese (was Re: Call for Participation: Python Conference)
Message-Id: <6vbmt4$ejq$1@client3.news.psi.net>

Zenin (zenin@bawdycaste.org) wrote on MDCCCLXI September MCMXCIII in
<URL:news:907627276.940256@thrush.omix.com>:
++ Abigail <abigail@fnx.com> wrote:
++ : Zenin (zenin@bawdycaste.org) wrote on MDCCCLIX September MCMXCIII in
++ 	>snip<
++ : ++ 	Luckely, there's a cleaner way: upgrade to 5.005+.  With core
++ : ++ 	support for private fields, compile time field name checks, and
++ : ++ 	real exception object support.
++ :
++ : It remains a hack on a hack.
++ 
++ 	How so?  Please explain.

@{$self -> {_array}}  vs   @array;

The fact your implementation depends on the implementation of your
parent class. OO is implementation *hiding*, not being depended on it.

Yes, fields.pm makes it a little better. It took only 5 years of OO Perl
to come with it. Which means that 5 years worth of writing modules
does *NOT* use fields.pm and suffers from name collision and not having
data encapsulation.

Constructors like:
       sub new {
           my $class = shift;
           no strict 'refs';
           my $self = bless [\%{"$class\::FIELDS"}], $class;
           $self;
       }
only enforce that OO Perl is a hack.

Making anon arrays magical is the first element is a reference to a
hash is just a kludge.

[  Not to mention the following from perlref:

       WARNING:  This section describes an experimental feature.
       Details may change without notice in future versions.

   Which means that one shouldn't use the new fluff in serious code,
   because it might disappear in the future.
]



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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