[11680] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5280 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 1 19:07:26 1999

Date: Thu, 1 Apr 99 16: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           Thu, 1 Apr 1999     Volume: 8 Number: 5280

Today's topics:
        **learn Perl** (Zxcvbzxcvb)
    Re: AIX bug with Getopt::Std? <greg.wimpey@waii*removetomail*.com>
        Apache-sendmail-whichperl (velocity)
        constructing a list of hashes <hojo@i-tel.com>
    Re: constructing a list of hashes (Larry Rosler)
        Cookies on secure servers <primrosesmith@magnet.at>
        Counting files with various extentions (Michael E. Hagin)
        Easy(?) Riddle <ajones@buildandcompare.com>
    Re: Easy(?) Riddle (Bob Trieger)
    Re: Environment control <cassell@mail.cor.epa.gov>
    Re: Environment control (Larry Rosler)
        extracting from text files <acrfrd1@pebble.sct.ucarb.com>
    Re: Extracting Lines That Match With grep? (Tad McClellan)
    Re: Here docs, single quotes, and backslashes (Larry Rosler)
    Re: How can i read a msdos floppy label <tye@metronet.com>
        mod_perl debugging nawkboy@yahoo.com
    Re: my random doesn't return number!! (Bart Lateur)
        Nothing returned from system call backticks <Joeblow@nowhere.com>
        open sql ODBC in perl <losteven@yahoo.com>
    Re: open sql ODBC in perl <gregm@well.com>
    Re: Perl and shell commands ??? (Larry Rosler)
        Perl win32 utility: Clipboard Perl john_intersphere@my-dejanews.com
        Perl+Java jobs (Garynlang)
    Re: Problem... (Larry Rosler)
    Re: quick question... (Larry Rosler)
    Re: quick question... (Larry Rosler)
    Re: quick question... <flavell@mail.cern.ch>
    Re: rotating arrays and files <jglascoe@giss.nasa.gov>
    Re: Running a perl script as a daemon.... (Larry Rosler)
    Re: script for getting <a href> tag in Netscape (Tad McClellan)
    Re: script for getting <a href> tag in Netscape <dermot.musgrove@virgin.net>
    Re: Server Side Includes <larsplessmann@gmx.de>
    Re: Stupid questions <cassell@mail.cor.epa.gov>
    Re: Sun Microsystems Sponsors Perl Mongers (David H. Adler)
    Re: URGENT <fvdm@dds.nl>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 1 Apr 1999 22:04:07 GMT
From: zxcvbzxcvb@aol.com (Zxcvbzxcvb)
Subject: **learn Perl**
Message-Id: <19990401170407.21886.00001192@ng41.aol.com>

http://illogic.cjb.net has tons of perl/CGI tutorials, anyone got any others?


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

Date: 01 Apr 1999 16:39:55 -0700
From: Greg Wimpey <greg.wimpey@waii*removetomail*.com>
To: christianaranda@yahoo.com (Christian M. Aranda)
Subject: Re: AIX bug with Getopt::Std?
Message-Id: <snzp4rewqc.fsf@ddcspn37.denver.waii.com>

christianarandaOUT@OUTyahoo.com (Christian M. Aranda) writes:

> I believe I may have found a bug in the Getopt::Std module.  The
> following code works on (at least) SunOS and AIX:
[snip]
> It seems that on AIX, returning the hash %opt does not work.  If I
> were to put in an option such as -D1999 and then print $opt{D} it has
> no value.
> 
> Additional Info:
> $ uname -a
> AIX aix7 1 4 00019110A000
> 
> $ perl -v
> 
> This is perl, version 5.004_04 built for aix
> 

I tried your code snippet on one of our AIX boxes.  It worked without
a problem.  Specifying the -v flag caused it to print the message, and
the program was silent when the flag was left off the command line.  I
even added another option that takes a value, and it worked too.

My uname info is:

AIX foo 2 4 000067734C00

and perl -v says:

This is perl, version 5.004_04 built for aix

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

So, this could be an AIX 4.1 problem resolved in 4.2, or a problem
perhaps with the way your perl was compiled (or some other yet
unsuspected problem).

Good luck.

-- 
Greg Wimpey  
greg.wimpey@waii*removetomail*.com


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

Date: Thu, 01 Apr 1999 22:01:43 GMT
From: kissqfjg@sp.zrz.tu-berlin.de (velocity)
Subject: Apache-sendmail-whichperl
Message-Id: <3703ec92.13156577@news.zrz.tu-berlin.de>

Hey folks, 

I downloaded a message board. After unzipping I tried to run this
message board on my own computer with ActivePerl and  Windows 95 and
Apache 1.3.3 with the localhost. 

But the message board script needs some informations. They wrote to
start telnet and type in "which perl", "which sendmail" and "which
date" to complete the script.

But I do not get connection with telnet on the localhost. 

I got the following questions : 

1. Is there a possibility to get access - what did I do wrong - Do I
have to download another telnet access ?

2. If  I get access with telnet do I get answered the questions "which
perl", "which sendmail" and "which date" or does somebody know what I
have to type in or download from web ? 

3. Last question : does somebody know a good message board source
easiliy to install and test ?

Thanks for advance 

Henner - kissqfjg@sp.zrz.tu-berlin.de


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

Date: Thu, 01 Apr 1999 22:30:46 GMT
From: hojo <hojo@i-tel.com>
Subject: constructing a list of hashes
Message-Id: <7e0s2m$h7$1@nnrp1.dejanews.com>

I am setting up a list of hashes and would like to know if I can somehow
initialize the hash values to a 0 (the numeric value) straight out.  I would
like to do this because the hash is just counting each time a particular
instance occurs.  Here is an example:

my @record;  #the list
my $new = {}; #my anon hash
---
a record pops up like this
cc|cccode    #country code|call completion code
81|27
81|27
81|01
82|03
81|27
 ...

so the code is counting the cccodes like so:
      #[cc]{ccccode}
$record[81]{27}++; (plus plus if you are seeing little boxxes)  what the hell?
$record[81]{27}++;
$record[81]{01}++; and so on

So, if I run this for the first time, the value in $record[81]{27} is null.
and it complains about plus-plusing and null.  Without specifiying each
key/value how can I set the value to a 0 rather than a null?

Is it possible or am I just being lazy?

=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=

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


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

Date: Thu, 1 Apr 1999 15:46:07 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: constructing a list of hashes
Message-Id: <MPG.116da514d7756ad7989814@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7e0s2m$h7$1@nnrp1.dejanews.com> on Thu, 01 Apr 1999 22:30:46 
GMT, hojo <hojo@i-tel.com >says...
 ...
> $record[81]{27}++; (plus plus if you are seeing little boxxes)  what the hell?
> $record[81]{27}++;
> $record[81]{01}++; and so on
> 
> So, if I run this for the first time, the value in $record[81]{27} is null.
> and it complains about plus-plusing and null.

I have tried this on perl 5.002, 5.003, 5.004, and 5.005, without 
getting any warning messages for incrementing a null value.  The data 
structures get created automatically.

Can you post a tiny program that generates the warning you describe, 
along with the 'perl -v' output?

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


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

Date: Fri, 2 Apr 1999 00:32:37 +0200
From: "Steven Primrose-Smith" <primrosesmith@magnet.at>
Subject: Cookies on secure servers
Message-Id: <7e0ris$hm2$1@orudios.magnet.at>

Hi,

My first foray into secure servers...

I'm using perl to set a cookie on each browser visiting our site. The cookie
is set with the domain .ourserver.com. This allows us to read the cookie
from our servers called www.ourserver.com and www1.ourserver.com, etc.
I need to add some secure scripts using HTTPS. The secure scripts are
on a different server at our hosting company, called

https://secure.hostingco.net/ourserver but the problem is that these scripts
cannot read the cookies because the domain is different.

Should it be possible for the hosting company to somehow alias the server
name to one such as https://secure.ourserver.com and, if so, will the
cookies still work with HTTPS? Failing that, we will need to set up our own
secure server. But the question is: will the cookies work with HTTPS?

Any help greatly appreciated,
Steven
smith@avl.com






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

Date: Thu, 1 Apr 1999 20:38:09 GMT
From: haginme@atl.bna.boeing.com (Michael E. Hagin)
Subject: Counting files with various extentions
Message-Id: <F9J2nL.IrG@news.boeing.com>

Hello,

  I have written a perl script that will traverse a directory and
count up the number of files that have various extentions
(ex: .zip, .gz, .tif, ...). The problem is the find function will
not traverse a link pointing to an automounted directory. Does anyone
have any suggestions? Here is the code:

#!/usr/local/bin/perl 
use Getopt::Std;
use File::Find;
use File::Basename;

# Force find to traverse subdirectories
$FILE::Find::prune=0;

# Subroutine to check for file extentions in the search list
sub chk_exts {
   $ext=(fileparse($File::Find::name,@list))[2];
   if ($ext){++$n{"\\".$ext}};
}

getopts("cgzhdxet");
if ($opt_c){push(@list,'\.z');}
if ($opt_g){push(@list,'\.gz');}
if ($opt_z){push(@list,'\.zip');}
if ($opt_h){push(@list,'\.hpgz');}
if ($opt_d){push(@list,'\.doc');}
if ($opt_x){push(@list,'\.xls');}
if ($opt_e){push(@list,'\.exe');}
if ($opt_t){push(@list,'\.tif');}

# If no options and arguments are given explain how the command is used
if (@ARGV == 0){
    printf("Usage:cnt_exts -cgzhdxet dir1[...dirn]\n");
    exit;
}

foreach $i (@ARGV){
   foreach $j (@list){$n{$j}=0;}
   find(\&chk_exts,$i);
   printf("%-10s ",$i);
   foreach $j (@list){printf("%s=%d ",$j,$n{$j});}
   printf("\n");
}


-- 
Mike Hagin                                     Voice:770-497-5426
System Administrator                           Fax  :770-497-5555
Boeing Defense and Space Group                 Email:Michael.E.Hagin@Boeing.com




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

Date: Thu, 1 Apr 1999 15:13:25 -0800
From: "Adam" <ajones@buildandcompare.com>
Subject: Easy(?) Riddle
Message-Id: <7e0ur7$srd$1@news1.sirius.com>

A seemingly easy problem, my code:

#############################################

$var1 = "$5.99";

$var1 =~ /\$(.*)/;
print "The price for the nick nack is \$$1 ";


#############################################

when I run it I get:

"The price of the nick nack is $ "

When I exchange the "$" in the code/regexp for a "Z" I get

"The price for the nick nack is $5.99"

Q:  How come I get a blank price when I match against the dollar sign, but
number with the "Z"?
Am I escaping things correctly?

Thanks,
Adam




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

Date: Thu, 01 Apr 1999 23:29:08 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Easy(?) Riddle
Message-Id: <7e0vej$gvr$2@fir.prod.itd.earthlink.net>

"Adam" <ajones@buildandcompare.com> wrote:
*>$var1 = "$5.99";
*>$var1 =~ /\$(.*)/;
*>print "The price for the nick nack is \$$1 ";


Either escape the $ in the first line or use single quotes so that the value 
isn't interpolated.

Bob Trieger
sowmaster@juicepigs.com       



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

Date: Thu, 01 Apr 1999 14:34:47 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Environment control
Message-Id: <3703F487.270778AD@mail.cor.epa.gov>

Ryan Eatmon wrote:
> Is there a way to set environment variables in a Perl script and have
> them remain after the script finishes?  Sort of like sourcing a .cshrc
> file?  I have a feeling the answer is no, but I'd like to dream a
> little.

There are ways to fudge this on a number of OSes, but it's really,
really OS-specific.  Is this for web programming?  Then you have
a different set of problems / semi-solutions.  One answer that's
in the FAQ: do it in VMS.  :-)

Have you considered saving the information to a file which can then
be accessed by other programs?  Or am I way off-base about what you
have in mind?

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


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

Date: Thu, 1 Apr 1999 15:27:28 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Environment control
Message-Id: <MPG.116da0b4c62d45eb989811@nntp.hpl.hp.com>

In article <3703DC84.161AEA4B@ti.com> on Thu, 01 Apr 1999 14:52:20 -
0600, Ryan Eatmon <reatmon@ti.com >says...
> 
> Is there a way to set environment variables in a Perl script and have
> them remain after the script finishes?  Sort of like sourcing a .cshrc
> file?  I have a feeling the answer is no, but I'd like to dream a
> little.

That approach should work -- you are saving the environment variables by 
changing the state of the file system, then retrieving them after the 
Perl program terminates.  Here's the FAQ answer:

perlfaq8:  I {changed directory, modified my environment} in a perl 
script. How come the change disappeared when I exited the script? How
do I get my changes to be visible?

Unix

     In the strictest sense, it can't be done -- the script executes as 
a different process from the shell it was started from. Changes to a 
process are not reflected in its parent, only in its own children 
created after the change.  There is shell magic that may allow you to 
fake it by eval()ing the script's output in your shell; check out     
the comp.unix.questions FAQ for details.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 01 Apr 1999 19:06:08 -0500
From: Charlie Fulton <acrfrd1@pebble.sct.ucarb.com>
Subject: extracting from text files
Message-Id: <370409F0.9FA198C6@pebble.sct.ucarb.com>

Hello, 

I am trying to use perl do the following. These are my shell commands that work
for me..
                 
1.) grep -F Stoi $i | cut -d " " -f6 | cut -d "(" -f1 > /tmp/f1               
2.) grep "Zero-point correction" $i | cut -d " " -f31 > /tmp/f2

1. first grep for a line containing "Stoi" and then pipe that line so I can
extract one "field" out of it. Here is the full line for the first one:

Stoichiometry    CH3(1-)


and the output looks like this:

CH3
CH3


another problem is that it get two lines from the file.


2nd one, line looks like this
Zero-point correction=                            .029328 (Hartree/Particle)

i want that number and the output is :

0.29328.


######### My attempt with perl so far #########
#!/usr/bin/perl -w

die "Usage: gaussout [files]\n" unless @ARGV;

foreach $file (@ARGV)
{
        open(INFILE,"$file") || die "could not open $file: $!";
        open(OUTPUT, ">> $file.out") || die "could not write gaussout.text: $!"; 
        
        # While loop for reading in the gaussian output file
        while ($line = <INFILE>)
        {
                # Finds the first line with Stoi in it... now process this
                # use elsif's and regexp's to find the others. 

                if ($line =~ /Stoi/)
                {
                        print OUTPUT "$line";
                }
        }

        while ($line2 = <INFILE>)
        {
                if ($line2 =~ /Zero-point correction/)
                {
                        print OUTPUT "$line";
                }
        }
}

I am a perl newbie so don't laugh at my code :). the output of this program
right now just shows as the whole lines mentioned above, i'm not sure how to do
the equivalent of cut and use the spaces as delimeters, etc. 

Just looking for some hints, tips, etc. Point me to a faq is necessary.

thanks in advance,

-Charlie.


 
-- 
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^^
Charlie Fulton
fultoncr@nospam.earthlink.net (home)

Linux - where do you want to go tommorow?
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^^



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

Date: Thu, 1 Apr 1999 11:01:50 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Extracting Lines That Match With grep?
Message-Id: <e950e7.n1b.ln@magna.metronet.com>

global3@my-dejanews.com wrote:

: Can someone tell me how to use grep or some other code to extract only
: those lines that match the pattern between the pattern matching / /
: lines into an array?

: I used the code below to extract only those lines that don't match
: into the @hits array.

: @hits = grep(! /pattern/i,@lines);
               ^
               ^ delete that character


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


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

Date: Thu, 1 Apr 1999 14:59:28 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Here docs, single quotes, and backslashes
Message-Id: <MPG.116d9a2c817d1e9d98980e@nntp.hpl.hp.com>

In article <slrn7g7h0n.5i0.fl_aggie@stat.fsu.edu> on 1 Apr 1999 19:05:35 
GMT, I R A Aggie <fl_aggie@thepentagon.com >says...
 ... 
> I don't think its a bug in the here-doc -- I would expect that
> result. However, that's not what I would have expected from a
> single-quoted sting. I didn't think _any_ interpolation occured in
> those.
> 
> Apparently that's not completely true. But...from perlop:
> 
>          Customary  Generic        Meaning        Interpolates
>              ''       q{}          Literal             no

There is some small confusion between interpolation (of variables, or of 
special sequences such as "\n" whose value is different from n) and 
escaping (of sequences such as "\\" whose value is the same as \).  In 
single quotes, two escape sequences are supported:  '\'' to allow a 
single-quote character in the string, and '\\' to allow a backslash as 
the last character in the string.

This is documented in perldata (with confusing quotes):

String literals are usually delimited by either single or double quotes. 
They work much like shell quotes: double-quoted string literals are 
subject to backslash and variable substitution; single-quoted strings 
are not (except for ``\''' and ``\\'').

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


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

Date: 1 Apr 1999 16:53:35 -0600
From: Tye McQueen <tye@metronet.com>
Subject: Re: How can i read a msdos floppy label
Message-Id: <7e0tdf$kq6@fumnix.metronet.com>

"Scott G. Hall" <Scott.Hall@GSC.GTE.Com> writes:
) 
) Perl does not have access to the low-level data manipulation you need to
) read an MS-DOS FAT filesystem directly -- which is what you are going to have
) to do.

Not true at all.  I've used Perl to repartition disks, rewrite
boot code, parse FAT file system data structures, etc. without
having to resort to any C code at all.  Reading raw data from a
floppy and extracting FAT file system data such as a volume label
is quite easy in Perl.  The hard part is learning the data formats
involved, which is also a problem when writing this in C.  I no
longer have a Unix system w/ floppy handy or I'd demonstrate it.

Perl lacks many of the limitations of most scripting languages. 
It is a complete language which supports sophisticated data
manipulation.

Perl's major disadvantage compared to C is the extra work it takes
to get access to routines in some library.  However, Perl's access
to standard Unix run-time library functions is complete enough that
it is quite rare to need access to extra libraries when programming
in Perl under Unix.

Many cases of data manipulation can be handled (not strictly
portably) using C "struct"s.  For those cases, C is often a better
choice.  For cases where C "struct"s can't be used, Perl is
probably easier to use.

Perl has other disadvantages compared to C and also has many
advantages compared to C.  I'm not at all interested in a Perl vs.
C discussion.  But your characterizations of Perl are way off.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Thu, 01 Apr 1999 22:51:15 GMT
From: nawkboy@yahoo.com
Subject: mod_perl debugging
Message-Id: <7e0t90$1hs$1@nnrp1.dejanews.com>

I have been trying to run the graphical ptkdb debugger from within
apache/mod_perl.  At least one of the problems appears to be that apache
does not pass along the global environment variables from the environment in
which it was started.  In particular I am speaking of the DISPLAY or
PTKDB_DISPLAY variable.  PERL5OPT appears to successfully carry -d:ptkdb (or
my hacked -d:jimmy2) but DISPLAY doesn't make it.  When I attempt to run
apache I get an error of:

couldn't connect to display ":0" at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/MainWindow.pm line 55.
MainWindow->new() at /usr/local/lib/perl5/5.00502/Devel/ptkdb.pm line 936
        (in cleanup) Can't call method "EnterActions" on unblessed reference
at /usr/local/lib/perl5/5.00502/Devel/ptkdb.pm line 3708.
END failed--cleanup aborted.
run: No such file or directory


I have hacked ptkdb to contain an explict setting of $ENV{'DISPLAY'} and
saved this alongside ptkdb as jimmy2.  When I start apache with PERL5OPT set
to -d:jimmy2 an X window is spawned and I am allowed to place it.  Within 2
or 3 seconds after I allow the window manager to place the ptkdb window the
window goes away.  Using a browser to access the site then generates an
error in the logs of:

raise (1):
 0 0x450a38 PVMG f=00080007 {}(1)
httpd: [Wed Mar 31 21:39:52 1999] [error] Usage $widget->raise(...) at
/usr/local/lib/perl5/5.00502/Devel/jimmy2.pm line 3737.

So it appears that Tk no longer has a good object reference to $widget.

The script that I use to start apache is:

#!/bin/sh
echo "Going to try running apache with ptkdb"
echo "PERL5DB is $PERL5DB"
echo "DISPLAY is $DISPLAY"
echo "PERL5DB_OPTS is $PERL5DB_OPTS"
echo "PTKDB_DISPLAY is $PTKDB_DISPLAY"
echo "PERL5OPT is $PERL5OPT"
echo "PERL5LIB is $PERL5LIB"
/usr/apache/httpd -d /usr/apache -f /usr/apache/conf/httpd.conf

This script is run from another which starts the above script in a chroot.
The calling script is:
#!/bin/ksh
disp=`print $DISPLAY|nawk -F ':' '{print $1}'`
disp_ext=`print $DISPLAY|nawk -F ':' '{print $2}'`
ip=`/usr/sbin/nslookup $disp|grep Address|tail -1|nawk '{print $2}'`
ip_w_ext="${ip}:${disp_ext}"
print "hi jimmy"
print "Using ip_w_ext of $ip_w_ext"
xhost +$disp
opt='-d:ptkdb'
#opt='-d:jimmy2'
perl5db="BEGIN { \$ENV{'DISPLAY'}=\"$ip_w_ext\"; \$DISPLAY=\"$ip_w_ext\"; }"
print "perl5db is $perl5db"
print "big perl5db is $PERL5DB"
/usr/bin/env - PATH=/bin PERL5LIB=/usr/lib/perl5.00502/site_perl
PERL5OPT=${opt} PERL5DB="$perl5db" PERL5DB_OPTS='$DB::no_stop_at_start=1'
PTKDB_DISPLAY
=${ip_w_ext} DISPLAY=${ip_w_ext} /usr/sbin/chroot /usr/chroot/wwwjlc2
/usr/httpd/apache_live/debug_in_chroot


The result of running the calling script (which results in running the other
script as well) is:

emedia3 apache# ./debug_start_d
hi jimmy
Using ip_w_ext of 130.80.150.208:0.0
dhcppc94 being added to access control list
perl5db is BEGIN { $ENV{'DISPLAY'}="130.80.150.208:0.0";
$DISPLAY="130.80.150.208:0.0"; }
big perl5db is
Going to try running apache with ptkdb
PERL5DB is BEGIN { $ENV{'DISPLAY'}="130.80.150.208:0.0";
$DISPLAY="130.80.150.208:0.0"; }
DISPLAY is 130.80.150.208:0.0
PERL5DB_OPTS is $DB::no_stop_at_start=1
PTKDB_DISPLAY is 130.80.150.208:0.0
PERL5OPT is -d:ptkdb
PERL5LIB is /usr/lib/perl5.00502/site_perl
couldn't connect to display ":0" at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/MainWindow.pm line 55.
MainWindow->new() at /usr/local/lib/perl5/5.00502/Devel/ptkdb.pm line 936
        (in cleanup) Can't call method "EnterActions" on unblessed reference
at /usr/local/lib/perl5/5.00502/Devel/ptkdb.pm line 3708.
END failed--cleanup aborted.
run: No such file or directory

No error log is generated in the above case.

If I run the same script with $opt set to -d:jimmy2 (the hacked debugger
which explicitly sets $ENV{'DISPLAY'} within the debugger I get:

emedia3 apache# ./debug_start_d
hi jimmy
Using ip_w_ext of 130.80.150.208:0.0
dhcppc94 being added to access control list
perl5db is BEGIN { $ENV{'DISPLAY'}="130.80.150.208:0.0";
$DISPLAY="130.80.150.208:0.0"; }
big perl5db is
Going to try running apache with ptkdb
PERL5DB is BEGIN { $ENV{'DISPLAY'}="130.80.150.208:0.0";
$DISPLAY="130.80.150.208:0.0"; }
DISPLAY is 130.80.150.208:0.0
PERL5DB_OPTS is $DB::no_stop_at_start=1
PTKDB_DISPLAY is 130.80.150.208:0.0
PERL5OPT is -d:jimmy2
PERL5LIB is /usr/lib/perl5.00502/site_perl
hiemedia3 apache#

The error log has:

INFO: WebFacts package successfully activated.
WebFactsInit: WebFacts package successfully activated.
httpd: [Thu Apr  1 15:28:57 1999] [notice] Apache/1.3.4 (Unix) mod_perl/1.17
configured -- resuming normal operations

The only problem here is that the debugger window goes away and visits to
the site work but result in an error log about Tk (mentioned above).

A natural question to ask is if the graphical debugger works well when
inside the chroot environment when not run from apache/mod_perl.
This seems to work fine.  All the relevant X libraries have been copied into
the chroot environment.  I have also been working on a fake apache approach
to debugging.  Like HTML::Mason but independent of Mason or ePerl.  This
almost works now but it is not nearly as good or as simple as the approach
taken in this posting.

If the reader is not familiar with the Perl/Tk debugger (ptkdb) then you
should go take a look at it.  It is listed in the perl resource (via
www.perl.com <http://www.perl.com> ) under debuggers.  It requires that you
have perl/Tk installed, but that is now painless.  An important note is that
the perl/Tk adjuster widget which comes with perl/Tk is broke.  A repaired
adjuster widget is posted on the comp.lang.perl.tk newsgroup (archives
available from www.dejanews.com) <http://www.dejanews.com)> .  I expect this
adjuster to eventually be found in the standard perl/Tk distribution but
that is not yet the case.  For a couple of months this adjuster is also
available in the code examples section of my job search web page at
www.flash.net/~nawkboy <http://www.flash.net/~nawkboy> .  Once you have this
debugger installed and working correctly it seems to be as good as what
active state is offering with the perl resource kit for Win32.  The good
news is that since it is perl/Tk it runs anywhere perl/Tk does.  Best perl
debugger I have seen for UNIX and as good as the windows debugger by active
state.  Ptkdb is much much better since January so if you saw it before
then, that doesn't count.

Please forward any replies to the newsgroup to my email address as well.
Any help with this problem would be greatly appreciated.

James Lee Carpenter
Jimmy.Carpenter@chron.com
Wk:  (713)220-2937
Fax:  (713)220-6685

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


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

Date: Thu, 01 Apr 1999 23:51:59 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: my random doesn't return number!!
Message-Id: <37040664.342896@news.skynet.be>

Steve Linberg wrote:

>Did you try it?
>
>my @foo = (1, 2, 3, 4, 5);
>for (1..50) {
> print $foo[rand $#foo];
>}
>print "\n";
>for (1..50) {
> print $foo[rand scalar @foo];
>}

Sounds overly complex.

	for (1..50) {
		print 1+int(rand 5);
	}

There.

	Bart.


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

Date: Thu, 1 Apr 1999 18:21:35 -0500
From: "Joe Blow" <Joeblow@nowhere.com>
Subject: Nothing returned from system call backticks
Message-Id: <7e0v0d$95t$1@bashir.ici.net>

Hello All,

I've been experiencing an intermittent problem that is becoming pretty
annoying.

Sometimes, when I use backticks to run a system command, I get nothing
back (even though I should):

For example:

$ls_result = `ls /etc`;


If I put the code in a loop, $ls_results would eventually get set properly:

my $i = 1;
while (1) {
            $ls_result = `ls /etc`;
            last if ( $ls_result ne "" );
            last if ( $i == 100 );
            $i++;
}

I thought it might be a buffering problem, but it still occasionally
returns nothing with buffering turned off.

Could this be a Perl bug, or is there something else that I'm not
taking into account??

I'm running Perl 5.004_04 on Digital UNIX 4.0E if that matters.


Thanks,

Steve




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

Date: 1 Apr 1999 17:28:28 -0500
From: "mary" <losteven@yahoo.com>
Subject: open sql ODBC in perl
Message-Id: <3703f30c@discussions>


Hi everyone,

I'm having a problem in perl.  I try to open up a sql database connection using DBI in perl and I got some error messages.
The error message is "no default driver specified"  But I did install the DBD:ODBC driver, so I didn't know what is wrong.

Anyway, I'm working on the Cybercash project. Anyone has experience on it may be helpful to me.

Thanks

--Posted from EarthWeb Discussions. http://discussions.earthweb.com



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

Date: Thu, 01 Apr 1999 15:12:54 -0800
From: Greg McCann <gregm@well.com>
To: mary <losteven@yahoo.com>
Subject: Re: open sql ODBC in perl
Message-Id: <3703FD76.DD0EDF66@well.com>

I'm also setting up a Cybercash interface.  Although I'm using Win32::ODBC rather than DBD::ODBC (for now), maybe I can help.
You didn't say much about your setup.  What platform are you running on?  What database are you using?  Have you configured
and tested your ODBC data source?

Greg

mary wrote:

> Hi everyone,
>
> I'm having a problem in perl.  I try to open up a sql database connection using DBI in perl and I got some error messages.
> The error message is "no default driver specified"  But I did install the DBD:ODBC driver, so I didn't know what is wrong.
>
> Anyway, I'm working on the Cybercash project. Anyone has experience on it may be helpful to me.
>
> Thanks
>
> --Posted from EarthWeb Discussions. http://discussions.earthweb.com

======================
Gregory McCann
http://www.calypteanna.com

"Be kind, for everyone you meet is fighting a great battle."  Saint Philo of Alexandria





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

Date: Thu, 1 Apr 1999 15:15:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl and shell commands ???
Message-Id: <MPG.116d9df0630899f1989810@nntp.hpl.hp.com>

In article <7e0dam$i6v$1@nnrp1.dejanews.com> on Thu, 01 Apr 1999 
18:19:13 GMT, sriram@eng.ua.edu <sriram@eng.ua.edu >says...
> Hi,  I am trying to output bold charecters form a perl script using $(tput..)
> text $(tput..), as my default shell is ksh. but on excecuting the script, I
> see that perl uses bourne sh to print system commands, and this makes my
> syntax fails.
> 
> I was wondering if there is any way I can make perl to use my default shell
> for all system commands.

I don't think you can change the default, /bin/sh.  But you can 
explicitly name your shell in each invocation of system():

    system "/bin/ksh -c mycommand ..." and die "if it didn't work $?\n";

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


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

Date: Thu, 01 Apr 1999 23:31:05 GMT
From: john_intersphere@my-dejanews.com
Subject: Perl win32 utility: Clipboard Perl
Message-Id: <7e0vjq$3li$1@nnrp1.dejanews.com>

*** Announcing Clipboard Perl ***
Clipboard Perl is a handy Windows 95/98/NT utility which operates directly on
text in the system clipboard. It's great when you're working in a lame text
editor and you want to run a quick perl script on part of the file.

http://www.htksoftware.com/perl/

It also has a regular expression helper if you forgot your camel book!


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


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

Date: 1 Apr 1999 23:32:12 GMT
From: garynlang@aol.com (Garynlang)
Subject: Perl+Java jobs
Message-Id: <19990401183212.20125.00001276@ng16.aol.com>

We have 3 permanent and 5 conract position
available for JAVA and Perl Professionals.
Location: Bay Area and S.California
Exp: 2+ years in JAVA

Please send us your resume if you are interested.
(Sponsorship is available some cases)

Gary Lang
Advanced Control Data
http://www.acdcon.com


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

Date: Thu, 1 Apr 1999 14:31:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problem...
Message-Id: <MPG.116d93a87affe32b989808@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <3703D809.6FC91857@xs4all.nl> on Thu, 01 Apr 1999 22:33:13 
+0200, Frank de Bot <debot@xs4all.nl >says...
> It was realy the idea to prevent the loops, but I think it can only be done as
> you say.

Here is a version without an explicit loop.  Not that I would 
necessarily write it this way.  But it *can* be done.

my $count = () = $string =~ /Perl/g;

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


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

Date: Thu, 1 Apr 1999 14:37:38 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: quick question...
Message-Id: <MPG.116d95048f148728989809@nntp.hpl.hp.com>

In article <7e0fd3$kak$1@nnrp1.dejanews.com> on Thu, 01 Apr 1999 
18:54:32 GMT, apple <jearanai@my-dejanews.com >says...
> Sorry for making you read twice. I am new in this website and new for a
> computer user so I am very appreciated your suggestion. For my reason, I
> don't want to bother you with my second message but I did misspelled in my
> first message like this "usong". Thus, I rephrased the second one just for
> make sure that everyone can know it. It didn't mean that I want to trick you.

Just for the record, I have had success using the 'Cancel Article' 
capability of my newsreader to get rid of the bad post, then resend it 
with the corrected text.  Some readers may see the first version, I I 
think no one should see two versions.

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


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

Date: Thu, 1 Apr 1999 14:56:33 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: quick question...
Message-Id: <MPG.116d997bbf02009298980c@nntp.hpl.hp.com>

In article <7e0fd3$kak$1@nnrp1.dejanews.com> on Thu, 01 Apr 1999 
18:54:32 GMT, apple <jearanai@my-dejanews.com >says...
> Sorry for making you read twice. I am new in this website and new for a
> computer user so I am very appreciated your suggestion. For my reason, I
> don't want to bother you with my second message but I did misspelled in my
> first message like this "usong". Thus, I rephrased the second one just for
> make sure that everyone can know it. It didn't mean that I want to trick you.

Just for the record, I have had success using the 'Cancel Article' 
capability of my newsreader to get rid of the bad post, then resend it 
with the corrected text.  Some readers may see the first version, but I 
think no one should see two versions.

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


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

Date: Fri, 2 Apr 1999 01:17:48 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: quick question...
Message-Id: <Pine.HPP.3.95a.990402011235.28638A-100000@hpplus01.cern.ch>

On Thu, 1 Apr 1999, Larry Rosler wrote:

> Just for the record, I have had success using the 'Cancel Article' 
> capability of my newsreader to get rid of the bad post, then resend it 
> with the corrected text.  Some readers may see the first version, but I 
> think no one should see two versions.

Well, the Cancel message and the corrected posting are two separate
transactions, it's not obvious that they'll stick together all around
usenet. 

When I'm planning to post a corrected version, I simply copy/paste the
Message-id of the old posting into a Supersedes: header in the corrected
version.  Works a treat in my experience.  (But note the exact spelling
of the header!).

best regards



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

Date: Thu, 01 Apr 1999 18:39:28 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Dave Lowry <dave@cinemas-online.co.uk>
Subject: Re: rotating arrays and files
Message-Id: <370403B0.54CF5DF8@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Dave Lowry wrote:
> 
> I have a file that I read into and array, that's the easy bit ...
> 
>   Now I need to take the 1st line of that file (1st element in the array),
> then move this element to the back (deleting the original entry as we go)
> and then re-save the original file
> 
>   Do I have to use Perl's PUSH and POP functions or is there a easier way ??

my @lines = <IN_FH>;
push @lines, shift @lines;  # there, easy as pie  ;^)
print OUT_FH @lines;

	Jay Glascoe


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

Date: Thu, 1 Apr 1999 15:30:10 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Running a perl script as a daemon....
Message-Id: <MPG.116da159a54fc813989813@nntp.hpl.hp.com>

In article <3703CB01.FBD5B4CF@mail.cor.epa.gov> on Thu, 01 Apr 1999 
11:37:37 -0800, David L. Cassell <cassell@mail.cor.epa.gov >says...
> David Delikat wrote:
 ...
> > PPS. ( PSS? ) munch munch, I think I've had enough crow for today.
> 
> Don't worry about it.  You've still made fewer errors on this
> newsgroup than I have.  Or just about anybody else.  Even 
> Randal makes a mistake every decade or so.

And today was the day (see the thread 'random elements from an array').  
So I guess he has about a decade to go before his next mistake.  :-)

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


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

Date: Thu, 1 Apr 1999 10:59:24 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: script for getting <a href> tag in Netscape
Message-Id: <s450e7.n1b.ln@magna.metronet.com>

Don Lee (leehn@ee-wp.bham.ac.uk) wrote:

: but the problem is that the cache page(file) seems to have a random file
: name.

: Hope someone out there, could point me the way .....


   So don't use the cache file then.

   Do File->Save As, give it a name, and a-processing you will go...


   You should use a module such as HTML::Parser for extracting the
   links once you have arranged for a data file to work on.


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


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

Date: Thu, 01 Apr 1999 23:55:45 +0000
From: Dermot Musgrove <dermot.musgrove@virgin.net>
Subject: Re: script for getting <a href> tag in Netscape
Message-Id: <37040781.6DAFD3F5@virgin.net>

Tad McClellan wrote:
> 
> Don Lee (leehn@ee-wp.bham.ac.uk) wrote:
> 
> : but the problem is that the cache page(file) seems to have a random file
> : name.
> 
> : Hope someone out there, could point me the way .....
> 
Hi, there used to be Netscape::Cache and Netscape::History modules on
CPAN, HTH Dermot



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

Date: 1 Apr 1999 23:24:33 GMT
From: Lars Plessmann <larsplessmann@gmx.de>
Subject: Re: Server Side Includes
Message-Id: <37040110.EDC013A@gmx.de>

When I want to initialize such a server side includes, it does not work
in any way!
The Apche server doesn't include the perl script into the shtml file.
What have I done wrong?

that are the error messages in the error_log:

Unquoted string "false" may clash with future reserved word at
/server/domain/cgi-bin/preise.pl line 28.
Name "main::name" used only once: possible typo at
/server/domain/cgi-bin/preise.pl line 11.
Argument "false" isn't numeric in eq at /server/domain/cgi-bin/preise.pl
line 28.


Holger Kasten schrieb:

> Hello, i have a question:
>
> Why does the folowing code not work:
>
> <!--#exec cgi="http://www.xyz.com/cgi-bin/script.pl"-->
> <!--#include virtual="http://www.xyz.com/cgi-bin/script.pl"-->
>
> but this works fine:
>
> <!--#exec cgi="cgi-bin/script.pl"-->
> <!--#include virtual="cgi-bin/script.pl"-->
>
> Isnt it possible to start scripts on other servers?
> Or, how to do so?



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

Date: Thu, 01 Apr 1999 14:24:57 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Stupid questions
Message-Id: <3703F239.DCEB61C6@mail.cor.epa.gov>

Josh ''RudeSka'' Rush wrote:
> I am a perl newbie, but I do know perl, and I have some stupid questions,

So you're learning Perl.  Good.  Have you bought Randal Schwartz's
book 'Learning Perl'?  See my next comment...

> hence my topic -- "Stupid questions."  my first [stupid] question is: how do
> you do CGI with perl?

Short answer: open Randal's book to the chapter on cgi programming,
and enjoy.  Or get the module CGI.pm and Lincoln Stein's book
on running a website, and go from there.

>                       My second: how do you do graphics and/or GUI with
> perl?

Depending on what you want, check out Perl/Tk or one of the 
graphics/manipulation modules (like Perl::Magick).

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


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

Date: 1 Apr 1999 18:29:04 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Sun Microsystems Sponsors Perl Mongers
Message-Id: <slrn7g809v.ok7.dha@panix.com>

On 1 Apr 1999 05:33:47 GMT, brian d foy <comdog@computerdog.com> wrote:
>SUN MICROSYSTEMS SPONSORS PERL MONGERS
[snip]

>David Adler, Ruthless Dictator of NY.class and a director of

That's "Ruthless *Godless* Dictator", dammit!

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Honk if you love Perl! (or strawberries!) - Larry Wall


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

Date: Fri, 2 Apr 1999 00:19:14 +0200
From: "Frank" <fvdm@dds.nl>
Subject: Re: URGENT
Message-Id: <7e0r28$jhs$1@news2.xs4all.nl>

Try Blat.
It's a sendmail program for NT.
You can download it here:
http://gepasi.dbs.aber.ac.uk/softw/Blat.html
Some install documentation:
http://www.g0rvx.demon.co.uk/blat_frame.html
Almost every Perl script will do after that (UNIX versions as well !)
I suggest you use the FormMail script from Matt's Script Archive. It's
simple but good.
http://www.worldwidemart.com/scripts/
Give the absolute path to blat.exe in your Perl script (read script docs for
more information).

I hope this helps. You must be desperate by now ;)

Frank.




Markus Staas wrote in message ...
>I know that I have to configure the path to the e-mail program and the
>specified commands for that.
>BUT I DO NOT KNOW HOW TO SPECIFY THAT FOR OUR SERVER !!!!!!!!
>
>I really tried a lot since 7 days roundabout 8 hours a day and I don4t know
>what to do anymore.
>
>Now my Question :
>
>COULD ANYONE GIVE ME A PERL-SCRIPT, WHICH IS BUILT FOR NT AND MAYBE WITH A
>MAIL PROCESSING PROGRAM FOR OUR SERVER ????????? PLEEEEEASE !!!!
>
>The Server Administrator cannot help me !
>
>Thanks a lot in advance !!!!
>
>Markus Staas
>
>
>
>




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

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

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