[16523] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3935 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 7 11:05:37 2000

Date: Mon, 7 Aug 2000 08: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: <965660714-v9-i3935@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 7 Aug 2000     Volume: 9 Number: 3935

Today's topics:
    Re: CGI page inheritance <tony_curtis32@yahoo.com>
    Re: combinations - a better way to do this? (Decklin Foster)
    Re: convert string from uppercase to lower case (Keith Calvert Ivey)
    Re: DBI/Oracle: Retrieving lowercase field names from O (John D Groenveld)
    Re: Dreaded 500 message <kperrier@blkbox.com>
    Re: dropping space from begginning & end of a string (Chest Rockwell)
    Re: dropping space from begginning & end of a string (Keith Calvert Ivey)
    Re: five lines of NQL or 45 lines of Perl  hmmmm...... <russ_jones@rac.ray.com>
        get method in a html form ??? <docouto@my-deja.com>
    Re: Help with Apache & Perl <kperrier@blkbox.com>
    Re: Help!! Need to find user name <tony_curtis32@yahoo.com>
    Re: Impossible RegEx Problem (Keith Calvert Ivey)
    Re: Memory leak in perl code <jboes@eoexchange.com>
    Re: Need faster metasearch (Colin Keith)
    Re: Need help fixing a PerlShop problem ()
        Newbie: Regular Expression (Tony Balazs)
    Re: Newbie: Regular Expression <wcurtis@tstar.net>
    Re: Newbie: Regular Expression <wcurtis@tstar.net>
    Re: OT: find the number of characters in a string (Keith Calvert Ivey)
        perl job newsgroup cardwellm@my-deja.com
        Please help me! <mark325@hotmail.com>
    Re: Reg Expression Question <mauldin@netstorm.net>
    Re: Reg Expression Question <mauldin@netstorm.net>
    Re: reg expressions - protect html <wyzelli@yahoo.com>
    Re: Regexp problem - Stripping HTML (Colin Keith)
    Re: Retrieving BLOBs from Oracle using DBI (John D Groenveld)
    Re: Retrieving data from dynamically created page (Keith Calvert Ivey)
    Re: sending javascript value to CGI <daverwin@hotmail.com>
    Re: sending javascript value to CGI (Colin Keith)
    Re: totally newbie to perl, I ... (Decklin Foster)
        use in subroutines <ke77le@my-deja.com>
        Windows Perl 5.6 Debugger pager question <wcurtis@tstar.net>
        Windows Perl 5.6 Debugger pager question <wcurtis@tstar.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 07 Aug 2000 08:13:12 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: CGI page inheritance
Message-Id: <87bsz5gqon.fsf@limey.hpcc.uh.edu>

>> On Mon, 7 Aug 2000 22:04:04 +1000,
>> Nick Doyle <npd@students.cs.mu.OZ.AU> said:

Don't understand this.

> We're making a site with a lot of similar pages, but I
> don't think cgi scripts can inherit (when i say 'we', i

can't inherit

> have each cgi script use a page_printer.pm class, which
> inherits the common methods from the more general class.

can inherit!

A perl program can inherit from a class by sub-classing.
CGI has nothing to do with it (unless you're trying to
sub-class CGI.pm of course :-)

Can you show a simple example of what you're trying to do?

Maybe a template method involving something like
HTML::Mason is what you are looking for?

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Mon, 07 Aug 2000 14:16:35 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: combinations - a better way to do this?
Message-Id: <7xzj5.13182$f_5.65537@news1.rdc1.ct.home.com>

Chris W. <crasssh@my-deja.com> writes:

> This is the first time I've used Perl for anything where I care
> about speed and efficiency.

Before anyone else says 'well don't use Perl then', this looks more
like a question of finding a good algorithm, not micro-optimization.
So perhaps you can get decent performance in Perl. Whether what you
end up with is decent is of course subjective. :-)

> The analysis *will* be slow and so I want to run it as few times as
> possible.  Within the set of individuals, some are 'equivalent'  -
> ie running the analysis with one missing would be the same as
> running with the other missing, so I want to run only once.

Maybe you could hash on the data then analyze unique sets from
there --

> my @classes = ('1','1','2','2','2','3');
> my @data = ('--','--','--','--','--','--');

-- I don't particularly like paralell data structures like this (the
organization is in your head, not in the code), so I would do:

    # can't make several keys with the same name in a hash
    my @classes = ( [1 => '--'], [1 => '--'], [2 => '--'],
                    [2 => '--'], [2 => '--'], [3 => '--'],);
    foreach (@classes) { push @{$data{$$_[1]}}, $$_[0]; };

 ...and then you take the combinations in `keys %data' and produce
output for each pair in the combinations of classes associated with
one datum with and the other. In this case, you just have

    '--' => [1,1,2,2,2,3]

But of course if you add distinct values they will be added to the
hash and you'll have some actual combinations to work with. only one
value will have to be condsidered a special case where you compare it
against itself, i suppose (depends on what you want).

> @{ $combinations[1] } = (0, 1,
>                          0, 2,
>                          1, 2)

> &proc([], (0..$#data));

These just bother me. I would have

    # this looked prettier as combinations(keys %classes), oh well
    combinations(map {$$_[0]} @classes)

return

    ([0,1], [0,2], [1,2])

 . It's mostly the `proc' one: there's no indication in the call of (a)
what it does (b) where the input comes from (c) where the output goes.

And then there's:

> for my $combcounter (1 .. $max_missing) {
>   &newoutput($combcounter, @{ $combinations[$combcounter-1] } );

Using indices like this is more of a C idiom.

    foreach my $combref (@combos) {
        newoutput($combref);

Just make sure that newoutput now understands that it's getting an
array ref, (and think about renaming it). It can figure out the number
of elements in the ref'd array from there.

Be warned that I really don't know what all this *means*, so I could
easily be misunderstanding what you're trying to accomplish.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Mon, 07 Aug 2000 12:54:23 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: convert string from uppercase to lower case
Message-Id: <3997afd0.63438985@news.newsguy.com>

jason <elephant@squirrelgroup.com> wrote:

>to get all those vowels .. plus the original vowels you want something 
>like this
>
>  tr/aeiou\340-\366\370-\377/AEIOU\300-\326\330-\337/;
>
>depending on what ñ and ð etc. mean you will probably want to reduce 
>that set even further

Well, ç, ñ, ð, and þ aren't vowels, but if you're dealing with
Welsh or Hmong, w is.  And of course there's y, which you've
already mentioned.  But this is getting silly -- no doubt
because the original question was silly.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: 7 Aug 2000 10:52:20 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: DBI/Oracle: Retrieving lowercase field names from Oracle using fetchrow_hashref
Message-Id: <8mmif4$og5$1@grolsch.cse.psu.edu>

Re-read the DBI pod, specifically fetchrow_hashref section.
John
groenveld@acm.org


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

Date: 07 Aug 2000 09:09:03 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Dreaded 500 message
Message-Id: <701E665B4152E472.B81281FC81B0C584.121ADDB74D91BD9C@lp.airnews.net>

David Somner <dave@htxtech.com> writes:

> Hello!
> 
> I am getting the 500 Server Error message.
> I am using Win95 and Win98 (two different platforms)
> I have updated to latest DCOM 1.3 from Microsoft
> I have installed the Microsoft Installer
> I have installed ActivePerl
> I have MS Personal Web Server 1.x installed
> I have /cgi-bin on c:\cgi-bin and virtualized to http://myspot/cgi-bin
> I have /datadir on c:\datadir and virtualized to http://myspot/datadir
> I have /cgi-bin set to execute, no read
> I have /datadir set to read, no execute
> I have a .htm file in my WWWROOT directory to test the .CGI script out
> I have made the registry changes for .pl, .plx and .cgi files
> 
> I can run perl from a command prompt and get the correct output from the
> .CGI files
> When I run a .CGI file in a web browser, I get the 500 Server Error
> message

Perhaps you should ask your question in comp.infosystems.www.authoring.cgi
where the real experts on cgi exist.  You will probably get a better, more
informed response there.

Kent
-- 
"I can't get over the fact that Hillary Clinton's greatest public feat
was to help her husband lie to the rest of us." 

--Historian, and Ms. Rodham-Clinton's biographer, Joyce Milton.


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

Date: Mon, 07 Aug 2000 13:21:57 GMT
From: haaaajo@removethis.dds.nl (Chest Rockwell)
Subject: Re: dropping space from begginning & end of a string
Message-Id: <398eb7d4.596785093@news.wirehub.nl>

On Mon, 7 Aug 2000 13:18:14 +0100, Mark Worsdall
<linux@worsdall.demon.co.uk> wrote:

>Hi,
>
>I have this string:-
>
>my $string = ' hello todays world ';
>
>How could I drop the space from the beginning and the end?

Use the trim function

Cheers, Chest


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

Date: Mon, 07 Aug 2000 13:44:52 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: dropping space from begginning & end of a string
Message-Id: <399ebd1a.66841826@news.newsguy.com>

haaaajo@removethis.dds.nl (Chest Rockwell) wrote:
>Mark Worsdall <linux@worsdall.demon.co.uk> wrote:

>>How could I drop the space from the beginning and the end?
>
>Use the trim function

Of course you'll have to write a trim() function first.
See the FAQ for some ideas.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 07 Aug 2000 09:44:39 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: five lines of NQL or 45 lines of Perl  hmmmm......
Message-Id: <398ECB57.E83F5D6@rac.ray.com>

Gwyn Judd wrote:
> 
> You guys are weird
> 
Not me, I'm wired.
-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Mon, 07 Aug 2000 14:09:30 GMT
From: Fred Docouto <docouto@my-deja.com>
Subject: get method in a html form ???
Message-Id: <8mmfum$1vi$1@nnrp1.deja.com>

Hello,

I need to know if the length of the query
is limited in the get method in a htlm form ?

thank you

Fred


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 07 Aug 2000 09:13:23 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Help with Apache & Perl
Message-Id: <3605DD8098EE4872.92F7787E2BC82848.217915A06D502855@lp.airnews.net>

efflandt@xnet.com (David Efflandt) writes:

> On 04 Aug 2000 18:08:40 -0500, Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >>> On Fri, 4 Aug 2000 17:48:02 -0500,
> >>> "Ryan Blundon" <rblundon@ameritech.net> said:
> >
> >> Help please!  I have a web server running Apache on
> >> Solaris.
> >
> >> I need to be able to pass the user name from Apache
> >> authentication to my Perl cgi script.
> >
> >    use CGI ':standard';
> >    my $realm_name = remote_name();
> >
> >"perldoc CGI"
> >
> >(I assume you're talking about basic authentication.)
> 
> And of course for that to work (or #ENV{REMOTE_NAME}) the CGI has to be in
> a directory using the same authentication.

And, of course, this should be asked in comp.infosystems.www.authoring.cgi
instead of here.

Kent
-- 
You think your Commodore 64 is really neato
What kinda chip you got in there, a Dorito?
Weird Al -- All about the Pentiums


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

Date: 07 Aug 2000 08:20:16 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help!! Need to find user name
Message-Id: <878zu9gqcv.fsf@limey.hpcc.uh.edu>

>> On Mon, 07 Aug 2000 12:54:23 GMT,
>> jennlee_2@my-deja.com said:

> Hi, We just switched our Netscape web server to Novell
> and use the NDS for authentication.  I have a Perl
> script called by submitting an HTML form, where I need
> to know the username of the person who envokes it.

> No environmental variable contains this username (I
> dumped them all out to check for sure) and I am not sure
> how to find it.

> Can anyone assist with how to find the username?

Which username are you interested in?  My local login
session and a name I enter for the web are likely to be
completely different.

If it's a Basic realm then you can do

    use CGI ':standard';
    my $name = remote_name();

but it looks like it is something else because you said
the name wasn't set in the environment.

Can you be more specific?  If this is about CGI you might
try posting to comp.infosystems.www.authoring.cgi instead,
where it would be more on topic.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Mon, 07 Aug 2000 12:41:27 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Impossible RegEx Problem
Message-Id: <3995ad7f.62845329@news.newsguy.com>

"Earthlink News" <rickysregistration@hotmail.com> wrote:

>E.g., I have a hash
>called %hrdiagram; one of the parameters we'd specify ahead of time might be
>solar mass so then you'd have $hr{'mass'} = '1.4'.  Now if we wanted to
>specify luminosity later on (and we're already using $luminosity elsewhere),
>I can just say $hr{$p} where $p == 'luminosity' and $$p (same as
>$luminosity, used elsewhere in the programs) is its value; so to set the
>luminosity all I have to do is $hr{$p} = $$p (and the config file would have
>the entry for luminosity: of course).

If you're using a hash anyway, then why not use $hr{$p} instead
of $$p?  Or if you need two copies of the data for some reason,
use $hr2{$p} instead of $$p.  There doesn't seem to be any
reason to have the symbolic references.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 07 Aug 2000 10:19:21 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: Memory leak in perl code
Message-Id: <398ec592$0$48168$44a10c7e@news.net-link.net>

Greg Roberts wrote:
> 
> Hi. I've recently written a perl script that has an infinite loop inside
> which constantly checks a directory for any new files. What I've
> noticed, with using top, is that the script's memory usage grows at a
> rapid rate until it dies from taking up too much system memory. The loop
> looks something like this:
> 

The other suggestions in this thread are certainly worthy of
consideration, but you might want to take a different approach. You can
use 'cron' or 'at' on most Unix-like systems to schedule a job to run as
frequently as once a minute, which ought to be enough for most purposes.
Then you can remove the loop entirely. On Windows, look into the
scheduler (and I think there are even a few cron replacements out
there).

My thinking is that if you don't need to accumulate information while
this code runs, but just need to periodically process the directory,
you're needlessly occupying memory and CPU cycles during the vast
majority of the time when there's nothing to do.


-- 
Jeff Boes        |The number of computer scientists in
|jboes@eoexchange.com
Sr. S/W Engineer |a room is inversely proportional to  |616-381-9889 ext
18
Change Technology|the number of bugs in their code.    |616-381-4823 fax
EoExchange, Inc. |                                    
|www.eoexchange.com


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

Date: Mon, 07 Aug 2000 13:29:16 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: Need faster metasearch
Message-Id: <MQyj5.89$DT4.2827615@nnrp2.clara.net>

In article <8ml3ar$3ce$1@nnrp1.deja.com>, joekind@my-deja.com wrote:
>Hi.  I made a metasearch script which searches 7 engines and I was
>wondering how I could speed it up.  Should I use forking or
>multithreading or something else.  I would really appreciate it if you
>could supply me with some example code so I will be able to completely
>understand.  Thanks in advanced.

Take a moment to read what you asked. Now think about it as though that is 
all you know. Then please try to understand that it is difficult to give you 
an 'answer' or example code because I (we) have no idea what you're doing. 

I mean yes, the general idea is there, you'll be using some socket code, 
you'll be using HTTP but the specifics aren't given, so its difficult. You 
might find that no matter what you do, you can't get more data over your 
network connection, in which case you have to optomise what you can; can you 
request the search return a text version rather than including all the HTML 
tags, for instance. Likewise, if your problem is that you're doing something 
hugely complex on an old computer, then you could speed up your program by 
making the connections in series, rather than in parallel, so you're only 
processing one bit of data at a time.

Given that you're *probably* on an "average system", then you could apply 
some of the things that you suggested, getting your program to fork so it 
can retreive and process the data from several sites in parallel.

Can you use tr// instead of s///, can you use /o in your regexp matches/sars 
to get the pattern compiled just once. Can you do without your groupings, 
or are you using $`, $&, $' ? Is it faster if you pre-extend arrays, are you 
writing to files when you could just eat lots of memory instead. Do you 
get a faster response by turning off buffering on your sockets and 
filehandles, or is it better when you let the OS handle it? Can your 
definition of 'faster' translate to 'If I send something to the user, 
they can be reading it whilst I'm processing the rest' ? Can you speed up 
subsequent results by implementing caching on your end? (Or could just just 
make a single connection to www.metacrawler.com and let it do the searches 
for you? :) 

If you're after forking examples have a look at perlipc and most of the perl 
books will have something about it. (Though someone down the other end of 
hte office just nicked them and I'm too lazy to walk down just to get you a 
chapter reference:) Incidently, your OS will need to support fork() (win32 
emulates it, I think??) and threads are still new. (Did they get merged into 
the main 5.6 distribution? Gee, I'm so lax today I don't know noffin :)

The other place to look of course is the "Benchmark" module. Start testing 
fragments of your code to see whether the changes you make improve the 
speed. On a similar note, are you doing it all by handle or using modules? 
In most cases, modules have been optimised by a varity of people across the 
Internet who all look at it in different ways. Of course, sometimes they're 
too much for what you want, and you can streamline your programs by 
implementing more specific algorithms for storing/sorting. (Mastering 
Alogrithms in Perl - O'Reilly)

Hopefully some places to start looking... 

Col. 


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Mon, 07 Aug 2000 15:01:59 GMT
From: sjs@yorku.ca ()
Subject: Re: Need help fixing a PerlShop problem
Message-Id: <slrn8otjqd.2hn.sjs@john.sympatico.ca>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On Sun, 06 Aug 2000 13:31:02 GMT Colin Keith wrote:

>> It opens files for reading without < and commits no end of CGI sins.

>Not using '<' is not in itself bad unless the filename is being supplied
>from untrusted user input.
      ^^^^^^^^^^^^^^^^^^^^

Isn't that a redundancy?  :-) I certainly don't make any assumptions 
about user input except that any of my users could be easily persuaded 
to enter 'rm -rf / |' into any field or entrypoint, anywhere, anytime.

Steve


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

Date: Mon, 07 Aug 2000 14:15:57 GMT
From: tbalazs-this-must-go@netcomuk.co.uk (Tony Balazs)
Subject: Newbie: Regular Expression
Message-Id: <398ec3a2.4488726@1.0.0.119>

$_ = "Tony and Wendy";
my $count = tr/a-zA-Z0-9//;
print ($count);
print ("\n");
exit;

gives "12"
Why does

my $count = tr/a-zA-Z0-9\s//;

not give "14"?
(I want to count the spaces as well as the printing characters).

Thanks,
Tony.


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

Date: Mon, 07 Aug 2000 14:55:12 GMT
From: "Bill Curtis" <wcurtis@tstar.net>
Subject: Re: Newbie: Regular Expression
Message-Id: <k5Aj5.447254$MB.6722637@news6.giganews.com>




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

Date: Mon, 7 Aug 2000 09:55:15 -0500
From: "Bill Curtis" <wcurtis@tstar.net>
Subject: Re: Newbie: Regular Expression
Message-Id: <m5Aj5.447255$MB.6722637@news6.giganews.com>

Tony,

You left a blank out of the string

     my $count = tr/a-zA-Z0-9//;
try

    my $count = tr/ a-zA-Z0-9//;

Bill
Tony Balazs <tbalazs-this-must-go@netcomuk.co.uk> wrote in message
news:398ec3a2.4488726@1.0.0.119...
> $_ = "Tony and Wendy";
> my $count = tr/a-zA-Z0-9//;
> print ($count);
> print ("\n");
> exit;
>
> gives "12"
> Why does
>
> my $count = tr/a-zA-Z0-9\s//;
>
> not give "14"?
> (I want to count the spaces as well as the printing characters).
>
> Thanks,
> Tony.




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

Date: Mon, 07 Aug 2000 13:23:34 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: OT: find the number of characters in a string
Message-Id: <399bb7d8.65495350@news.newsguy.com>

tim@degree.ath.cx (Tim Hammerquist) wrote:

>I think the greatest achievement in this thread was his ability to admit
>he was wrong and correct himself without bringing anyone down with him.
>Everyone's allowed to make mistakes; its how someone deals with his own
>mistakes that shows his character.

Except that Jim wasn't wrong initially.  His mistake was to lose
confidence in his initial answer (which was right) and change it
to another (which was also right, but longer).

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 07 Aug 2000 13:23:03 GMT
From: cardwellm@my-deja.com
Subject: perl job newsgroup
Message-Id: <8mmd7j$vng$1@nnrp1.deja.com>

I need a perl script done by a programmer, in what newsgroup would it be
appropriate to post my offer?

Thanks


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 07 Aug 2000 22:52:54 +0800
From: Mark <mark325@hotmail.com>
Subject: Please help me!
Message-Id: <398ECD46.30A7A4F4@hotmail.com>

Hi all,

I have below code segment:
-----------------------
$var1 = 0;
$i=1;

$test = "\$var" . "$i";
-----------------------

if i use:
print "$var1";
the output should be: 0

if i use:
print "$test";
the output should be: $var1

but if i use:
print "$test";
and i want the output should be: 0
(it means that the $test should contain the value of $var1)
does anyone know how to implement it?

thanks a lot!

Mark ~



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

Date: Mon, 07 Aug 2000 14:15:06 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Reg Expression Question
Message-Id: <398EC3E6.284ACEB9@netstorm.net>

tony_123@my-deja.com wrote:
> 
> [grover]=?iso-2022-jp?B?EndodedMessage1?=
>         =?iso-2022-jp?B?EncodedMessage2=?=
> 
> What I want to do is to rip out the parts

perldoc perlop

and look for m/PATTERN/cgimosx

First my assumptions about what you mean:

1)  There is a typo above and both of the substrings you want are
formatted _exactly_ the same way as below:

=?iso-2022-jp?B?EndodedMessage1?=
=?iso-2022-jp?B?EncodedMessage2?=		# same as previous format

=?iso-2022-jp?B?EncodedMessage2=?=		# no
                               ^
2)  Both desired fields are contained in a single string with a newline
embedded in it like this:

$_ = '[grover]=?iso-2022-jp?B?EndodedMessage1?=
        =?iso-2022-jp?B?EncodedMessage2?=';

Then this should do the trick:
@q = /.*?(=.*?=).*?/gs;

@q not contains the parts you want as separate array elements.  Read the
docs and try to work out the rest for yourself.

- Jim


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

Date: Mon, 07 Aug 2000 14:17:33 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Reg Expression Question
Message-Id: <398EC47A.2CCB0318@netstorm.net>

I wrote:
> 
<snip>
> 
> @q not contains ... 
       ^
correction:  @q now contains ...

- Jim


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

Date: Mon, 7 Aug 2000 23:19:02 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: reg expressions - protect html
Message-Id: <u7zj5.6$Fn1.1359@vic.nntp.telstra.net>

"Godzilla!" <callgirl@la.znet.com> wrote in message
news:398BCAB5.5BF92395@la.znet.com...
> "Godzilla!" wrote:
>
> etc....
>
> > > > Ðo it Godzilla §chizo §tyle!
>
> Spotted a bug for you. Look close at each
> word beginning with an 'H' at the beginning
> of a new line. Should be an "X" there.

Try this, lots less hopping around arrays, and it doesn't matter how many
tags are within the <HTML> sections.  Also nothing to 'do and then undo'.

#!/usr/bin/perl -w
use strict;
#Usage : perl test.pl path/filetoreadandconvert path/convertedfiletowrite

my $infile = shift;
my $outfile = shift;

my (%kewl) = ('A'=>'Å', 'B'=>'ß', 'C'=>'Ç', 'D'=>'Ð', 'L'=>'£',
'N'=>'Ñ', 'O'=>'Ö', 'S'=>'§', 'H'=>'X');  #insert the appropriate matching
pairs

my $input;
open (IN, "$infile") or die "Unable to open file $infile $!\n";
{
 local undef $/;
 $input = <IN>;
}

my @chars = split (//,$input);
my $flag = '0';

for(@chars){
 $flag = 0 if /</;
 $flag = 1 if />/;
 if ($flag == 1){
  if ($kewl{$_}){
   s/$_/$kewl{$_}/i;
  }
 }
}

my $output = join ('',@chars);
open (OUT, ">$outfile") or die "Unable to create file $outfile $!\n";
print OUT $output;

exit;

Wyzelli




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

Date: Mon, 07 Aug 2000 13:40:42 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: Regexp problem - Stripping HTML
Message-Id: <u%yj5.90$DT4.2828254@nnrp2.clara.net>

In article <398E7051.61D3532E@ed.ac.uk>, Ian Stuart <ian.stuart@ed.ac.uk> wrote:
>Posted and mailed, as Eli says...
>
>mbutt@my-deja.com wrote:
>> 
>> I am trying to construct a regular expression to strip certain HTML tags
>> out of a string.
>Off the top of my head....
>
>I think.....

Now, who's going to flame first?
 Those who advocate using modules unless you can do it better,
 or those who advocate using your own code because they believe modules to 
be slow, bloated, etc. 

Tis a tough fight. 
My opinion is you're about right, but you're also assuming that things are 
uniform and regular and... 

So, OP, go for it, but if you do encounter problems, go immediately to CPAN, 
do not pass Go but *do* collect the HTML/XML parsing modules and see if that 
handles the cases where you're having problems.


>PS - ow! my brain hurts.. ;-)

Of course! Given your posting address and the time of posting, its called a 
hang over.. :-) :-)

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: 7 Aug 2000 10:55:33 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Retrieving BLOBs from Oracle using DBI
Message-Id: <8mmil5$ogr$1@grolsch.cse.psu.edu>

In article <8mc61t$vmk$1@nnrp1.deja.com>,  <boggsy@my-deja.com> wrote:
>	while ($blob = $stmt->fetchrow)

Where's your error handling for the fetchrow? Why not just turn
RaiseError on?
John
groenveld@acm.org


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

Date: Mon, 07 Aug 2000 13:15:16 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Retrieving data from dynamically created page
Message-Id: <3998b3ad.64427660@news.newsguy.com>

paul5544@my-deja.com wrote:

>while (<EMAILFILE>)
>{
>$line = $_;
>chop($line);
>($currentemail, $currentuser_name, $status) = split (/\|/, $line);

Some minor points:  You're not using $_, so there's no point in
having two copies of the line.  (By the way, it's good that
you're reading the file a line at a time rather than pointlessly
reading it into an array and processing the array an element at
a time.)  Either use

    while (my $line = <EMAILFILE>) {

and get rid of $_, or (more Perlishly) use $_ through and get
rid of $line.

>if ($currentemail ne "")
>{
> if ($currentemail eq "Do Not Remove This Line")
>  {
>  #Do Nothing, skip
>  }
>  else
>  {

To avoid indenting your loop multiple times, you can change the
above lines to

    next if $currentemail eq '' or
        $currentemail eq 'Do Not Remove This Line';

Then put the end-of-loop print in a continue block.

>  print "<tr>\n";
>  print "<td>\n";
>  print "            <p><select name=\"delete\" size=\"1\">\n";
>  print "                <option value=\"no\">No</option>\n";
>  print "                <option value=\"yes\">Yes</option>\n";
>  print "            </select>Delete This Entry?</p>\n";
>  print "</td>\n";
>  print "<td>\n";
>  print "" . $currentemail . "\n";
>  print "<input type=\"hidden\" name=\"emailrecord\" value=\"" .
>$currentemail . "\">\n";
>  print "</td>\n";
>  print "<td>\n";
>  print "" . $currentuser_name . "\n";
>  print "<input type=\"hidden\" name=\"userrecord\" value=\"" .
>$currentuser_name . "\">\n";
>  print "<td>\n";
>  print "            <p><select name=\"subscribe\" size=\"1\">\n";

This would be much clearer with a here-document.  You wouldn't
have the multiple print()s or the backslashed double quotes.

[snip]

>This works great. It builds the page perfectly.
>However, now I am trying to update the file it read from when the user
>changes something and clicks on the appropriate button.
>I know how to get the values and assign them to a variable, the problem
>I am having is that each entry built is assigned the same field names
>so when I parse the form, the variables are getting overwritten by the
>next set of values read from the page.

Sounds like you're not using CGI.pm.  The additional values
would all be there if you were using CGI.pm.  Of course, you
still might have trouble telling which goes with which row, so
you might want to use different names on each row (delete1,
emailrecord1, userrecord1, subscribe1, delete2, emailrecord2,
userrecord2, subscribe2, etc.).

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Mon, 7 Aug 2000 08:24:38 -0700
From: "http://daverwin.homepage.com" <daverwin@hotmail.com>
Subject: Re: sending javascript value to CGI
Message-Id: <QMyj5.296$044.155515@nnrp1.sbc.net>


Kris Gonzalez wrote in message <398E3C1D.502AC725@softhome.net>...
>Is there a way to submit a javascript value to a CGI and continue
>running scripts on the page?

if (is.ns)document.layers['id'].load(url)
 else if (is.ie) parent.bufferFrame.document.location = url

the iframe and layer must already exist
and be hidden
url is url of your cgi





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

Date: Mon, 07 Aug 2000 13:42:53 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: sending javascript value to CGI
Message-Id: <x1zj5.91$DT4.2828318@nnrp2.clara.net>

In article <398E3C1D.502AC725@softhome.net>, Kris Gonzalez <jimjamjoh@softhome.net> wrote:
>Is there a way to submit a javascript value to a CGI and continue
>running scripts on the page? 

open a new window with the href of a CGI script passing the unique ID you've 
assigned to this connection. But there isn't anything about Perl in 
this question since CGI scripts can be written in anything, they don't have 
to be Perl. ..

Col


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: Mon, 07 Aug 2000 14:20:19 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: totally newbie to perl, I ...
Message-Id: <DAzj5.13183$f_5.65537@news1.rdc1.ct.home.com>

ken <kensplace@comport.com> writes:

> seb wrote in message <8mlra9$4rs$1@buty.wanadoo.nl>...
> 
> >totally newbie to perl, I would like 2 know what do I need to run my first
> >perl script
> 
> If running locally, on w9x then you need a web server of some kind,

Please stop giving out misinformation.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Mon, 07 Aug 2000 14:41:56 GMT
From: Kostis <ke77le@my-deja.com>
Subject: use in subroutines
Message-Id: <8mmhrk$3d7$1@nnrp1.deja.com>

Hi.

Does anyone know, if:

#!/usr/bin/perl
use SomeModule;

for (0..10) {
   &subThatUses_SomeModule($_);
}

sub subThatUses_SomeModule {
# some code
   return $something;
}


Is likely to be faster than:
#!/usr/bin/perl

for (0..10) {
   &subThatUses_SomeModule($_);
}

sub subThatUses_SomeModule {
   use SomeModule;
# some code
   return $something;
}

Or do 'use' directives only get processed at 'compile' time irrespective
of where they appear?

Thanks,
Kostis


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 07 Aug 2000 14:45:48 GMT
From: "Bill Curtis" <wcurtis@tstar.net>
Subject: Windows Perl 5.6 Debugger pager question
Message-Id: <wYzj5.216983$t91.1950428@news4.giganews.com>



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

Date: Mon, 7 Aug 2000 09:45:53 -0500
From: "Bill Curtis" <wcurtis@tstar.net>
Subject: Windows Perl 5.6 Debugger pager question
Message-Id: <xYzj5.216984$t91.1950428@news4.giganews.com>

Trying to use the debugger to display variables is frustrating.

 If I use the "V" command, the data scrolls off the DOS screen.

  Can't seem to get a handle on how to use a "pager" (as in the UNIX
version), as the documentation suggests that would allow me to use view one
page at a time.

Any help?

Bill

"Always take time to stop and smell the roses...  and sooner or later,
you'll inhale a bee." - A Cynics Guide To Life




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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3935
**************************************


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