[13545] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 955 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 18:07:17 1999

Date: Thu, 30 Sep 1999 15:05:23 -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: <938729122-v9-i955@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Sep 1999     Volume: 9 Number: 955

Today's topics:
        Best way to check a user's input? <leejk@cat.com>
    Re: Best way to check a user's input? <arthur.haas@westgeo.com>
    Re: Book suggestion <neil@pacifier.com>
    Re: Book suggestion <cassell@mail.cor.epa.gov>
    Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca (Abigail)
    Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca (Ilya Zakharevich)
    Re: Calling a subroutine held at one sever from another <rootbeer@redcat.com>
    Re: Calling Gunzip (Gzip) from Perl <rootbeer@redcat.com>
    Re: CGI call CGI? <dove@synopsys.com>
    Re: CGI call CGI? <dove@synopsys.com>
    Re: CGI_Lite.pm question <rootbeer@redcat.com>
    Re: dates shrine420@my-deja.com
        forms and validation of strings... <andreas.posur@wiesbaden.netsurf.de>
    Re: Help on finding duplicate lines in two files <dove@synopsys.com>
        help reading multi-line text file <mikej@1185design.com>
    Re: How to print to a printer? <gellyfish@gellyfish.com>
    Re: How to print to a printer? (Abigail)
    Re: HTML to ASCII <gellyfish@gellyfish.com>
        HTML, perl/cgi. <webmaster@mybegin.com>
    Re: HTML, perl/cgi. <pmikal@cisco.com>
    Re: Install CPAN module in ActiveState Windows version  <gellyfish@gellyfish.com>
    Re: Install CPAN module in ActiveState Windows version  <walsh@averstar.com>
    Re: memory differences reported by top and perl? <gellyfish@gellyfish.com>
        newbie: preload .wav files question sophieloo@my-deja.com
        No -e allowed in setuid scripts <musta@efn.org>
    Re: numeric sort on field 2 in @array... (Larry Rosler)
    Re: numeric sort on field 2 in @array... <grifftoe@sni.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Sep 1999 16:02:17 -0400
From: "Keith Lee" <leejk@cat.com>
Subject: Best way to check a user's input?
Message-Id: <7t0fp1$f8$1@ns1.cat.com>

I want to validate a user's input. The input can only be a number between
0.8 and 2.3. Using a simple pattern match does not seem to work well with
the decimals.
unless ($a =~ /[0.8-2.3]/) {
   do this;
}
Can any of you pattern matching wizards suggest something, or a good book on
pattern matching?

Thanks,
Keith




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

Date: 30 Sep 1999 15:18:16 -0500
From: Art Haas <arthur.haas@westgeo.com>
Subject: Re: Best way to check a user's input?
Message-Id: <lrogek17cn.fsf@yoda.wg.waii.com>

"Keith Lee" <leejk@cat.com> writes:

> I want to validate a user's input. The input can only be a number between
> 0.8 and 2.3. Using a simple pattern match does not seem to work well with
> the decimals.
> unless ($a =~ /[0.8-2.3]/) {
>    do this;
> }
> Can any of you pattern matching wizards suggest something, or a good book on
> pattern matching?
> 

Why use a pattern match?

if (($a > 0.8) && ($a < 2.3)) {
	... do neat stuff ...
} else {
	die "Your number is invalid!\n";
}

-- 
###############################
# Art Haas
# (713) 689-2417
###############################


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

Date: 30 Sep 1999 13:05:56 PST
From: Neil <neil@pacifier.com>
Subject: Re: Book suggestion
Message-Id: <37f3c2a4.0@news.pacifier.com>

Nolen Johnson <nolenj@worldnet.att.net> wrote:
> I'm looking for suggestions on a perl 5 book that either
> strictly or mostly deals with regular expressions...pattern matching etc.
> I've got plenty of perl books, but regular expressions indeed could
> be covered in a book by itself.

This is a well respected book on the subject:

"Mastering Regular Expressions : Powerful Techniques for Perl and Other
Tools (Nutshell Handbook)"

---

Neil



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

Date: Thu, 30 Sep 1999 13:47:23 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Book suggestion
Message-Id: <37F3CC5B.7FD75D08@mail.cor.epa.gov>

Nolen Johnson wrote:
> 
> I'm looking for suggestions on a perl 5 book that either
> strictly or mostly deals with regular expressions...pattern matching etc.
> I've got plenty of perl books, but regular expressions indeed could
> be covered in a book by itself.

Indeed.  In fact, they have been.  The best book on regexen
that I have read is Jeffrey Friedl's book "Mastering Regular
Expressions" [check at www.oreilly.com] .  

Just be forewarned that this book is based on Perl version
5.003, and so just about all the gripes the author has with
Perl have been addressed.  And there are now new Perl regex
features which are not covered in Friedl's book, which can 
only be found in your very own Perl documentation on your 
hard drive where you installed Perl.  Type 'perldoc perlre' to
get the "bird's-eye lowdown" on these beauties.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 30 Sep 1999 15:06:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <slrn7v7h6u.8i.abigail@alexandra.delanet.com>

Scratchie (AgitatorsBand@yahoo.com) wrote on MMCCXXI September MCMXCIII
in <URL:news:07NI3.72$QB2.11160@news.shore.net>:
!! 
!! What are you implying? That because Tom has contributed a lot of work to
!! the perl community that we should pretend that he isn't a condescending
!! jerk when he posts?


You don't have to pretend that, as he isn't.

*plonk*


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)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 30 Sep 1999 21:53:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <7t0m4v$4fb$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jean-Louis Leroy 
<jll@enterprise.newedgeconcept>],
who wrote in article <m3iu4srr5c.fsf@enterprise.newedgeconcept>:
> > You are missing a point:  there are two different persons posting
> > under the same netidentity.  Thanks go to one of them (from me too),
> > flames go to another one (from me too).
> 
> ???

Did you ever see a constructive posting from Tom and a destructive
posting of Tom sent within a short amount of time?  I do not recall
such things happening (often?).  Mind boggles what can cause this (the
most vicious conjecture involves running out of medications ;-).

Ilya


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

Date: Thu, 30 Sep 1999 13:26:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Calling a subroutine held at one sever from another
Message-Id: <Pine.GSO.4.10.9909301323450.17231-100000@user2.teleport.com>

On Thu, 30 Sep 1999, C. Gaunt wrote:

> Is it possible to call a subroutine that is is the cgi-bin on one
> sever from a perl script in the cgi-bin of a second server.

Short answer: No, it's not possible. You probably want to download and
install the software you need on your own server.

Long answer:

If it's possible at all, you'll need to use a protocol. If there isn't one
that already does what you want, you'll need to develop one. This will be
significantly more work than to download and install the software you need
on your own server. 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Sep 1999 13:17:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Calling Gunzip (Gzip) from Perl
Message-Id: <Pine.GSO.4.10.9909301313550.17231-100000@user2.teleport.com>

On Thu, 30 Sep 1999 brad@quicomm.com wrote:

> Has anyone successfully been able to use gzip in a Perl script called
> from a browser?

Why would it make a difference that a browser was involved? If it actually
_does_ make a difference, then it's probably a question about browsers. 

OTOH, maybe you want Compress::Zlib from CPAN.

> It is just the call to the gzip app does not return anything
> when called from the browser (at this stage, we are just trying to
> return the gunzip licensing message, -L option).

It's just a guess, but.... Could it be that you're trying to write
something into a directory which isn't writable by the webserver's uid?
For example, perhaps your /tmp or /var/tmp directory is (eek!) not
world-writable.

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Sep 1999 13:50:15 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: CGI call CGI?
Message-Id: <37F3CD07.A4454DD0@synopsys.com>

Hi Bangert,

Bangert Goldsmith wrote:

> How can I call an CGI script from another CGI script, both in Perl?

This depends on what you want to do.  One thing you can do is to use the
"Location" header to push to another CGI.  Here's a code snippet:

# Main

# ... do whatever your CGI does.
print "Location: http://myserver.com/newcgi.cgi?querystring=here\n\n";

This Location thing will redirect to your other CGI without having to
invoke stuff using LWP or system calls.  But this assumes that the only
output to the browser is coming from the second CGI.  (Plus you can't
print a Content-type: string in your first CGI).

If you are trying to get output from two different CGI's onto the same
web page, you might take a look at Server Side Includes (SSI).  I don't
like them myself, but they can work depending on your server.

If you are running Apache, take a look at this URL:
http://www.apache.org/docs-1.2/mod/mod_include.html

The include virtual SSI seems to be the best way to do this.  In your
HTML you would put something like this:

<!--#include virtual=/relative/URL/to/script1-->
<!--#include virtual=/relative/URL/to/script2-->

These are two possible ways of combining two different CGI's.  What are
you trying to do?

Hope this helps,
-=dav





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

Date: Thu, 30 Sep 1999 13:49:56 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: CGI call CGI?
Message-Id: <37F3CCF4.3D581AF4@synopsys.com>

Hi Bangert,

Bangert Goldsmith wrote:

> How can I call an CGI script from another CGI script, both in Perl?

This depends on what you want to do.  One thing you can do is to use the
"Location" header to push to another CGI.  Here's a code snippet:

# Main

# ... do whatever your CGI does.
print "Location: http://myserver.com/newcgi.cgi?querystring=here\n\n";

This Location thing will redirect to your other CGI without having to
invoke stuff using LWP or system calls.  But this assumes that the only
output to the browser is coming from the second CGI.  (Plus you can't
print a Content-type: string in your first CGI).

If you are trying to get output from two different CGI's onto the same
web page, you might take a look at Server Side Includes (SSI).  I don't
like them myself, but they can work depending on your server.

If you are running Apache, take a look at this URL:
http://www.apache.org/docs-1.2/mod/mod_include.html

The include virtual SSI seems to be the best way to do this.  In your
HTML you would put something like this:

<!--#include virtual=/relative/URL/to/script1-->
<!--#include virtual=/relative/URL/to/script2-->

These are two possible ways of combining two different CGI's.  What are
you trying to do?

Hope this helps,
-=dav




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

Date: Thu, 30 Sep 1999 13:12:32 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI_Lite.pm question
Message-Id: <Pine.GSO.4.10.9909301308240.17231-100000@user2.teleport.com>

On Thu, 30 Sep 1999 gmac63@perigee.net wrote:

> 1) I had CGI.pm in cgi-bin (adjacent to the cgi scripts). Same true
> for CGI_Lite.pm? If not, where?

Don't store modules in the cgi-bin directory; that directory is for
programs. Modules should be installed with 'make install', run by the
system administrator. If your sysadmin can't or won't install modules, get
a better one! :-)

> 2) I chmod 755, chown root, and chgrp <web server's group>. correct?

I don't know what you're asking here. But you shouldn't have to do
anything more than 'make install' as root to install any standard module.

> 3) Any known problems with buffers I need to know? I heard of problems
> with Macintosh and/or Windows files uploading in re. buffers. Anyone
> know what the issues are?

It sounds as if you're asking something about the CGI protocol. But if so,
that's not a Perl question. If you're asking about Perl buffering, see
whether the entry on the $| variable in the perlvar manpage tells you what
you need to know.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Sep 1999 20:54:47 GMT
From: shrine420@my-deja.com
Subject: Re: dates
Message-Id: <7t0imh$kbq$1@nnrp1.deja.com>

In article <MPG.12544919d2c95f50989fcd@nntp.hpl.hp.com>,
  lr@hpl.hp.com (Larry Rosler) wrote:
> In article <7sdu9d$l31$1@nnrp1.deja.com> on Thu, 23 Sep 1999 19:16:12
> GMT, gddt@my-deja.com <gddt@my-deja.com> says...
> > Hello Perl guru's can some one help me with ??
>
> Guruness not required for this one!
>
> > I would like to create a perl script to do the following.
> > key in a julian date such as 990923
>
> I suggest you look more closely into the term 'julian date'.  '990923'
> isn't.
>
That is correct. Do I have a way to convert date into julian format in
perl ? I have this calc where I have to use julian dates and subtract
them to compare the result against a number. AND I do not know perl that
well - where should I look for such a function , if at all ?


TIA
shrine420@my-deja.com


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


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

Date: Thu, 30 Sep 1999 22:42:05 +0100
From: "Andreas Posur" <andreas.posur@wiesbaden.netsurf.de>
Subject: forms and validation of strings...
Message-Id: <37f3cd38.0@juno.wiesbaden.netsurf.de>

Hi Guys my name is Andreas and I am not a specialist in
programming Perl/CGI...{not yet ;-) }.
Does somebody know how I functionalize a simple string
condition in a form???
this can't be so heavy...
I were glad when you show me an example for this
many thanks in advance,
Andreas






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

Date: Thu, 30 Sep 1999 14:20:45 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Help on finding duplicate lines in two files
Message-Id: <37F3D42D.18C6DCD1@synopsys.com>

Hi ,

tvn007@my-deja.com wrote:

> Hello,
>
> Would someone help me with the following  problem ?

<problem deleted>

Try this script.  I tested and it worked for me.

#!/usr/local/bin/perl-5.004 -w
# Always use -w to catch errors.

#
# Author: Dav Amann (dove@synopsys.com)
# Version: 1.0
#

use strict;                      # Always use strict.

my $first_path    = "firstfile.txt";
my $second_path   = "secondfile.txt";
my $comment_char  = ";";
my %remove_lines;

open (START, "+<$first_path")     or die "Can't open $first_path: $!\n";

open (REMOVE, "$second_path")     or die "Can't open $second_path:
$!\n";

# put main file into temp array
# This is just for small files.  If the files you have get large, it's
# better to use a temporary file and do a rename at the end.

my @temp = <START>;

# Get the lines to remove

while (<REMOVE>) {
    $remove_lines{$_}++;
}

# modify temp array
for (my $i=0; $i< @temp; $i++) {

    if (exists $remove_lines{$temp[$i]}) {
        $temp[$i] = $comment_char . $temp[$i];
    }
}

# print out the file
seek (START, 0, 0)             or die "Can't seek: $!\n";
print START @temp              or die "Can't print: $!\n";
truncate (START,tell(START))   or die "Can't truncate: $!\n";
close START                    or die "Can't close: $!\n";





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

Date: Thu, 30 Sep 1999 14:37:45 -0700
From: mikej <mikej@1185design.com>
Subject: help reading multi-line text file
Message-Id: <37F3D84A.DCBC2184@1185design.com>

Hi,

I have a text file (demo.log) of the format:

1:180.1.133.52:Thu:Sep:30:1999:10:45:14:email:mikej@1185design.com:firstname:mike:lastname:judkins

2:180.1.133.52:Thu:Sep:30:1999:10:46:14:email:vrossi@1185design.com:firstname:valentino:lastname:rossi

3:180.1.133.52:Thu:Sep:30:1999:10:47:14:email:mdoohan@1185design.com:firstname:michael:lastname:doohan

4:180.1.133.52:Thu:Sep:30:1999:10:48:14:email:mkroberts@1185design.com:firstname:kenny:lastname:roberts

5:180.1.133.52:Thu:Sep:30:1999:10:49:14:email:tharada@1185design.com:firstname:tetsuya:lastname:harada

I am trying to read this data into an array, and then print the last
names (item 14 of each line) of each line into a text file. The problem
is that even though I have a foreach loop that should go through each
line of the text file and print the 14th item, it is only reading the
first line and nothing else on the lines below. Heres my subroutine:

sub dolist {

#$count is a variable I use to see how many times the foreach loop runs
my $count = 0;

#extract data from stats file (format shown above)
 open(LOG, "demo.log") || &error("Couldn't open stats log file \n\n$!");

 @indata = <LOG>;
 close(LOG);
 
#create a text file with the last names in a list
 open(LIST, ">list.txt") || &error("Couldn't create list file \n\n$!");
 
#get the stats on each line
#this is where I am trying to get the last names from each line, but it
only seems to read the first line

 foreach $line (@indata)
{
    chomp($line);
    @mystats = split(/\:/, $line);
    #add to $count to see how many times it goes through the foreach
loop
    $count = $count + 1;
    #print the 14th item of each line
    print LIST "$mystats[14]\n";
}
 
    print LIST "read $count lines";

 close LIST;

print "Location: list.txt\n\n";

}

The end result of the printed text file (list.txt) is that I get the
last name of the first line only, and the value of $count is equal to 1,
which tells me its not running the foreach loop enough times to get to
the rest of the lines. How can I make it go through and return the 14th
item on all the lines of the demo.log file, instead of just the first?

mike
 
 



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

Date: 30 Sep 1999 20:08:03 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to print to a printer?
Message-Id: <7t0fv3$31t$1@gellyfish.btinternet.com>

On 30 Sep 1999 16:12:14 +0100 Jonathan Stowe wrote:
> M.E. <eldridgem@ihorizons.net> wrote:
>> I'm somewhat knowledgeable in Perl but not an expert by any means.
>> I need to be able to print a file from a linux box to a printer.
>> Is this possible?
>> I'd appreciate any help or links to help that anyone can give me.
>> I know NOTHING about using modules, so if the answer involves a module,
>> please be detailed in the steps I'd have to do.
>> Thank you in advance.
>> 
>> 
> 
> open a pipe to the command you would use for printing:
> 
>   open(PRINTER,"|lpr -Pblah") || die "Cant fork - $!\n";
> 
> then print to it as usual ...
> 
> alternatiovely you can just open the device the printer is on and then
> print to that.
> 

Oh I'm bored with that answer.  Open a socket on port 515 and send the
stuff described in rfc1179 to it ...  I've been meaning to write the
module for this for months but havent found the time and enthusiasm 
simultaneously ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 30 Sep 1999 16:04:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to print to a printer?
Message-Id: <slrn7v7kim.8i.abigail@alexandra.delanet.com>

M.E. (eldridgem@ihorizons.net) wrote on MMCCXXI September MCMXCIII in
<URL:news:37F36DF4.FF59CCA3@ihorizons.net>:
## I'm somewhat knowledgeable in Perl but not an expert by any means.
## I need to be able to print a file from a linux box to a printer.
## Is this possible?

Yes, if you have set up the printer correctly.

   system "lp file";



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 30 Sep 1999 20:47:27 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: HTML to ASCII
Message-Id: <7t0i8v$324$1@gellyfish.btinternet.com>

In comp.lang.perl.misc David Cassell <cassell@mail.cor.epa.gov> wrote:
> Abigail wrote:
>> 
>> David H. Adler (dha@panix7.panix.com) wrote on MMCCXIX September MCMXCIII
>> in <URL:news:slrn7v2ke0.9c5.dha@panix7.panix.com>:
>> ^^ In article <7sl4cr$cuq$1@gellyfish.btinternet.com>, Jonathan Stowe wrote:
> [snip]
>> ^^ >Thats a *little* harsh wouldnt you say ?  I would suggest flogging
>> ^^ >it least it gives them an opportunity to recant.
>> ^^
>> ^^ No one said anything about shooting them *fatally*...
>> 
>> Yeah.... just the knee caps will be fine....
> 
> Oh, so now you'll be writing with a German accent and we'll
> have to pronounce your name as "Ahh-bi-gail".  Hmmph.
> 
> Or maybe not.  Wasn't the T-1000 programmed in COBOL?
> No wonder he lost to a couple humans.
> 

So what you say - Johnny 5 was programmed in Perl, ED-209 in Ada, 
HAL-9000 in Perl, WOPPA in Prolog, K-9 in Python, ORAC in Perl, 
The Daleks and the Cybermen probably in COBOL, Holly and Kryten in
Perl, Klaatu - APL ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 30 Sep 1999 23:17:16 +0100
From: Danny Verkade <webmaster@mybegin.com>
Subject: HTML, perl/cgi.
Message-Id: <37F3E16A.7BB0D9F9@mybegin.com>

Hi,

I have an XML document where a CGI/perl program need some information
from. The XML file is loaded into one string ($content). Unfortunately I
cannot add new modules to the server and I do not have te XML module
installed on it. This is what the XML document looks like

<channel>
        <image>
                <link>Waar linken we naar??</link>
                <url>Plaats van het plaatje
        </image>
        <item>
                <link>Hier linken we naar</link>
                <title>Titel van de link</title>
                <description>Meer info over de link</description>
        </item>
</channel>

Hope you can help.

Thanks
Danny






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

Date: Thu, 30 Sep 1999 14:25:48 -0700
From: "P. Mikal" <pmikal@cisco.com>
Subject: Re: HTML, perl/cgi.
Message-Id: <37F3D55B.AF4DA0D5@cisco.com>

Not sure what your question is, but:

($link) = ($html_page =~ m#<link>\s*(.*?)\s*</link>#is)

Danny Verkade wrote:

> Hi,
>
> I have an XML document where a CGI/perl program need some information
> from. The XML file is loaded into one string ($content). Unfortunately I
> cannot add new modules to the server and I do not have te XML module
> installed on it. This is what the XML document looks like
>
> <channel>
>         <image>
>                 <link>Waar linken we naar??</link>
>                 <url>Plaats van het plaatje
>         </image>
>         <item>
>                 <link>Hier linken we naar</link>
>                 <title>Titel van de link</title>
>                 <description>Meer info over de link</description>
>         </item>
> </channel>
>
> Hope you can help.
>
> Thanks
> Danny



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

Date: 30 Sep 1999 21:09:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Install CPAN module in ActiveState Windows version of Perl?
Message-Id: <7t0jib$32d$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 18:05:25 GMT John P Walsh wrote:
> What is the procedure to install an CPAN module into an ActiveState Win
> version of Perl? The PPM program provided by ActiveState appears to be
> limited to modules available at the ActiveState site.
> 

There are other PPM repositories available and these are configurable
within the PPM program - I'm afraid I can t remember the URL of any
at the moment but you might want to inquire of one of the mailing lists
that are referenced on the Activestate site.

If a module has no XS components then you might be able to install it
if you obtain 'nmake' (microsofts make utility) which is available from
microsofts ftp server.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 30 Sep 1999 20:49:54 GMT
From: John P Walsh <walsh@averstar.com>
Subject: Re: Install CPAN module in ActiveState Windows version of Perl?
Message-Id: <37F3CCF2.7FF85957@averstar.com>

Thank you Jeff for the response.

If I understand what you are saying, the simple answer is to do a regular
CPAN-style install into the bin, lib, and other subdirectories just as I
would using GS's version of Windows Perl.  (Yes, I know GS now works for
ActiveState.) I guess I should re-install my CPAN procedures to maintain CPAN
modules, and use the PPM software just for the ActiveState modules.

Thanks,

- John Walsh




Jeff Zucker wrote:

> John P Walsh wrote:
> >
> > What is the procedure to install an CPAN module into an ActiveState Win
> > version of Perl? The PPM program provided by ActiveState appears to be
> > limited to modules available at the ActiveState site.
>
> Well, not exactly true. You can change the repository location of ppm to
> point to other sites that have .ppd files so you *can* use ppm to
> install files not on the ActiveState site.
>
> But there are also other files that are not in .ppd format and therefore
> would need to be installed from CPAN.  Some of these need to be compiled
> and so you'd need a c++ compiler.  Others only need to be made, so you
> need a version of make such as microshlock's nmake.exe but not the
> compiler.  Once you have nmake or its equivalent, you install the
> (non-XS) CPAN modules the same way you do on any platform.
>
> > Pointers to a FAQ or web site would be appreciated.
>
> Both alternate site usage of ppm and use of nmake with CPAN modules are
> covered in the help materials that come with ActiveState Perl.
>
> --
> Jeff



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

Date: 30 Sep 1999 21:13:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: memory differences reported by top and perl?
Message-Id: <7t0jql$32g$1@gellyfish.btinternet.com>

On Thu, 30 Sep 1999 18:37:05 GMT stampede wrote:
> I'm running some scripts which iterate over a bunch of extremely large
> BTrees.  Once I reach a certain point, I receive the "Out of memory!"
> error, and the program dies.
> 
> 1) When I watch 'top,' I see that only 15% of memory is being consumed
> by my perl script; and of the total memory, there is always at least
> 640K (between 790K and 640K) free.
> 

It might be that it bites the dust when Perl tries to allocate a large
wad of memory that is not available ...

> 2) How can I conserve memory?  How can I have perl clean up
> appropriately so that I can get through this 1 GB DB?
> 

Difficult to say - you might be served by posting the smallest example
of code that exhibits your problem - say 10 lines or so ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Thu, 30 Sep 1999 20:30:06 GMT
From: sophieloo@my-deja.com
Subject: newbie: preload .wav files question
Message-Id: <7t0h7q$jc3$1@nnrp1.deja.com>

I am new to perl and cgi...am trying to preload .wav files onto a page.
I've read through a multimeadia thread which mentioned things like:
MediaPlay
Authorware 5
Preload()
NetPreload() function.

I am looking for something I can just write into the cgi script. I
don't know if the above mentioned are freely available or from
commercial software. I have been told that there are functions in java
and also javascript which will preload objects....
Three files are 2.5 mb, the others are very small.
Appreciate any info...
thanks,
Elaine


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


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

Date: Thu, 30 Sep 1999 13:33:07 -0700
From: <musta@efn.org>
Subject: No -e allowed in setuid scripts
Message-Id: <Pine.GSU.4.05.9909301236140.2220-100000@garcia.efn.org>


Hello,

   The following code fragment extracts a user's group id and verifies
whether the user belongs to an authorized group to run the program.

-----------------------------------------------------------
($UserName)  = getpwuid($<);
($GroupString) = $(;
@Array_Of_GroupIDs = split (/ /, $GroupString);
$Counter = 0;
$Is_Authorized = 0;
while ($Array_Of_GroupIDs[$Counter] ne "") {
        if ($Array_Of_GroupIDs[$Counter] eq "55") {
                $Is_Authorized = 1;
        }
        $Counter++;
}
if ($Is_Authorized == 0) {
        print ("You are not authorized to run this program.\n");
        print ("This incident will be reported!\n");
}
-----------------------------------------------------------

Now when I compile the above (using "perlcc"), i get the following:

-----------------------------------------------------------
% perlcc usergroup.p

--------------------------------------------------------------------------------
Compiling usergroup.p:
--------------------------------------------------------------------------------
Making C(usergroup.p.c) for usergroup.p!
/usr/bin/perl -I/opt/local/lib/perl5/5.00502/sun4-solaris-thread
-I/opt/local/lib/perl5/5.00502
-I/opt/local/lib/perl5/site_perl/5.005/sun4-solaris-thread
-I/opt/local/lib/perl5/site_perl/5.005 -I. -MO=CC,-ousergroup.p.c usergroup.p
usergroup.p syntax OK
Compiling C(usergroup) for usergroup.p!
/usr/bin/perl -I/opt/local/lib/perl5/5.00502/sun4-solaris-thread
-I/opt/local/lib/perl5/5.00502
-I/opt/local/lib/perl5/site_perl/5.005/sun4-solaris-thread
-I/opt/local/lib/perl5/site_perl/5.005 -I. /tmp/usergroup.p.tst
cc -D_REENTRANT -I/opt/local/include -I/opt/gnu/include -O
-I/opt/local/lib/perl5/5.00502/sun4-solaris-thread/CORE
/opt/local/lib/perl5/5.00502/sun4-solaris-thread/auto/Fcntl/Fcntl.so -o
usergroup usergroup.p.c  -L/opt/local/lib -L/opt/gnu/lib
-L/opt/local/lib/perl5/5.00502/sun4-solaris-thread/CORE -lperl -lsocket
-lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt
%
-----------------------------------------------------------

The compilation seems to have gone fine.  However, when I "chown" the
binary to "root", then "chmod" it to "4755" (or -rwsr-xr-x), and try to
run it I get the following:

-----------------------------------------------------------
% uname -rs
SunOS 5.6

% id
uid=1519(obeidm) gid=55(controls)

% ls -ls ./usergroup
1632 -rwsr-xr-x   1 root     controls  837616 Sep 30 14:46 ./usergroup

% file ./usergroup
 ./usergroup:    ELF 32-bit MSB executable SPARC Version 1, dynamically
                linked, not stripped

% ./usergroup
No -e allowed in setuid scripts.
-----------------------------------------------------------

But then, I get the following when I run the same binary as root:
-----------------------------------------------------------
# id
uid=0(root) gid=1(other)

# ./usergroup
You are not authorized to run this program.
This incident will be reported!
-----------------------------------------------------------
which is fine since user root does not belong to group "55".

In the first instance, effective user id (euid) of the program had to be
changed to root since the binary is suid root and the user who launched
the binary was not root.  For some reason, that resulted in the
"No -e allowed in setuid scripts" error message.

In the second instance, euid didn't need to change since it was already
set to root.  That resulted in having the program run as designed.
Further tests proved my theory.

Now the question is why is that happening?  the file appears to be a
binary, not a script, as shown by the output of the command "file".
Still, the error message says it's a script :)  Any workarounds or
suggestions to get this puppy going?

Thanks!
-Mustapha



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

Date: Thu, 30 Sep 1999 14:35:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: numeric sort on field 2 in @array...
Message-Id: <MPG.125d7782b9e5da4398a00d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37f3badd$0$229@nntp1.ba.best.com> on 30 Sep 1999 19:32:45 
GMT, shiloh@shell9.ba.best.com <shiloh@shell9.ba.best.com> says...
> I could not find this "exactly" in perfunc or perlfaq4.

Gold stars for looking.  Demerits for expecting to find 'exactly' what 
you wanted, and for overlooking what was useful.

> I want to do a numeric sort only on field 2 of an @array.

 ...

> @new = sort { field1($a) <=> field1($b) ||
>                  field2($a) <=> field2($b) ||
>                  field3($a) <=> field3($b)
>                }     @array;

 ...

> How do I numerically sort "only" on the second field?
> How do I get rid of the "field1" error? 

You overlooked the sentence in perlfaq4 that precedes this example:

"If you need to sort on several fields, the following paradigm is 
useful."

You say you want to sort on only one field, not on several.  The 
relevant example is the one right ahead of this in the FAQ.  If you have 
trouble making that work, come back with the code that failed, and 
someone will help you.

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


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

Date: Thu, 30 Sep 1999 15:53:20 -0600
From: "Dr. John Griffiths" <grifftoe@sni.net>
To: shiloh@shell9.ba.best.com
Subject: Re: numeric sort on field 2 in @array...
Message-Id: <37F3DBD0.9431901B@sni.net>

rather than using built-in sort I write the array to a file,
pass it to bin/sort, and read it back in - its fast and
easy.
-- 
Dr. John  Griffiths  \( ~ )7  The Teahouse of Experience
grifftoe@csn.net           http://www.sni.net/~grifftoe/
O, call back yesterday.      Richard II, act 3, sc. 2.
Only 67 working days remain until the year 2000!


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

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


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