[10911] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4512 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 29 13:07:28 1998

Date: Tue, 29 Dec 98 10:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Dec 1998     Volume: 8 Number: 4512

Today's topics:
    Re: Adding a path to the @INC variable (Tad McClellan)
        changing directories <peter.herger@swisslife.ch>
    Re: changing directories (Clay Irving)
        Decrypting perl programs (Filter module) tobi@xgm.de
    Re: Delimeters in Data <tchrist@mox.perl.com>
    Re: Delimeters in Data (Bart Lateur)
    Re: Delimeters in Data (Abigail)
    Re: EXPERIENCED IN PERL ? (brian d foy)
        Flaw in POSIX::mktime  <ak@muc.de>
        how to debug perl programs? vivekvp@hotmail.com
    Re: How to Display multiple image files into HTML templ <shadow01@shaw.wave.ca>
    Re: Install fails under RH5.2 <dgris@moiraine.dimensional.com>
    Re: Is Perl as multifunctional as I've heard\read? (Cameron Laird)
    Re: Listing files <remio@dmi.net>
        Making an include using CGI.pm module <shadow01@shaw.wave.ca>
    Re: Making an include using CGI.pm module (brian d foy)
    Re: net::time question dave@mag-sol.com
        Newbie help on make <biela@netdienste.de>
    Re: Protecting my script from form data (Randal L. Schwartz)
    Re: Redirecting Output of 'system' (Tad McClellan)
    Re: Regex question - removing HTML tags.... (Tad McClellan)
    Re: Regex question - removing HTML tags.... (Abigail)
    Re: Regex question - removing HTML tags.... (Abigail)
        REPLACE THE CONTENT OF AN ARRAY OF HASHES... <vpedrosa@ccg.uc.pt>
    Re: REPLACE THE CONTENT OF AN ARRAY OF HASHES... (Bart Lateur)
    Re: REPLACE THE CONTENT OF AN ARRAY OF HASHES... (Mark-Jason Dominus)
        Script for inserting HTML abbrevations (Kjetil Kjernsmo)
        Searching for Text <rbruno@blue-pumpkin.com>
        security: how to force a real UID? <catherine.beloin@alcatel.fr>
    Re: security: how to force a real UID? (Mark-Jason Dominus)
        Solution (?) to NT-Perl problem <tech@aba-architects.com>
        SORTING AN ARRAY OF HASHES... <vpedrosa@ccg.uc.pt>
    Re: SORTING AN ARRAY OF HASHES... (Mark-Jason Dominus)
    Re: When hashing won't work... (Michael Rubenstein)
    Re: When hashing won't work... (Tad McClellan)
    Re: When hashing won't work... dave@mag-sol.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 29 Dec 1998 09:11:40 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Adding a path to the @INC variable
Message-Id: <cfra67.i4u.ln@magna.metronet.com>

Al in Seattle (alber@seanet.com) wrote:
: Interesting answer. I also find (and I'm no expert so bear with me), that
: the Perl by Example book, on page 213 seems to show that you can also use
: the -I switch at the command line, or set the PERL5LIB environmental
: variable to the full pathname. Does this also seem correct? (By the way,
: Perl by example seems to be a very good book. It is a bit more of  a Unix OS
: oriented book, but I am also learning some new stuff for NT from it).


   What happened when you tried it?

   You could probably have tried both alternatives in less time
   than it took you to type up your Usenet post...


: Jonathan Stowe wrote in message <769hdk$2in$1@gellyfish.btinternet.com>...

: >           use lib LIST;


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


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

Date: Tue, 29 Dec 1998 16:31:07 +0100
From: Herger Peter <peter.herger@swisslife.ch>
Subject: changing directories
Message-Id: <3688F5BB.20431C20@swisslife.ch>

Hi all
How can I create a directory, which always change its name like this:

I'm going to save my config files in a daily createt directory. The name
of the directory is its creation-date. My script looks like this:

use Net::FTP;
$date     = `date '+%m%d%n'`;
$storedir = `date '+%m%d%n'`;

`mkdir /usr/net/routers/rtconfigs/$storedir`;

$dir      = "1:";
$host     = "wfhgtv1";

$ftp = Net::FTP->new($host, Timeout => 60) ||
    die "Cannot connect: $host";

$ftp->login("UserName", "Password") || die "Login failed";

$ftp->cwd($dir) || die "Directory $dir doesn't exist";
$ftp->binary();
$ftp->get("config" ,
"/usr/net/routers/rtconfigs/$storedir/confhgtv1.$date");

$ftp->quit();

Why can't I specify the path to get the file with the Variable
$storedir? This is the directoryname which changes every day.

Thanks a lot

Peter Herger




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

Date: 29 Dec 1998 11:04:07 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: changing directories
Message-Id: <76auhn$fhg@panix.com>

In <3688F5BB.20431C20@swisslife.ch> Herger Peter <peter.herger@swisslife.ch> writes:

>Hi all
>How can I create a directory, which always change its name like this:

>I'm going to save my config files in a daily createt directory. The name
>of the directory is its creation-date. My script looks like this:

>use Net::FTP;

This is a problem:

>$date     = `date '+%m%d%n'`;
>$storedir = `date '+%m%d%n'`;

Try a test:

    !/usr/local/bin/perl -w

    $storedir = `date '+%m%d%n'`;

    print "$storedir\n";

This is what I get:

    $ ./foo.pl | od -c
    0000000   1   2   2   9  \n  \n  \n
    0000007

I don't suppose you really want those extra newlines.

You create the directory on the local system:

>`mkdir /usr/net/routers/rtconfigs/$storedir`;

>$dir      = "1:";
>$host     = "wfhgtv1";

You FTP to a, presumably, remote host:

>$ftp = Net::FTP->new($host, Timeout => 60) ||
>    die "Cannot connect: $host";

>$ftp->login("UserName", "Password") || die "Login failed";

You change directory to '1:'. 

>$ftp->cwd($dir) || die "Directory $dir doesn't exist";
>$ftp->binary();

You get a remote file called 'config' and store it in a local
file:

>$ftp->get("config" ,
>"/usr/net/routers/rtconfigs/$storedir/confhgtv1.$date");

>$ftp->quit();

This statement doesn't make sense:

>Why can't I specify the path to get the file with the Variable
>$storedir? This is the directoryname which changes every day.

You created the directory on the local system, but you try to
get the file from a remote system.

-- 
Clay Irving
clay@panix.com


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

Date: Tue, 29 Dec 1998 15:25:01 GMT
From: tobi@xgm.de
Subject: Decrypting perl programs (Filter module)
Message-Id: <76as8c$o0c$1@nnrp1.dejanews.com>

Hi,

is there a way to de-crypt perl programs, encrypted with
the "Source Filter" module (Filter-1.14.tar) by Paul Marquess?
This library can be obtained through CPAN, the address is
   http://www.cpan.org/authors/Paul_Marquess/Filter-1.14.tar.gz
It looks like a real challenge...

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


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

Date: 29 Dec 1998 15:25:42 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Delimeters in Data
Message-Id: <76as9m$9m3$1@csnews.cs.colorado.edu>


In comp.lang.perl.misc, "D.C.Karthikeyan" <ckdasari@cs.hku.hk> writes:
:I am trying to join and split a list using a colon as a delimeter. 

My deli meter says 2 pounds, 4 ounces.  What this is going to do
to your colon I can only imagine.

--tom
-- 
    ": fighting for peace is like fucking for virginity (ado@bigcomm.gun.de)
    Yes, but I did manage to increase the amount of virginity in the world
    by that method." --Larry Wall


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

Date: Tue, 29 Dec 1998 15:37:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Delimeters in Data
Message-Id: <3688f681.21751837@news.skynet.be>

D.C.Karthikeyan wrote:

>BUT this one does not. 
>
>$test = join (":", "Te:st", "Fine");
>@test = split (":", $test);
>
>This is because the delimeter is part of the actual data.

Then don't use colons as the delimiter. Or don't allow colons in your
data. Or convert colons to something unique and harmless, and convert it
back after splitting.

	Bart.


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

Date: 29 Dec 1998 17:17:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Delimeters in Data
Message-Id: <76b2rt$3hc$1@client3.news.psi.net>

D.C.Karthikeyan (ckdasari@cs.hku.hk) wrote on MCMXLVI September MCMXCIII
in <URL:news:Pine.GSO.4.03.9812292229460.21684-100000@virtue.csis.hku.hk>:
++ Hi,
++ 
++ I am trying to join and split a list using a colon as a delimeter. The
++ problem comes when the actual list contains a colon. For instance:
++ 
++ This one works fine:
++ 
++ $test = join (":", "Test", "Fine");
++ @test = split (":", $test);
++ 
++ BUT this one does not. 
++ 
++ $test = join (":", "Te:st", "Fine");
++ @test = split (":", $test);
++ 



$test = join ":", map {local $_ = $_; s/([:;])/;$1/g; $_} "Te:st", "Fine";   
@test = map {local $_ = $_; s/;([:;])/$1/g; $_} split /(?<!;):/, $test;



Abigail


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

Date: Tue, 29 Dec 1998 10:16:46 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: EXPERIENCED IN PERL ?
Message-Id: <comdog-ya02408000R2912981016460001@news.panix.com>

In article <76ajf2$g5@panix.com>, clay@panix.com (Clay Irving) posted:

> In <36888849.AA5E2A09@earthlink.net> Dawg Master <dawgmaster@earthlink.net> writes:
> 
> >PERL PROGRAMMER
> >Very experienced in Perl and Linux Red Hat. Must be able to create
> >anything we need in Perl, 
> [...]
> 
> Anything? Whew, that's a herculean task!

not to mention he probably wants an email address verifier - a truly
herculean task.

-- 
brian d foy                     <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't.  it doesn't matter either way.


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

Date: 29 Dec 1998 18:27:52 +0100
From: Andi Kleen <ak@muc.de>
Subject: Flaw in POSIX::mktime 
Message-Id: <m3n246504n.fsf@fred.muc.de>


The ANSI C mktime() has a very useful side effect: it corrects the
tm_wday and tm_yday fields in the passed tm structure. You can just
pass in an arbitary date and let mktime calculate the wday/yday for
you. POSIX::mktime as of 5.004_04 does not support that, there is no
way to get at the corrected tm_wday and tm_yday values after the mktime
finished. 

Is there a portable workaround for that?

One obvious extension would be to extend mktime that it returns the
corrected time array in a list context similar to localtime, with the 
time_t value as the last element.    

-Andi


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

Date: Tue, 29 Dec 1998 17:10:01 GMT
From: vivekvp@hotmail.com
Subject: how to debug perl programs?
Message-Id: <76b2d9$tb5$1@nnrp1.dejanews.com>

hi,

this is a newbie question, but i hope someone will help me out.

i have a site hosted on a server.  i upload the scripts from my home computer
and then try to execute them from my server - through my web pages.  of
course i always get the old "internal server error" screen.

1.  can i debug the program fromt he server - it gives very limited error
messages - premature end of script

2.  can i run the perl program from machine at home - and catch errors before
i upload it?  if so, how?

i would like to install perl (however i do that) on my home machine, write
then debug it with a perl debugger, then upload it to my server.  does this
sound right?

if you know how to do this sort of stuff - please email.

Thank you very much!

Victor

--
May your bad hair days be few.  This does not apply to the bald.

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


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

Date: Tue, 29 Dec 1998 15:35:34 GMT
From: "Webmaster" <shadow01@shaw.wave.ca>
Subject: Re: How to Display multiple image files into HTML template with perl
Message-Id: <aF6i2.2473$Hp.3295@news.rdc1.on.home.com>

Thanks you very much for that reply. I have tried your code and it does seem
to work without generating an error however regardless of the value i put in
my command line
http://www.coversarchive.com/cgi-bin/text.pl?url=axample.jpg

the resulting HTML file has only a blank img source code, which means that
the variable "$image" is not being printed.  Can you suggest a remedy for
this problem.

Thank you



Clay Irving wrote in message <76aj6j$t11@panix.com>...
>In <b7_h2.1694$Hp.2880@news.rdc1.on.home.com> "Webmaster"
<shadow01@shaw.wave.ca> writes:
>
>>I have wrote the following code, however it seems to return error 500
>
>>#line that is being executed
>># http://www.coversarchive.com/cgi-bin/test.pl?image=Abba_Gold-Back.jpg
>
>
>>print "Content-type: text/html\n\n";
>>print "<html><head><title>Cover Name</title></head><body>\n";
>>print "<center><img src=\"../audio/$image"\></center><body>\n";
>>print "</body></html>\n";
>
>The CGI module, CGI.pm, *really* is your friend. This works:
>
>    #!/usr/local/bin/perl -w
>
>    use CGI qw(:standard);
>
>    my $image = param('image');
>
>    print header,
>        start_html(-title=>'Image Page', -author=>'clay@panix.com'),
>        img{src=>"$image"},
>    end_html();
>
>--
>Clay Irving
>clay@panix.com




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

Date: 29 Dec 1998 10:26:18 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Install fails under RH5.2
Message-Id: <m3k8zan9l1.fsf@moiraine.dimensional.com>

daniel.mendyke@digital.com (Daniel) writes:

> I'm puzzled at not being able to install
> Perl 5.005.02 under Linux x86 RH5.2 
<snip>

Seeing the actual error text would probably help us
diagnose your problem.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 29 Dec 1998 09:20:17 -0600
From: claird@Starbase.NeoSoft.COM (Cameron Laird)
Subject: Re: Is Perl as multifunctional as I've heard\read?
Message-Id: <76arvh$7r4$1@Starbase.NeoSoft.COM>

In article <39iuf12ur5.fsf@ibnets.com> Uri Guttman <uri@ibnets.com> corrected:
>[posted and mailed]
>
>>>>>> "CL" == Cameron Laird <claird@Starbase.NeoSoft.COM> writes:
>
>  CL> URL:http://www.sunworld.com/sunworldonline/swol-05-1998/swol-05-perl.html
>
>i am looking at the article and immediately noticed some improvements
>that could be made in the first program.
			.
		[nicely expressed
		improvements]
			.
			.
>and when looping over a list, i like foreach rather than for. i reserve
>for for for loops as in c. (3 fors in a row, wanna try for four?)
All true, and inexplicable now, over half a year
later.  Why did I have a "for () {}" immediately
followed by a "foreach () {}"?  I completely
agree that uniform use of the latter is better
style.

In any case, <URL:http://
starbase.neosoft.com/~claird/comp.lang.perl.misc/perl_architectures.html>
now points to your corrections, for which I thank
you.
>
>
>also the formatting got ruined in the html. use <PRE> or something to
>maintain the proper indenting. it looks really poor to see this:
Tell me about it.  I've got more code coming out
in *SunWorld* within a week.  It's likely to be
an adventure.
			.
			.
			.
>finally, you mention in-process scripting without mentioning the fastcgi
>protocol which is a public protocol to speed up cgi programs which
>supports multiple languages. check out www.fastcgi.com for more
>info. perl is prominent in the fastcgi world.
You express yourself moderately.  Yes, Perl in-
deed is prominent in the FastCGI world.

You're right.  The article doesn't mention
FastCGI.  You could get to it eventually if
you followed enough of the links I supplied.
I've changed that, though, so now it's only
one hop away.
			.
			.
			.
Apt points, all around.  Are you available
for reviewing future work?
-- 

Cameron Laird           http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com      +1 281 996 8546 FAX


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

Date: Tue, 29 Dec 1998 08:34:10 -0800
From: Remi Olsen <remio@dmi.net>
To: keydet89@yahoo.com
Subject: Re: Listing files
Message-Id: <36890482.4B4844@dmi.net>

> Here's how I did it using AS Perl build 507 on NT...
> 

Exactely what I was looking for - thanks!

Remi O


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

Date: Tue, 29 Dec 1998 17:11:46 GMT
From: "Webmaster" <shadow01@shaw.wave.ca>
Subject: Making an include using CGI.pm module
Message-Id: <m38i2.2500$Hp.3295@news.rdc1.on.home.com>

I'm trying to have my HTML on the fly generation script to insert the
following line into the code  <!--#include virtual="main.htm" -->.  I have
tried adding an additional line such as

print "<!--#include virtual=\"main.htm\" -->\n";
however i recieved an error.

I have aslo tried inserting this line as a variable,
    my $main = <!--#include virtual="main.htm" -->;
Unfortunately that was wrong too.

I have looked on the CGI.pm webpage however was unbale to find the proper
syntax for this line, could some one please suggest a solution.


Thank you




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

Date: Tue, 29 Dec 1998 12:58:42 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Making an include using CGI.pm module
Message-Id: <comdog-ya02408000R2912981258420001@news.panix.com>

In article <m38i2.2500$Hp.3295@news.rdc1.on.home.com>, "Webmaster" <shadow01@shaw.wave.ca> posted:

> print "<!--#include virtual=\"main.htm\" -->\n";
> however i recieved an error.

it would help if you told us what the error message was.

-- 
brian d foy                     <brianNOSPAM@NOSPAM.smithrenaud.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
remove NOSPAM or don't.  it doesn't matter either way.


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

Date: Tue, 29 Dec 1998 16:44:50 GMT
From: dave@mag-sol.com
Subject: Re: net::time question
Message-Id: <76b0u1$s5d$1@nnrp1.dejanews.com>

[Please don't cc usenet posts to me without mentioning it in the post!]

In article <3688E3E6.D346643F@hotmail.com>,
  Damoi <damoi985@hotmail.com> wrote:
> I am getting nothing at all xcept
> <HTML><BODY><CENTER>
> in my html
>
> > It's much easier to offer assistance if you tell us what you mean by
'without
> > success'. What error messages are you seeing? What isn't happening that you
> > expect to happen (or vice versa)?
>
>

You're not passing the hostname to inet_time.

To pre-empt your next question, inet_time returns the number of seconds since
Jan 1 1970. To turn that into a sensible-looking time, you'll need to pass it
to localtime.

oh... and the stuff that Clay said about using CGI, you should do that too. In
fact your script should look something like:

#!/usr/local/bin/perl -w

use strict;

use Net::Time qw(inet_time);
use CGI qw/:standard/;

my $host = shift || 'localhost';
my $host_time = localtime(inet_time($host));

print header(), "\n";
print start_html('-title'=>'Network time'), "\n";
print p({-align=>'center'}, "time is $host_time"), "\n";
print end_html(), "\n";
exit();

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: Tue, 29 Dec 1998 17:16:21 +0100
From: "Simon Biela" <biela@netdienste.de>
Subject: Newbie help on make
Message-Id: <76av3h$iv5@news.netcologne.de>


Hi,

I try to install some perl modules. I try to run the make command after
running perl Makefile.PL and it says:

Checking if your kit is complete...
Looks good
Writing Makefile for .... (whatever)
==> Your Makefile has been rebuilt. <==
==> PLease rerun the make command. <==
false
make: *** [Makefile] Error 1

What did I do wrong ?

Thanks
  Simon














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

Date: 29 Dec 1998 07:29:49 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Protecting my script from form data
Message-Id: <m1k8zb2cgi.fsf@halfdome.holdit.com>

>>>>> "Jonathan" == Jonathan Stowe <gellyfish@btinternet.com> writes:

Jonathan> Check that external commands are only getting the type of
Jonathan> input that is required i.e. you might consider that an
Jonathan> E-Mail address might match :

Jonathan> /[-\w@.]+/ # That might not be exhaustive

It's clearly not.  <fred&barney@stonehenge.com> is a legal email
address, and you've just ruled it out.  Don't do that.  Don't ignore
the FAQ on this point.  Stop passing around BAD INFORMATION.  <sigh>

Jonathan> You cant do any harm simply manipulating data.

Yes, you can.  You just did.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 29 Dec 1998 09:07:21 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Redirecting Output of 'system'
Message-Id: <97ra67.i4u.ln@magna.metronet.com>

Penn Markham (pmarkham@access.k12.wv.us) wrote:

: 	I am fairly new to Perl, so this is probably a simple problem with a
: simple solution.  


   So this is probably simply solved by looking in the documentation
   that is already installed on your hard drive...


: I am trying to read a line from a password file based
: upon what the user has entered.  I want to do this by using 'system
: "grep..."'
: My problem is that when I try to do this, the output is displayed to the
: terminal instead of being stored in a variable.  Here's how I have it
: set up:

: 	chop($line = system "grep $username passwords";

: How do I direct the output of 'grep' to $line?  I have tried using pipes
: and such, but I get error messages.  Can anyone help me with this one? 


   If you are having a problem with a system() call, then you should
   look up the docs for the system() call (in perlfunc.pod), wherein
   the second paragraph says:

      "This is NOT what you want to use to capture the output from 
       a command, for that you should use merely "

   And continues telling you how to get exactly what you are asking for...



   Learn to use the docs that come with the perl distribution,
   and you will write Perl programs much faster than posting to
   Usenet and waiting hours or days for the answer.


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


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

Date: Tue, 29 Dec 1998 08:55:03 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex question - removing HTML tags....
Message-Id: <7gqa67.i4u.ln@magna.metronet.com>

Gilly (mingtian@hanmail.net) wrote:
: :++ :<!-- So, what - - > about this then? -->
: :++ 
: :++ if both '- - >' and '-->' are valid then which is the closing tag?
: :
: :
: :Neither.

: then it's not a coment :)


   I think the point (who's point was it anyway? Abigail's? You
   should leave in the attribution when quoting someone) was that
   neither '- - >' nor '-->' are tags.

   <!-- this is not a tag either, it is a declaration -->


   The '<!' char sequence is a Markup Declaration Open.


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


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

Date: 29 Dec 1998 16:49:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regex question - removing HTML tags....
Message-Id: <76b177$37a$1@client3.news.psi.net>

Gilly (mingtian@hanmail.net) wrote on MCMXLVI September MCMXCIII in
<URL:news:368ac0ad.1337787@usenet.kornet21.net>:
++ :++ :<!-- So, what - - > about this then? -->
++ :++ 
++ :++ if both '- - >' and '-->' are valid then which is the closing tag?
++ :
++ :
++ :Neither.
++ 
++ then it's not a coment :)


Huh?


Abigail


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

Date: 29 Dec 1998 16:50:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regex question - removing HTML tags....
Message-Id: <76b18i$37a$2@client3.news.psi.net>

Gilly (mingtian@hanmail.net) wrote on MCMXLVI September MCMXCIII in
<URL:news:3688c036.1219019@usenet.kornet21.net>:
++ :<!-- So, what <!-- --> about this then? -->
++ 
++ why do you put -- before --> ? :)


Because it's valid. However, your regex doesn't grok that.



Abigail


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

Date: Tue, 29 Dec 1998 15:53:57 +0000
From: Vitor Varalonga <vpedrosa@ccg.uc.pt>
Subject: REPLACE THE CONTENT OF AN ARRAY OF HASHES...
Message-Id: <3688FB15.BDFD1764@ccg.uc.pt>


--------------57892F4443BEA4A9D015D01E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

    Hi!!!


    OK... Here goes my problem...
    I have an array of hashes and I want to
replace each hash by one of its fields (in
this case, the ID), therefeore I have coded
the following:

for $i (0 .. $#results) {
   $results[$i] = $results[$i]{'ID'};
}

Is there a easier way, in a one line code, to
achieve this?!?


Thanks in advance,

Vitor Pedrosa

--------------57892F4443BEA4A9D015D01E
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>&nbsp;&nbsp;&nbsp; Hi!!!</tt>
<br><tt></tt>&nbsp;<tt></tt>
<p><tt>&nbsp;&nbsp;&nbsp; OK... Here goes my problem...</tt>
<br><tt>&nbsp;&nbsp;&nbsp; I have an array of hashes and I want to</tt>
<br><tt>replace each hash by one of its fields (in</tt>
<br><tt>this case, the ID), therefeore I have coded</tt>
<br><tt>the following:</tt><tt></tt>
<p><tt>for $i (0 .. $#results) {</tt>
<br><tt>&nbsp;&nbsp; $results[$i] = $results[$i]{'ID'};</tt>
<br><tt>}</tt><tt></tt>
<p><tt>Is there a easier way, in a one line code, to</tt>
<br><tt>achieve this?!?</tt>
<br><tt></tt>&nbsp;<tt></tt>
<p><tt>Thanks in advance,</tt><tt></tt>
<p><tt>Vitor Pedrosa</tt></html>

--------------57892F4443BEA4A9D015D01E--



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

Date: Tue, 29 Dec 1998 16:30:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: REPLACE THE CONTENT OF AN ARRAY OF HASHES...
Message-Id: <36890338.213823@news.skynet.be>

Vitor Varalonga wrote:

>for $i (0 .. $#results) {
>   $results[$i] = $results[$i]{'ID'};
>}
>
>Is there a easier way, in a one line code, to
>achieve this?!?

Here's one:

	@results = map { $_->{ID} } @results;

	Bart.


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

Date: 29 Dec 1998 11:30:34 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: REPLACE THE CONTENT OF AN ARRAY OF HASHES...
Message-Id: <76b03a$k1d$1@monet.op.net>

In article <3688FB15.BDFD1764@ccg.uc.pt>,
Vitor Varalonga  <vpedrosa@ccg.uc.pt> wrote:
>for $i (0 .. $#results) {
>   $results[$i] = $results[$i]{'ID'};
>}
>
>Is there a easier way, in a one line code, to
>achieve this?!?

	for (@results) { $_ = $_->{ID} }

or

	@results = map { $_->{ID} } @results;



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

Date: 29 Dec 1998 16:14:05 GMT
From: kjetikj@ulrik.uio.no (Kjetil Kjernsmo)
Subject: Script for inserting HTML abbrevations
Message-Id: <76av4d$86f$1@readme.uio.no>

Hi all!

I thought about start writing a script to insert HTML ABBRs and
ACRONYMs in existing HTML files, by having the program look up a list
of common abbrevations and acronyms (as well as my own) and their
expansions, but first I figured I'll ask if someone already wrote such
a script. So?

Since I'm quite new to Perl (that I will use), it'll probably take me
some time. If somebody wants to give a hand, it seems like my greatest
difficulty now is to make sure I'm not inserting ABBRs inside HTML
tags. I can't just remove them of course, which seems easy. If anybody
knows a fast way (without having to go all the way through a parser),
that would be great.
-- 
Vennlig Tiddeli-bom,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj@astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster@skepsis.no 


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

Date: Tue, 29 Dec 1998 10:52:08 -0500
From: "Robert Bruno" <rbruno@blue-pumpkin.com>
Subject: Searching for Text
Message-Id: <76atrh$gr1$1@camel21.mindspring.com>

Happy holidays to all,
I am working on getting this script to work, but have encountered some
trouble with it. I want to open a file (rpt1204.txt) and have it look for
certain information to pull out (Date and time interval) and then print the
output of the search to another document (rpt1204.out). If someone could
lend any assistance and point me in a general direction, it would be greatly
appreciated.

Thanks.
Here is the code I'm using currently.

$theInputFile = 'C:\rpt1204.txt';
open( INPUT, "<$theInputFile" ) or die "couldn't find file for writing\n";

$theOutputFile = 'C:\rpt1204.out';
open( OUTPUT, ">$theOutputFile" );

($TodayDay, $TodayMonth, $TodayYear) = (localtime)[3, 4, 5];
printf OUTPUT "Report Date: %02d/%02d/%02d\n", (($TodayMonth + 1),
$TodayDay, $TodayYear);
print OUTPUT "\n";

while ( $theCurrentLine = <INPUT> )
{
 if ( $theCurrentLine =~ /^\s+SUMMARY REPORT/ )
 {
  last;
 }
 elsif ( $theCurrentLine =~ /^\s+FROM \d\d:\d\d .. (...) (\d|\d\d),
\d\d(\d\d)/ )
{
 $theCurrentDate = sprintf "%s/%02d/%s", $theMonths{$1}, $2, $3;
 }
 .....
}

close( INPUT );
close( OUTPUT );

exit $returnCode;

again any help would be greatly appreciated.
Sincerely,
Robert Bruno





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

Date: Tue, 29 Dec 1998 16:59:15 +0100
From: Catherine Beloin <catherine.beloin@alcatel.fr>
Subject: security: how to force a real UID?
Message-Id: <3688FC52.6FFEED2C@alcatel.fr>

Having a UNIX tool that uses the "setreuid" C system call.
user1 calls the tool; the tool sets UID to "user 2" and acts as if done
by "user 2".
I want to make the same in perl.

=> perl's security about tainted items does not seem to allow this;
=> I don't find the equivalent function for setreuid in perl.

Can someone help?



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

Date: 29 Dec 1998 11:33:04 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: security: how to force a real UID?
Message-Id: <76b080$k6k$1@monet.op.net>

In article <3688FC52.6FFEED2C@alcatel.fr>,
Catherine Beloin  <catherine.beloin@alcatel.fr> wrote:
>=> I don't find the equivalent function for setreuid in perl.

	$<	is the ruid.
	$>	is the euid.


To set the uid, assign to $< or $>.

	($<, $>) = ($>, $<);    # Exchange real and effective uids



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

Date: Tue, 29 Dec 1998 10:19:30 -0700
From: Shana Priwer <tech@aba-architects.com>
Subject: Solution (?) to NT-Perl problem
Message-Id: <36890F22.4D2856F9@aba-architects.com>

I've been struggling with getting cgi scripts to run on the web server I
host through IIS, and as I've found a solution that works for my setup,
I thought I'd post it and see if it works for anyone else. Also, if
anyone notices major problems with my solution, please let me know  :)

When you install IIS it makes a directory called d:\InetPub. Regular
files for the web should be placed in the wwwroot directory inside
inetpub, but cgi files placed there will not run correctly. If you
create a cgi-bin directory inside the scripts directory, place your cgi
files in the cgi-bin and your linked .htm files inside the scripts
directory, things work and scripts run.

Also you need to do the scriptmap reg entry (see Vincent Bezard's
posting from yesterday)



---== http://www.newsfeeds.com - Largest Usenet Server In The World! ==---

---== http://www.newsfeeds.com - Largest Usenet Server In The World! ==---


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

Date: Tue, 29 Dec 1998 15:34:06 +0000
From: Vitor Varalonga <vpedrosa@ccg.uc.pt>
Subject: SORTING AN ARRAY OF HASHES...
Message-Id: <3688F66E.8CC84BB9@ccg.uc.pt>

   Hi!

   I'm hoping someone can give me a hand on this...
   OK... Here it goes...
   I have to sort an array of ashes. The Ashes have the following
keys: 'ID', 'Name', 'Title".
I want to order it, first alphabeticaly by Name, then alphabeticaly
by Title, and finally by growing ID.
Therefore I have done the following code:

sub order {
   lc($a->{'Name'}) cmp lc($b->{'Name'})
      or
   lc($a->{'Title'}) cmp lc($b->{'Title'})
      or
   $a->{'ID'} <=> $b->{'ID'};
}
@sorted_results = sort order @results;


But unfortunetly this doesn't work.
How should modify the code in order to achieve what
I want?


Thanks in advance,

Vitor Pedrosa



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

Date: 29 Dec 1998 11:27:16 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: SORTING AN ARRAY OF HASHES...
Message-Id: <76avt4$jpv$1@monet.op.net>

In article <3688F66E.8CC84BB9@ccg.uc.pt>,
Vitor Varalonga  <vpedrosa@ccg.uc.pt> wrote:
>But unfortunetly this doesn't work.

What you wrote looks perfectly correct.

Can you show the code that constructs the unsorted @results list?  And
can you say what `doesn't work' means?  What did it do that you didn't like?



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

Date: Tue, 29 Dec 1998 15:57:36 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: When hashing won't work...
Message-Id: <368afb6f.113536236@nntp.ix.netcom.com>

On 29 Dec 1998 09:10:38 -0500, Uri Guttman <uri@home.sysarch.com>
wrote:

>>>>>> "dhoward johnson's " == dave  <dave@mag-sol.com> writes:
>
>  dhoward johnson's > You need to escape @ characters in strings or Perl
>  dhoward johnson's > will assume they denote an array which it will
>  dhoward johnson's > attempt to interpolate.
>
>  dhoward johnson's > Something like this will work...
>
>  dhoward johnson's > $seen_email{'foo\@bar.com'} = 1;
>
>sure it will work, but it is redundant. either single quotes OR a \ will
>suffice to quote the @.

The string 'foo\@bar.com' contains a backslash character.   Neither
"foo\@bar.com" nor 'foo@bar.com' do.
--
Michael M Rubenstein


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

Date: Tue, 29 Dec 1998 09:00:20 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: When hashing won't work...
Message-Id: <4qqa67.i4u.ln@magna.metronet.com>

dave@mag-sol.com wrote:

: You need to escape @ characters in strings 

   s/strings/double quoted strings/;


: or Perl will assume they denote an
: array which it will attempt to interpolate.

: Something like this will work...

: $seen_email{'foo\@bar.com'} = 1;


   $seen_email{'foo@bar.com'} = 1;  # works fine too


   Single quotes don't _do_ interpolation, so the @ is not ambiguous
   in single quoted strings.


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


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

Date: Tue, 29 Dec 1998 16:57:50 GMT
From: dave@mag-sol.com
Subject: Re: When hashing won't work...
Message-Id: <76b1md$sqh$1@nnrp1.dejanews.com>

In article <x73e5zghsx.fsf@home.sysarch.com>,
  Uri Guttman <uri@home.sysarch.com> wrote:
> >>>>> "dhoward johnson's " == dave  <dave@mag-sol.com> writes:
>
>   dhoward johnson's > You need to escape @ characters in strings or Perl
>   dhoward johnson's > will assume they denote an array which it will
>   dhoward johnson's > attempt to interpolate.
>
>   dhoward johnson's > Something like this will work...
>
>   dhoward johnson's > $seen_email{'foo\@bar.com'} = 1;
>
> sure it will work, but it is redundant. either single quotes OR a \ will
> suffice to quote the @.

[Who's this dhoward johnson character then?]

Single quotes alone seems to work, but not the \ alone. Using Perl 5.00404 on
Solaris 2.5.1.

#!/usr/local/bin/perl -w

use strict;

my %seen_email;

$seen_email{foo\@bar.com} = 1;


[ 146 ] dcross@leqss008 % ./test.pl
Bareword "foo" not allowed while "strict subs" in use at ./test.pl line 7.
Unquoted string "foo" may clash with future reserved word at ./test.pl line 7.
Backslash found where operator expected at ./test.pl line 7, near "foo\"
syntax error at ./test.pl line 7, near "foo\"
Global symbol "bar" requires explicit package name at ./test.pl line 7.
Bareword "com" not allowed while "strict subs" in use at ./test.pl line 7.
Unquoted string "com" may clash with future reserved word at ./test.pl line 7.
Execution of ./test.pl aborted due to compilation errors.

Even if I remove the -w and 'use strict', I still get

[ 150 ] dcross@leqss008 % ./test.pl
Backslash found where operator expected at ./test.pl line 7, near "foo\"
syntax error at ./test.pl line 7, near "foo\"
Execution of ./test.pl aborted due to compilation errors.


Does this work in 5.005?

Dave...

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 4512
**************************************

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