[9290] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2885 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 16 17:07:13 1998

Date: Tue, 16 Jun 98 14:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Jun 1998     Volume: 8 Number: 2885

Today's topics:
        Accessing an array of hash with foreach <dan_smeltz@novaeon.com>
    Re: Calculating Disk Space on Win32 (Jeffrey R. Drumm)
        chomp function is giving problems <upojwt@panther.gsu.edu>
    Re: chomp function is giving problems <bowlin@sirius.com>
    Re: chomp function is giving problems (Allan M. Due)
    Re: Curly braces in if elsif contructs (Ilya Zakharevich)
    Re: Curly braces in if elsif contructs (Chris Sherman)
        grep question <b-camp@students.uiuc.edu>
        GUI Based Debugger for Perl vers 1.01 (Andrew E Page)
    Re: HELP :  Socket Problems with NT 4 Perl <dan_smeltz@novaeon.com>
    Re: HELP :  Socket Problems with NT 4 Perl <bowlin@sirius.com>
    Re: HELP :  Socket Problems with NT 4 Perl <bowlin@sirius.com>
    Re: How can I write to specific line ? (Daniel Beckham)
    Re: how to create a bidirectional pipe? <igorv@styx.or.fedex.com>
    Re: How to do a non-numeric sort of a hash? (M.J.T. Guy)
    Re: http protocol (Breeze Pecorino)
    Re: Large files (>2GB) on Solaris 2.6 (Lupe Christoph)
    Re: Newbie looking for help with text manipulation 6xtippet@CyberJunkie.com
    Re: Newbie question <tresing@globalscape.net>
        obfuscated perl <eglamkowski@angelfire.com>
        Perl Cmd line - Help <sudhakar@ccs.neu.edu>
    Re: Perl Cmd line - Help <rootbeer@teleport.com>
    Re: Perl with ASP? (Brian Jepson)
    Re: Perl5 and the X11 libraries. <tresing@globalscape.net>
    Re: Perl5 and the X11 libraries. (Ken Fox)
    Re: REGEX HELP (Patrick Timmins)
        Returning references to my variables - Safe? <aaron.becher@sdrc.com>
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Chris Nandor)
    Re: script that will replace a image and some text on a <rootbeer@teleport.com>
    Re: script that will replace a image and some text on a <nospam@nospam.com>
    Re: Starting an Albuquerque area Perl Mongers group <mowens@SPAM_DECOY.state.nm.us>
        Undefined subroutine CGI::pram <hannum@oak.cat.ohiou.edu>
    Re: Win NT- CGI script help please <edgar@sbrt.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Jun 1998 16:15:56 -0400
From: "PSI" <dan_smeltz@novaeon.com>
Subject: Accessing an array of hash with foreach
Message-Id: <6m6jr0$gen$1@client3.news.psi.net>

I've got an array of hash.  How do you acces this using the foreach
statment?    Here's an example of what I'm trying to do:

%hash1 = {
    fld1=>'a',
    fld2=>'b',
};

%hash2 = {
    fld1=>'y',
    fld2=>'z',
};

push @array, {%hash1};
push @array, {%hash2};

# this print out nothing
foreach (@array) {
    print $_{fld1};
}

# this prints fine
for ($i = 0; $i < @array; ++$i) {
    print $array[$i]{fld1};
}

Why won't foreach work?





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

Date: Tue, 16 Jun 1998 18:06:23 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Calculating Disk Space on Win32
Message-Id: <3586abd4.417659462@news.mmc.org>

[posted and mailed]

On 16 Jun 1998 12:01:35 GMT, scott@softbase.com wrote:

>If you want something more specific than that, you'll likely
>have to write a small C program to use the API to get at the
>information, since Perl can't call arbitrary API functions yet.
>
>Scott

FYI . . .

NAME
    Win32::API - Implementation of arbitrary Win32 APIs.

SYNOPSIS
      use Win32::API;
      $function = new Win32::API($library,
                                 $functionname,
                                 \@argumenttypes,
                                 $returntype);
      $return = $function->Call(@arguments);

ABSTRACT
    With this module you can import and call arbitrary functions
    from Win32's Dynamic Link Libraries (DLL).


Can be found at:

	http://www.divinf.it/dada/perl/Win32API-0.011.zip

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Tue, 16 Jun 1998 20:05:15 GMT
From: "GLA" <upojwt@panther.gsu.edu>
Subject: chomp function is giving problems
Message-Id: <01bd9961$bf007e80$64556083@gla.gsu.edu>

Hello, I am a newbie at perl.  I typed the program below directly from the
book learning perl by O'reilly but it is giving me bunch of errors about
chomp that I cannot figure out from all the books I can find on perl.  Any
help would be appreciated.
When responding please make a CC of your mail to gs01vvv@panther.gsu.edu.

Thanks

##Start of Code for prog secword.pl

#!/usr/bin/perl -w
$secretword = "llama";
print "What is your name? ";
$name = <STDIN>;
chomp $name;
if ($name eq "Randal") {
        print "Hello, Randal! How good of you to be here!\n";
} else {
        print "Hello, $name!\n";
        print "what is the secret word?";
        $guess = <STDIN>
        chomp ($guess)
        while ($guess ne $secretword) {
         print "Wrong, try again.  What is the secret word? ";
         $guess = <STDIN>
         chomp ($guess);
        }
}

## Errors
% perl secword.pl
syntax error in file secword.pl at line 6, next 2 tokens "chomp $name"
syntax error in file secword.pl at line 13, next token "chomp"
syntax error in file secword.pl at line 17, next token "chomp"
syntax error in file secword.pl at line 19, next token "}"
Execution of secword.pl aborted due to compilation errors.



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

Date: Tue, 16 Jun 1998 13:21:48 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: GLA <upojwt@panther.gsu.edu>
Subject: Re: chomp function is giving problems
Message-Id: <3586D3DC.18E28D6E@sirius.com>

GLA wrote:
> 
> Hello, I am a newbie at perl.  I typed the program below directly from the
> book learning perl by O'reilly but it is giving me bunch of errors about
> chomp that I cannot figure out from all the books I can find on perl.  Any
> help would be appreciated.
> When responding please make a CC of your mail to gs01vvv@panther.gsu.edu.
> 
> Thanks
> 
> ##Start of Code for prog secword.pl
> 
> #!/usr/bin/perl -w
> $secretword = "llama";
> print "What is your name? ";
> $name = <STDIN>;
> chomp $name;
> if ($name eq "Randal") {
>         print "Hello, Randal! How good of you to be here!\n";
> } else {
>         print "Hello, $name!\n";
>         print "what is the secret word?";
>         $guess = <STDIN>
>         chomp ($guess)
>         while ($guess ne $secretword) {
>          print "Wrong, try again.  What is the secret word? ";
>          $guess = <STDIN>
>          chomp ($guess);
>         }
> }
> 
> ## Errors
> % perl secword.pl
> syntax error in file secword.pl at line 6, next 2 tokens "chomp $name"
> syntax error in file secword.pl at line 13, next token "chomp"
> syntax error in file secword.pl at line 17, next token "chomp"
> syntax error in file secword.pl at line 19, next token "}"
> Execution of secword.pl aborted due to compilation errors.

Hints:

   1) Try ending each statement with a semi-colon.
   2) Make sure you are using a recent Perl version, 5.003+
     
You can determine your version by typing "perl -v".

HTH -- Jim Bowlin


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

Date: 16 Jun 1998 20:43:25 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: chomp function is giving problems
Message-Id: <6m6ldd$dtd$0@206.165.146.29>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <01bd9961$bf007e80$64556083@gla.gsu.edu>, GLA 
(upojwt@panther.gsu.edu) posted...
[snippage]

|print "what is the secret word?";

It is not the chomp that is the problem.  Watch those semicolons, 
you need one at the end of each statement.  You have to punctuate what 
you are stating.

|        $guess = <STDIN>
                     ^^^^^^ add ;
|        chomp ($guess)
                     ^^^ add ;  
|        while ($guess ne $secretword) {
|         print "Wrong, try again.  What is the secret word? ";
|         $guess = <STDIN>
                       ^^^^^ add ;

-- 
Allan M. Due
Due@Murray.Fordham.edu

The beginning of wisdom is the definitions of terms.
- Socrates


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

Date: 16 Jun 1998 17:55:57 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Curly braces in if elsif contructs
Message-Id: <6m6bjd$o71$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Ask Bjoern Hansen 
<ask@netcetera.dk>],
who wrote in article <m3k96icyyr.fsf@balder.netcetera.dk>:
> Hi everybody,
> 
> I've just had a discussion with one of my colleagues about the ending
> curly braces in if, elsif, else constructs.
> 
> I'm always writing simple if, elsif, else things like:
> 
> if ($gnuffelig eq "1" ) {
> 	print "test";
> 	my $tblasd = "232";
> } elsif ($testset eq "esfs") {
>  	print "lbsd!";
> } else {
> 	print "fum!";
> }

Note that this is the default off-the-factory format supported by
CPerl.  Later CPerl are able to reflow to this format during
group-indentation (switchable off, of course).

Note that currently CPerl is not able to do the opposite reflowing due
to popular undemand.  Vote with your patches!

Ilya


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

Date: Tue, 16 Jun 1998 18:00:54 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Re: Curly braces in if elsif contructs
Message-Id: <EunopI.y4@unx.sas.com>

In <m3k96icyyr.fsf@balder.netcetera.dk> Ask Bjoern Hansen <ask@netcetera.dk> writes:

>I've just had a discussion with one of my colleagues about the ending
>curly braces in if, elsif, else constructs.

Here is my vote and why:

   if () {
   }
   elsif {
   }
   else {
   }

Why?  Because I write comments like this:

   # I'm about to check for this
   if () {
   }

   # but that didn't find it, so try this
   elsif () {
   }

   # DOH!  Something went wrong.  Recover
   else {
   }


Of course, you can do this:

   if () {
      # I'm about to check for this

   } elsif () {
      # but that didn't find it, so try this
   }

   else {
      # DOH!  Something went wrong.  Recover
   }

Now the comments don't line up with the blocks they comment on,
and so it gets more confusing what they apply to.

If you did line them up with the blocks under the `if` or `elseif`,
I don't think that looks as good.

Just my $0.02.
-- 
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com


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

Date: Tue, 16 Jun 1998 14:55:34 -0500
From: Bryan Camp <b-camp@students.uiuc.edu>
Subject: grep question
Message-Id: <Pine.SOL.3.96.980616144820.18654A-100000@ux5.cso.uiuc.edu>

Hello,

I have a simple question about executing
a grep statement within a perl script.
What I'm trying to do is prompt the user
for input, and then search the current directory
for all occurrences of this input.

So far I have:

$input = <STDIN>;
$output = `grep $input *.par > outfile`;

The second line works fine from the command line,
and from my understanding, one can execute command
line statements by placing backquotes around it.
However, when I view the outfile, it is blank,
even though there are occurences of the user input
within many files in the directory.

Can someone perhaps tell me what I'm doing wrong,
or give advice on a different approach to take?
Thank you.

Bryan




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

Date: Tue, 16 Jun 1998 20:02:18 GMT
From: aep@world.std.com (Andrew E Page)
Subject: GUI Based Debugger for Perl vers 1.01
Message-Id: <EunuBv.BuL@world.std.com>

   I'm working on a debugger for perl with a ptk user interface.
You can find this at:

   http://world.std.com/~aep/ptkdb

<a href="http://world.std.com/~aep/ptkdb">http://world.std.com/~aep/ptkdb<a>

   Please give this a try and tell me what you think.  Comments, suggestions
and questions to:  aep@world.std.com

<a href="mailto:aep@world.std.com">aep@world.std.com</a>

   Included on the page is a ptk installation script, screenshot,
installation instructions and release notes.  
-- 
Andrew E. Page   (Warrior Poet) |   Decision and Effort The Archer and Arrow
Software Engineering Consultant |     The difference between what we are
Unix, Mac, C/C++/Java, Perl, NT |           and what we want to be.


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

Date: Tue, 16 Jun 1998 16:10:22 -0400
From: "PSI" <dan_smeltz@novaeon.com>
Subject: Re: HELP :  Socket Problems with NT 4 Perl
Message-Id: <6m6jgk$gbk$1@client3.news.psi.net>

You need to use recv and print to read and write data to the socket.  The NT
version of Perl doesn't allow you to use a socket as a filehandle.






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

Date: Tue, 16 Jun 1998 13:28:00 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Anthony farrow <a.n.farrow@cranfield.ac.uk>
Subject: Re: HELP :  Socket Problems with NT 4 Perl
Message-Id: <3586D550.133CB940@sirius.com>

Anthony farrow wrote:
> 
> Hi,
> 
> I am having trouble getting the following Socket code to work.  It's running
> on NT4.
> 
> It works fine on version 5.001, but if I use the latest perl version
                                                   ^^^^^^^^^^^^^^^^^^^

The latest Perl version for NT is the standard distribution 5.004_02
I think a lot of your problems will vanish if you use the
latest Perl and the standard modules that come with it.

-- Jim Bowlin


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

Date: Tue, 16 Jun 1998 13:29:54 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: PSI <dan_smeltz@novaeon.com>
Subject: Re: HELP :  Socket Problems with NT 4 Perl
Message-Id: <3586D5C2.7CE79BB5@sirius.com>

PSI wrote:
> 
> You need to use recv and print to read and write data to the socket.
> The NT version of Perl doesn't allow you to use a socket as a 
> filehandle.

I use sockets as filehandles in Perl on NT.  No problemo.

-- Jim Bowlin


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

Date: Tue, 16 Jun 1998 19:05:29 GMT
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: How can I write to specific line ?
Message-Id: <6m6fta$fh$1@usenet50.supernews.com>

The man pages talk about in-place editing. Check out the IO section.  I think 
that's where it is.

In article <6l5q1v$h5m$1@news.huji.ac.il>, evgenya@amos-01.cs.huji.ac.il 
(Evgenya Borisenko) wrote:
>Hi,
>
>I'd like to know is there a possibility to write (change) to a specific
>line in a file ?
>
>Thanx for any help,
>Eugenia.


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

Date: Tue, 16 Jun 1998 12:33:00 -0500
From: Igor Vulfson <igorv@styx.or.fedex.com>
To: GEMINI <dennis@info4.csie.nctu.edu.tw>
Subject: Re: how to create a bidirectional pipe?
Message-Id: <3586AC4C.203BFD27@styx.or.fedex.com>

GEMINI wrote:
>   in my perl program, I'd like to build
> a bidirectional pipe with another program.
> but I only know how to create one-direction pipe by
> "| prog" or "prog |".

RTFM, specifically perlipc, section on open2()


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

Date: 16 Jun 1998 20:25:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How to do a non-numeric sort of a hash?
Message-Id: <6m6kbb$igb$1@pegasus.csx.cam.ac.uk>

Deva Seetharam  <psdspss@execpc.com> wrote:
>
>foreach $key (sort { $a >$b } keys %hash) {        printf "%4d
                      ^^^^^^
That doesn't define an ordering, so you'll get rubbish results
(and perhaps SEGVs, tho' they'll be fixed in the next version of Perl).


Mike Guy


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

Date: 16 Jun 1998 17:55:56 GMT
From: bpecorin@mailer.fsu.edu (Breeze Pecorino)
Subject: Re: http protocol
Message-Id: <6m6bjc$91f$1@news.fsu.edu>

Barry Margolin (barmar@bbnplanet.com) wrote:
: In article <6lp68q$j4r$1@news.fsu.edu>,
: Breeze Pecorino <bpecorin@mailer.fsu.edu> wrote:
: >$proto = getprotobyname('tcp');
: >socket(S, AF_INET, SOCK_STREAM, $proto) || die "socket: $!";
: >
: >($name, $aliases, $port, $proto ) = getservbyname( "www-http", 'tcp' ); 
: >($name, $aliases, $type, $len, $thisaddr) = gethostbyname( $hostname );
: >($name, $aliases, $type, $len, $thataddr) = gethostbyname( $them ); 
: >
: >$this = pack($sockaddr, AF_INET, 0, $thisaddr );
: >$that = pack($sockaddr, AF_INET, "http", $thataddr );

: "http" in there should be $port.

Whoops. That was a typo in my post.  In the program it is "$port".


: -- 
: Barry Margolin, barmar@bbnplanet.com
: GTE Internetworking, Powered by BBN, Cambridge, MA
: *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.

--
Breeze Pecorino 
bpecorin@acns.fsu.edu
Acedemic Computing & Network Services
Florida State University


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

Date: 16 Jun 1998 09:44:57 +0200
From: lupe@alanya.m.isar.de (Lupe Christoph)
Subject: Re: Large files (>2GB) on Solaris 2.6
Message-Id: <6m57pp$ge0$1@alanya.m.isar.de>

smcdow@arlut.utexas.edu (Stuart McDow) writes:

>Barry Roomberg <broom@voicenet.com> writes:
>> Issue:
>>  Large file access (>2GB) via PERL on Solaris 2.6.

>This might be a system limitation (nothing to do with perl). Maximum
>file size is 2GB under Solaris 2.5.1. Haven't checked on 2.6 yet.

Solaris 2.6 happens to be the release that introduces > 2GB files.
But you have to change things when compiling, or change the source.
See man interface64 and man lfcompile64.

Perl has not been doctored to use either, AFAIK.
-- 
| lupe@alanya.m.isar.de     (private) | lupe@octogon.de  (business)      |
| "In short, just as the Multics mentality of careful access controls    |
| shows up throughout Unix, the cretinous CP/M mentality of uncontrolled |
| havoc shows up in DOS and all its mutant children."   Tom Christiansen |


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

Date: Tue, 16 Jun 1998 18:13:54 GMT
From: 6xtippet@CyberJunkie.com
Subject: Re: Newbie looking for help with text manipulation
Message-Id: <3586975d.956303431@news.usaor.net>

On Tue, 16 Jun 1998 13:53:09 GMT, Schristie@rnib.org.uk (Christie,
Sara) wrote:

>My problem is how to (if you can) identify a word after a tag, remove
>the tag and put the word into a variable so that it can be inserted
>into the text document again at regular intervals. This would occur
>until the next tag wherupon the word would be updated.
>
>The document is received like this:
>
><CATEGORY> Books
><SECTION> one
>
>Title
>Code
>Description
>
>Title
>Code
>Description
>
>etc.
>
><SECTION> two
>
>Title
>Code
>Description
>
>and I would like it to be:
> 
>Books, one, title, code, descriptioin
>Books, one, title, code, description
>etc.
>Books, two, title, code, description
>
>
>I have managed to do the not too difficult job of reordering the title
>code description by doing a simple substitution but am stumped as to
>how to cope with the tagged bit. 
>
>Any help would be greatly appreciated, 
>
my $category;
my $infile = shift @ARGV;
my $current_line;

open( INPUT, "$infile" ) || die $!;
while($current_line = <INPUT>)
{
	if( $current_line =~ /^<CATEGORY>\s*([^\s]*)/ )
	{
		$category = $1;
		print "\n$category\n";
	}
}
close( INPUT );

This example should print the value for each <CATEGORY> tag.  If this
is not a good enough hint, please post your source and we see what can
be done.

Lee


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

Date: Tue, 16 Jun 1998 13:59:27 -0500
From: Thomas Resing <tresing@globalscape.net>
Subject: Re: Newbie question
Message-Id: <3586C08F.7736FA60@globalscape.net>

F.Quednau wrote:

> Thomas Resing wrote:
>
> [cut]
> > foreach $file (sort readdir(IDIR)) {
> >   print "<img src=",$myurl.$file,"><br>\n" if $file =~ /gif/;
> >   print "<img src=",$myurl.$file,"><br>\n" if $file =~ /jpg/;
> > }
> > closedir(IDIR);
> [cut]
>
> Yep. However, there might be situations where no URL will reach the files...

Not if you specify the correct url!

The files listed in Perl should be the same files that are available on the web
server,
if I interpreted the question correctly. In this case, $file will be equal to
the local
file name and must be converted to a proper web location in order to displayed
in the generated html.

For example:
local file                                web-location
\wwwroot\images\*.gif           http://www.yourserver.com/images/*.gif

--
 ...............................................
Tom Resing      Programmer/Analyst
GlobalSCAPE     www.globalscape.net
 ...............................................




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

Date: Tue, 16 Jun 1998 16:44:04 -0400
From: the count <eglamkowski@angelfire.com>
Subject: obfuscated perl
Message-Id: <3586D914.28FD@angelfire.com>

saw this as a .sig and am having trouble deciphering it:

Become an arms trafficker! -export-a-crypto-system-sig -RSA-3-lines-PERL
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

specifically, I don't know what those ] characters are doing, and what
the deal is with that ^*

-- 
                      "Have you no sense of decency, sir?
               At long last, have you left no sense of decency?"


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

Date: Tue, 16 Jun 1998 13:54:53 -0400
From: Sudhakar <sudhakar@ccs.neu.edu>
Subject: Perl Cmd line - Help
Message-Id: <3586B1A7.5D01@ccs.neu.edu>

I type this in the unix command line to replace a "char *VERSION=10"
Its not replacing. Why? any help...?

perl -ne '$tm = time(); s/(.*)(VERSION=)(.*)$/$1$2$tm/g;' root.c.tmp



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

Date: Tue, 16 Jun 1998 18:23:09 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Cmd line - Help
Message-Id: <Pine.GSO.3.96.980616111923.7978g-100000@user2.teleport.com>

On Tue, 16 Jun 1998, Sudhakar wrote:

> I type this in the unix command line to replace a "char *VERSION=10"
> Its not replacing. Why? any help...?
> 
> perl -ne '$tm = time(); s/(.*)(VERSION=)(.*)$/$1$2$tm/g;' root.c.tmp

Did you realize that you're not generating any output there? As I point
out to my students, if your code doesn't generate any output, someone may
think you're not doing your job. :-)

I think you might want different command line options. Perhaps -p and some
form of -i? But I'm not sure why you use /g on the s///, or whether you
truly intend to call time during every iteration. Hope this helps!

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



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

Date: 16 Jun 1998 19:34:14 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: Perl with ASP?
Message-Id: <slrn6odi66.8go.bjepson@gelvis.ids.net>

On Tue, 16 Jun 1998 13:34:17 -0300, BBQ <warp@internetcom.com.br> wrote:
>Does anyone know if it is possible to use Perl as the default scripting
>language within Active Server Pages (instead of VBScript or JavaScript)?
>
>Somewhere along V. InterDev's documentation it says that it can be done, but
>doesn't exactly tell you much apart from that.
>
>Any hints or pointers?
>

Check out http://www.activestate.com/.  The have a Perl for Win32
distribution there.  If you install that distribution, you can also
grab ActiveState's PerlScript, which allows you to use Perl under
ASP.  Check out http://www.activestate.com/support/ for links
to various FAQs that will answer questions you have along the way.

Hope this helps,

-- 
Brian Jepson * (bjepson@ids.net)  * http://users.ids.net/~bjepson


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

Date: Tue, 16 Jun 1998 13:50:08 -0500
From: Thomas Resing <tresing@globalscape.net>
Subject: Re: Perl5 and the X11 libraries.
Message-Id: <3586BE60.79EA3BDC@globalscape.net>

Stuart McDow wrote:

> Thomas Resing <tresing@globalscape.net> writes:
> >
> > For security reasons, the X11 libraries are restricted from normal
> > users of our linux server.
>
> Security reasons? What security reasons? Did one of your users use
> /usr/X11R6/lib/libX11_s.2.1.0 to hold up a bank?
>
> Splain, please.
>
> --
> Stuart McDow                                     Applied Research Laboratories
> smcdow@arlut.utexas.edu                      The University of Texas at Austin
>             "Look for beauty in roughness, unpolishedness"

I am not sure of the exact reasoning behind restricting the libraries in question.

The person directly responsible for the server is aware of security holes in the
X11 libraries and directed me to find out why -my- program, that is perl, is
accessing the libraries. I could think of no valid reason. however and have not
come across any information that would suggest perl NEEDS X11 to execute
the CGI scripts I need.

Any ideas?

--
 ...............................................
Tom Resing      Programmer/Analyst
GlobalSCAPE     www.globalscape.net
 ...............................................




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

Date: 16 Jun 1998 18:50:45 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: Perl5 and the X11 libraries.
Message-Id: <6m6eq5$mgm4@eccws1.dearborn.ford.com>

Thomas Resing <tresing@globalscape.net> writes:
> I have a question regarding security and Perl.  For security reasons,
> the X11 libraries are restricted from normal users of our linux server.

I'm a little confused how the X *libraries* can cause a security risk.

> ... we have Perl5 installed users without access to the X11 libraries
> get the following error while executing the Perl interpreter:
> 
>   > perl5
>   can't open `/usr/X11R6/lib/libX11_s.2.1.0'
>   Segmentation fault (core dumped)

Perl doesn't use X at all so this error doesn't stem from Perl itself.

The most probable reason I can think of is that somebody built the Tk
module (or some other X module) statically and replaced your normal
perl interpreter with the special one.  That's not a very friendly
thing to do.

You should go harass the person who built the perl executable.

If you don't know who did, open up your X libraries (at least
temporarily) so that you can run "perl5 -V".  That will let you see
whether the X dependency is a configuration problem or a static module
problem.

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: Tue, 16 Jun 1998 18:49:32 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: REGEX HELP
Message-Id: <6m6enr$1fh$1@nnrp1.dejanews.com>

In article <35866700.0@139.134.5.33>,
  "Bob Reynolds" <bob@b-tech.net> wrote:
>
> Hi guys,
>
> Still getting my head about regex's, just when i think ive got it i
> aint.....
>
> there was an app someone told me about that was a regex generator, does
> anyone know what it was and where its living at the moment?
>
> alternatively, can anyone suggest some good regex help pages??
>

Spend $29.95 and get Jeffrey Friedl's Mastering Regular Expressions (O'Reilly
& Associates - www.oreilly.com). Barnes and Noble and others sell the book as
well. It's about 300 pages; read through it once and you'll solve 95% of the
problems you encounter. Read it twice and you'll find uses for regex's that
you never before imagined.

HTH
Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 16 Jun 1998 14:53:28 -0400
From: Aaron Becher <aaron.becher@sdrc.com>
Subject: Returning references to my variables - Safe?
Message-Id: <3586BF28.8A5B0193@sdrc.com>

This is a multi-part message in MIME format.
--------------887E10A8EC2E90D0BE3BF28F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I wrote a subroutine in Perl that, given 2 arrays (@a,@b), gives me back
3 arrays (@onlya,@onlyb,@both). But I'm not 100% sure that the _way_ I
return the 3 arrays from the subroutine is safe:

The subroutine returns references to arrays that are declared with "my"
_in_ the subroutine.

I'm going to attach my Arrays.pl file. Can anybody tell me if this will
always work? It worked just fine in a test-harness script. But I'm a
little worried that maybe I'm just sneaking pass the garbage collector.

Thanks!
Aaron Becher
aaron.becher@sdrc.com


--------------887E10A8EC2E90D0BE3BF28F
Content-Type: application/x-perl; name="Arrays.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Arrays.pl"

require 5.000;  # Make sure nobody running perl4 tries to use me
package Arrays;

;#
;# Aaron Becher - 1998/05/27
;#
;# How to get acces to &Arrays::functions in your code:
;# require "/misc/pdtools/ge/.gepmqc/lib/perl/Arrays.pl";
;#
;# Usage: (*only_a,*only_b,*both)=&Arrays::CompareArrays(\@a,\@b,$subroutine)
;#   This subroutine is passed references to 2 sorted arrays (sorted by "subroutine"):
;#     \@a - Reference to a sorted array
;#     \@b - Reference to a sorted array
;#     subroutine - The name of the subroutine given to the "sort" command
;#                  to sort arrays @a and @b, as in "@a = sort subroutine @array".
;#                  If no subroutine was given to "sort", don't specify a 3rd arguement.
;#   It then returns references to 3 sorted arrays:
;#     @only_a - Contains elements that were in @a but not @b
;#     @only_b - Contains elements that were in @b but not @a
;#     @both   - Contains elements that were in both @a and @b
;#
;# IMPORTANT: If specifying a "subroutine", you must use the fully qualified name
;# of the subroutine: "package::subroutine"
;# Otherwise, you will get the following compilation error:
;# Undefined sort subroutine "Arrays::YOUR_SUBROUTINE" called at .../Arrays.pl line 97.
;#


sub CompareArrays
{
   # Assign the passed in references
   # ??? Can we use "my" instead of "local" ???
   local(*a,*b,$sort_sub)=@_;

   # Define/Initialize some local variables
   my @onlya;
   my @onlyb;
   my @both;
   my $answer;
   my $ia=0;
   my $ib=0;
   my $lasta=$#a;
   my $lastb=$#b;

   # While there are still elements on both arrays:
   # - compare the elements the indices currently point at
   # - push onto correct array
   # - bump up the correct indices
   while ( $ia <= $lasta && $ib <= $lastb )
   {
      # ??? We could get rid of always doing this "if" if I did ???
      # ??? that stuff that constructs the code on the fly.     ???
      if ( $sort_sub )
      {
         $answer=&compare($a[$ia],$b[$ib]);
      }
      else
      {
         $answer = $a[$ia] cmp $b[$ib];
      }

      if    ( $answer < 0 )
      {
         push(@onlya,$a[$ia]);
         $ia++;
      }
      elsif ( $answer > 0 )
      {
         push(@onlyb,$b[$ib]);
         $ib++;
      }
      else
      {
         push(@both,$a[$ia]);
         $ia++;
         $ib++;
      }
   }

   # If there is anything left on either array, push onto correct array
   push(@onlya,splice(@a,$ia));
   push(@onlyb,splice(@b,$ib));

   # Return the references to the 3 arrays
   (\@onlya,\@onlyb,\@both);
}

sub compare
{
   my @list1=@_;
   if ( $list1[0] eq $list1[1] )
   {
      0;
   }
   else
   {
      my @list2 = sort $sort_sub @list1;
      if ( $list2[0] eq $list1[0] )
      {
         -1;
      }
      else
      {
         1;
      }
   }
}
   
1;

--------------887E10A8EC2E90D0BE3BF28F--



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

Date: Tue, 16 Jun 1998 20:11:17 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <pudge-1606981608320001@dynamic404.ply.adelphia.net>

In article <Pine.SOL.3.96.980616091451.7716A-100000@corona.pmel.noaa.gov>,
Nathan Franzen <franzen@pmel.noaa.gov> wrote:

# 5.004) and my Window 95 machine (standard port). When I say that the
# definition does not "appear obviously", I mean that *I*, as a reasonably
# studious perl beginner, haven't seen it). 

I accept that the docs may not be clear, but in this thread, I think it
has been made clear.  I think the docs will be made more clear next time
around.


# Therefore, the statement that "You [which I take to mean 'all Perl
# users'] have been given a completely unambious definition" is not wholely
# true.

You take "you" wrong.  Rahul was specifically given the definition by Tom
C. and others.  I was talking specifically to him.


# Beginners should get documentation that says that the array, the AV, is a
# real thing, and the the list is but a fiction.

But it is not.  That would be an untruth.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Tue, 16 Jun 1998 18:06:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: script that will replace a image and some text on a web page once every day
Message-Id: <Pine.GSO.3.96.980616110436.7978d-100000@user2.teleport.com>

On Tue, 16 Jun 1998, nospam wrote:

> I have been looking many different places for at script
> that will replace a image and some text on a web page
> once every day. But with no luck.

Maybe you want to use cron, or your system's equivalent. Of course, if
you're wishing to merely _find_ a script (as opposed to writing one) this
newsgroup may not be your best resource. Hope this helps!

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



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

Date: Tue, 16 Jun 1998 21:07:03 +0200
From: "nospam" <nospam@nospam.com>
Subject: Re: script that will replace a image and some text on a web page once every day
Message-Id: <3586c43d.0@news4.image.dk>

Thank your for your reply, but I am looking for a script since
I do not know how to write one myself :-(

Could you instead point to an url (or other newsgroup) where
my chances are better than in this newsgroup.

kind regards,

Tony
<tony@byggeinfo.dk>

PS: reply to my private mail address would be greatly appriciated
since I will be unable to check this newsground for the next week.

Tom Phoenix skrev i meddelelsen ...
>On Tue, 16 Jun 1998, nospam wrote:
>
>> I have been looking many different places for at script
>> that will replace a image and some text on a web page
>> once every day. But with no luck.
>
>Maybe you want to use cron, or your system's equivalent. Of course, if
>you're wishing to merely _find_ a script (as opposed to writing one) this
>newsgroup may not be your best resource. Hope this helps!
>
>--
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>




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

Date: Tue, 16 Jun 1998 12:25:06 -0600
From: Michael Owens <mowens@SPAM_DECOY.state.nm.us>
To: Rick Koehler <koehler@nm-us.campus.mci.net>
Subject: Re: Starting an Albuquerque area Perl Mongers group
Message-Id: <3586B882.5E8CE8F2@state.nm.us>

I live in Santa Fe, but might be interested anyway.

Mike Owens
mowens@state.nm.us

Rick Koehler wrote:
> 
> Calling all Albuquerque area perl folks, who might be interested in
> getting together to discuss things Perl.
> 
> Might as well form a Perl Mongers group, as I suspect there's
> enough critical mass around here to do so.
> 
> Haven't seen any sign of a Perl user's group in local papers, etc.,
> nor is any listed at http://www.pm.org , hence this request.
> 
> Rick Koehler


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

Date: Tue, 16 Jun 1998 21:37:02 GMT
From: "Dave" <hannum@oak.cat.ohiou.edu>
Subject: Undefined subroutine CGI::pram
Message-Id: <EunvuK.Bv2@boss.cs.ohiou.edu>

Why do I get this error and what does it mean?

                                       Undefined subroutine CGI::pram

My program parses the contents of one form into the fields of another form.
I do this because I am generating selections boxes based upon the input from
the  previous form.  I believe I'm calling all the needed CGI modules:
                    use CGI qw(:standard :html3);
                    use CGI::Carp qw(fatalsToBrowser);
                    CGI::ReadParse;
                    my $form = new CGI;

I'm using the following format to define the parsed variables:
                        $variable = $form->pram('variable');
I do this because this info is being inserted into another form which will
be executed  as well.

I am not all that familiar with CGI modules and don't know quite what to do
next, short of writing a parse_form_data subroutine.  Please help.

Dave
hannum@oak.cats.ohiou.edu







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

Date: Tue, 16 Jun 1998 15:14:30 -0300
From: Edgar <edgar@sbrt.com>
Subject: Re: Win NT- CGI script help please
Message-Id: <3586B606.BE6793F2@sbrt.com>

Thanks Jim, but it would hardly help, since what I wanto to do is make the my
server work with the mentioned script/cgi interface.
Best regards. ...and still needing a clue.
Edgar.

Jim Bowlin wrote:

> Edgar wrote:
> >
> > Hi,
> >
> > I need some advice if you are so kind:
> >
> > I installed perl 5.004. The last download from the perl site.
> > After playing around quite a while, modifying the registry for IIS I got
> > it to work.
> > However something odd happens.
> >
> > I have a form which calls a script, the script runs, and produces some
> > output.
> > If I change the form input field, the output changes, i.e. the cgi -perl
> > program works fine.
> > BUT when I want to modify the perl program to let's say, print a new
> > title, there is a problem.
> > I modify the program, save it and when I call it using the mentioned
> > form, It still gives me the old output copy, as if the old script was
> > resident in memory. It is as if the program was compiled only once and
> > then that copy used from memory.
> > I tried everything, from restarting the browser, to stopping and
> > restarting the IIS www server.
> > Apparently the only thing that works is to delete the entire
> > subdirectory where the program and form reside. Then stopping IIS www
> > sever, and then coping back the programs and restarting the IIS www
> > server.
> > Even then I think on some occasions it gave me trouble.
> >
> > Any suggestions on how to fix this annoying problem will be greatly
> > appreciated.
> >
> > Best regards.
> > Edgar.
>
> Try a different Web Server.  Xitami from iMatix, for example.
>
> -- Jim Bowlin





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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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 2885
**************************************

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