[10772] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4372 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 7 13:07:19 1998

Date: Mon, 7 Dec 98 10:00:26 -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           Mon, 7 Dec 1998     Volume: 8 Number: 4372

Today's topics:
        $ENV{'REMOTE_HOST'} Problem on NT (Bill)
        A usable Perl interpreter? (N H)
    Re: Animals and Perl (was Re: newbie file open question <jay@rgrs.com>
        As I was A-Hacking the perl source kmitev@my-dejanews.com
    Re: Beginner Book? <aqumsieh@matrox.com>
    Re: Can I force Perl to run C Shell (or tcsh) ?CGI? <bryan@eai.com>
    Re: Comparing STRING variables in an IF statement <newsposter@cthulhu.demon.nl>
    Re: converting times (Larry Rosler)
        CRC check in Perl (Paul Falbe)
    Re: CRC check in Perl (Greg Bacon)
    Re: deleting line in a textfile? <egwong@netcom.com>
        embedded perl mt safe? <gerhard@uni-x.net>
        file locking info (from the FAQ & real life) (John Klassa)
        function for copying files <tac@smokescreen.org>
    Re: Help with DBI & Perl & Sybase <mpeppler@mbay.net>
    Re: help, what's wrong with this very simple prog? <cbeatson@mail.ci.lubbock.tx.us>
        Help: How to send email with attached multimedia files  wwv1@inclab09.cs.depaul.edu
    Re: How to get name of current sub? <aichner@ecf.teradyne.com>
        How to open a background process in Perl and CGI/Perl? <wtang@flash.net>
    Re: How to open a background process in Perl and CGI/Pe (Sam Holden)
        https and GET (Barry Eimer)
        I hate to ask, but i'm stuck on my logic :-( <daniel.vesma@thewebtree.com>
    Re: Need help getting dir list in V4 <harrisr@ugsolutions.com>
    Re: Need help getting dir list in V4 (Larry Rosler)
        new..  where do I go? <luvbeingmamaNOSPAM@home.com>
    Re: Newbie: Secure directories?? <newsposter@cthulhu.demon.nl>
        Online booking app? <epkriol@lmera.ericsson.se>
        Perl Cookbook (Kevin W. Reed)
        PERL-FTP <brandeda@se.bel.alcatel.be>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Mon, 07 Dec 1998 17:43:59 GMT
From: cdxpl@nospam.yahoo.com (Bill)
Subject: $ENV{'REMOTE_HOST'} Problem on NT
Message-Id: <cdxpl-ya02408000R0712981239470001@24.2.5.71>

Does anybody know why, when I run $ENV{'REMOTE_HOST'}, do I always come up
with an IP address instead of user123.blah.com or whatever?

I'm running the perl script on a Windows NT IIS 4.0 server with the latest
service pack 4 plus the latest built perl from Active State.

Help me please.

Thanks,

Bill
cdxpl@yahoo.com
*NOTE: When replying, remove "nospam." from the return email address.


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

Date: Sun, 06 Dec 1998 15:38:05 GMT
From: nhoop@centuryinter.net (N H)
Subject: A usable Perl interpreter?
Message-Id: <366fa3a8.14021325@news.ot.centuryinter.net>

Yeah, I'm new to perl and just about had it. I downloaded the latest
version, but winzip doesn't like *.gz files. Then I got advise to download
another file, but that needs to be compiled - with WHAT?  AGGGH.

Is there anywhere I can just get a perl interpreter that winzip understands
that will work when unzipped?  

(please e-mail nhoop@centuryinter.net)

Thanks,

Nat



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

Date: 07 Dec 1998 12:58:14 -0500
From: Jay Rogers <jay@rgrs.com>
Subject: Re: Animals and Perl (was Re: newbie file open question)
Message-Id: <82zp8zbzrd.fsf@shell2.shore.net>

Randal Schwartz <merlyn@stonehenge.com> writes:

> >>>>> "Fluffy" == Fluffy  <gerglery@usa.net> writes:
> 
> Fluffy> Jonathan Stowe <gellyfish@btinternet.com> wrote:
> >> This gives rise to another thought regarding an earlier thread -
> >> would a dog walking on the keyboard produce better Perl than a cat ?
> 
> Fluffy> Ha!  Dogs can't program for beans.
> 
> On the Internet, no one knows that you're a programmer.
> 
> :-)

It's sooo funny because it's true.

Of course it didn't use to be that way.


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

Date: Mon, 07 Dec 1998 16:55:39 GMT
From: kmitev@my-dejanews.com
Subject: As I was A-Hacking the perl source
Message-Id: <74h1aa$qc7$1@nnrp1.dejanews.com>

I noticed that there were 492 functions that weren't called from anywhere.

Curious, wot ?

--
Kiril

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


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

Date: Mon, 7 Dec 1998 10:49:54 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Beginner Book?
Message-Id: <x3y3e6sklcc.fsf@tigre.matrox.com>


mellowmark@my-dejanews.com writes:

> 
> In article <72qh3l$gc1$1@nnrp1.dejanews.com>,
>   paulwade@my-dejanews.com wrote:
> > In article <3650788e.14819289@news.newsguy.com>,
> >   jeff.kennedy@natdecsys.com (Jeff Kennedy) wrote:
> > > I need a book geared to an ABSOLUTE BEGINNER!  No perl experience, no
> > > programming experience, no real shell scripting experience.

> The Larry Wall book is good though.

You mean Programming Perl I presume. I strongly disagree if this is
the case. The Camel is NOT for absolute beginners. I would suggest the
Llama (Learning Perl) as a starting point.

Ala



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

Date: Mon, 07 Dec 1998 11:18:56 -0600
From: Bryan Hart <bryan@eai.com>
Subject: Re: Can I force Perl to run C Shell (or tcsh) ?CGI?
Message-Id: <366C0E00.41C6@eai.com>

William Tang wrote:
> 
> Hello,
> Since the Perl runs on Bourne Shell, I can't run my csh scripts in my Perl
> program, and there will be a lot of work if I must to re-write those
> scripts. The question is can I force Perl run on C Shell (or even tcsh)
> (even change some perl source code and re-compile it)?

If these are already in the form of a script, simply use the 

#!/bin/csh
or
#!/bin/tcsh

interpreter line at the beginning of the script, then system(), or ``
the script.

> 
> Another question is I found that Perl CGI program will lose some
> environment variables, like $LD_LIBRARY_PATH (on SunOS), I can see it from
> Perl script, but when I put it into CGI program, the $ENV{LD_LIBRARY_PATH}
> is undefined, I must define it manually. Is it true that some of the
> environment variables will be undefined in CGI program?

Environmetn variable in CGI are based on those defined for the webserver
user and/or root (depending on the system).  This means that your user
environment settings might be seen when running the script from the
command line, but not from CGI.  The easiest way to see what enviroment
variables are available is to use the following as a CGI:

#!/path/to/perl

print "Content-type:text/plain\n\n";
foreach (keys %ENV){
	print "$_: $ENV{$_}\n";
}

Bryan


> 
> Thanks.

-- 
------------------------------------------------------------
|  Bryan Hart                 |  Phone: (515) 296-5979     |
|  Network Products Engineer  |  Fax: (515) 296-7025       |
|  Engineering Animation Inc. |  Email: bryan@eai.com      |            
|                             |  WWW: http://www.eai.com/ 
|                         
------------------------------------------------------------


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

Date: Sat, 05 Dec 1998 12:30:48 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Comparing STRING variables in an IF statement
Message-Id: <36696DC8.EAB745D4@cthulhu.demon.nl>

Cybernetic Bear wrote:
> 
> I am trying to write a PERL script that will print a response to the
> screen based on a user-inputed name. I have a list of names in a
> standard array. I only want to print the response that corresponds to
> the user-inputed name and none of the others.


> for ( $i=0 ; $i<=2 ; $i++ ) {
>             if ($name[$1] == $username){print("$name[$i]");}
                        ^^  ^^
- Shouldn't that be $i instead of $1 ? If you can't see the difference,
  better use a different/larger font.
- string comparison operator is 'eq', not ==, which is numerical comparison.

> }

Erik



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

Date: Mon, 7 Dec 1998 08:09:46 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: converting times
Message-Id: <MPG.10d59da47c0c0b6f989945@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <oeezp905jeh.fsf@alpha.hut.fi> on 07 Dec 1998 12:35:50 +0200, 
Jarkko Hietaniemi <jhi@alpha.hut.fi> says...
 ...
> 	$blah =~ s/((?:\d\d?):)?(\d\d):(\d\d(\.\d+)?)/(defined$1?$1:0)*3600+$2*60+$3/e

This grabs the ':' into $1.  Probably want to reverse the capture/non-
capture:

       $blah =~ s/(?:(\d\d?):)? ...

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


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

Date: 7 Dec 98 15:39:03 GMT
From: paul@cassens.com (Paul Falbe)
Subject: CRC check in Perl
Message-Id: <17584.913045143@cassens.com>

Has any one implemented a CRC check function in Perl?  I have the following
C function which does the check.

The CRC is computed using a CCITT polynomial function.

unsigned short CalcCRC(unsigned char *buf, int size)
{
unsigned short crc_calc;
unsigned short ch;
unsigned char I;

crc_calc=0xFFFF; /* initialize the CRC value */
while ( size-->0) {
   ch=(unsigned short)*buf++;
   for (I=8;I>0;I--) {
      if ((ch^crc_calc) & 0x0001) {
         crc_calc=((crc_calc>>1)^0xA001);}
      else {
         crc_calc>>=1;}
    
      ch=ch>>1;
      }
   }
return(crc_calc);

}

Any help would be appreciated!

-Paul
--
Internet:             | Paul J. Falbe             |                          
   falbe@cassens.com  | Cassens Transport         | Std disclaimers apply.   
Voice:                | 145 N. Kansas Str.        |  (But you knew that!)    
   618-656-3006       | Edwardsville, IL 62025    |                          


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

Date: 7 Dec 1998 17:04:50 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: CRC check in Perl
Message-Id: <74h1ri$ikt$4@info.uah.edu>

In article <17584.913045143@cassens.com>,
	paul@cassens.com (Paul Falbe) writes:
: Has any one implemented a CRC check function in Perl?  I have the following
: C function which does the check.

Why not write an XS wrapper around it?

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-12-07 11:02 CST by <gbacon@ettsn>.
# Source directory was `/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    386 -rw-rw-r-- CRC/Makefile.PL
#    174 -rw-rw-r-- CRC/CRC.pm
#    674 -rw-rw-r-- CRC/CRC.xs
#     43 -rw-rw-r-- CRC/MANIFEST
#    707 -rw-rw-r-- CRC/test.pl
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh27030; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= CRC/Makefile.PL ==============
if test ! -d 'CRC'; then
  $echo 'x -' 'creating directory' 'CRC'
  mkdir 'CRC'
fi
if test -f 'CRC/Makefile.PL' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'CRC/Makefile.PL' '(file already exists)'
else
  $echo 'x -' extracting 'CRC/Makefile.PL' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'CRC/Makefile.PL' &&
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
X    'NAME'      => 'CRC',
X    'VERSION_FROM' => 'CRC.pm', # finds $VERSION
X    'LIBS'      => [''],   # e.g., '-lm' 
X    'DEFINE'    => '',     # e.g., '-DHAVE_SOMETHING' 
X    'INC'       => '',     # e.g., '-I/usr/include/other' 
);
SHAR_EOF
  $shar_touch -am 1207104698 'CRC/Makefile.PL' &&
  chmod 0664 'CRC/Makefile.PL' ||
  $echo 'restore of' 'CRC/Makefile.PL' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'CRC/Makefile.PL:' 'MD5 check failed'
4ecad5f989cb80d0f6691def44b24ea3  CRC/Makefile.PL
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CRC/Makefile.PL'`"
    test 386 -eq "$shar_count" ||
    $echo 'CRC/Makefile.PL:' 'original size' '386,' 'current size' "$shar_count!"
  fi
fi
# ============= CRC/CRC.pm ==============
if test -f 'CRC/CRC.pm' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'CRC/CRC.pm' '(file already exists)'
else
  $echo 'x -' extracting 'CRC/CRC.pm' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'CRC/CRC.pm' &&
package CRC;
X
use strict;
use vars qw($VERSION @ISA);
X
require Exporter;
require DynaLoader;
X
@ISA = qw(Exporter DynaLoader);
$VERSION = '0.01';
X
bootstrap CRC $VERSION;
X
1;
SHAR_EOF
  $shar_touch -am 1207104698 'CRC/CRC.pm' &&
  chmod 0664 'CRC/CRC.pm' ||
  $echo 'restore of' 'CRC/CRC.pm' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'CRC/CRC.pm:' 'MD5 check failed'
7342bbfc8f8a14867b4def57dc183148  CRC/CRC.pm
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CRC/CRC.pm'`"
    test 174 -eq "$shar_count" ||
    $echo 'CRC/CRC.pm:' 'original size' '174,' 'current size' "$shar_count!"
  fi
fi
# ============= CRC/CRC.xs ==============
if test -f 'CRC/CRC.xs' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'CRC/CRC.xs' '(file already exists)'
else
  $echo 'x -' extracting 'CRC/CRC.xs' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'CRC/CRC.xs' &&
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
X
MODULE = CRC               PACKAGE = CRC
X
void
Calc(buf, size)
X    unsigned char *buf;
X    size_t size;
X    PREINIT:
X    unsigned short crc_calc = 0xffff;
X    unsigned short ch;
X    unsigned char I;
X    CODE:
X    ST(0) = sv_newmortal();
X    while (size-- > 0) {
X        ch = (unsigned short) *buf++;
X        for (I = 8; I > 0; I--) {
X            if ((ch ^ crc_calc) & 0x0001)
X                crc_calc = ((crc_calc >> 1) ^ 0xA001);
X            else 
X                crc_calc >>= 1;
X            ch >>= 1;
X        }
X    }
X    sv_setiv(ST(0), crc_calc);
SHAR_EOF
  $shar_touch -am 1207110098 'CRC/CRC.xs' &&
  chmod 0664 'CRC/CRC.xs' ||
  $echo 'restore of' 'CRC/CRC.xs' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'CRC/CRC.xs:' 'MD5 check failed'
bb16e6152267e6213139d332e626e89e  CRC/CRC.xs
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CRC/CRC.xs'`"
    test 674 -eq "$shar_count" ||
    $echo 'CRC/CRC.xs:' 'original size' '674,' 'current size' "$shar_count!"
  fi
fi
# ============= CRC/MANIFEST ==============
if test -f 'CRC/MANIFEST' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'CRC/MANIFEST' '(file already exists)'
else
  $echo 'x -' extracting 'CRC/MANIFEST' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'CRC/MANIFEST' &&
CRC.pm
CRC.xs
MANIFEST
Makefile.PL
test.pl
SHAR_EOF
  $shar_touch -am 1207105898 'CRC/MANIFEST' &&
  chmod 0664 'CRC/MANIFEST' ||
  $echo 'restore of' 'CRC/MANIFEST' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'CRC/MANIFEST:' 'MD5 check failed'
0f5b0c3c9e6e5b2045e7df2340a35cfd  CRC/MANIFEST
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CRC/MANIFEST'`"
    test 43 -eq "$shar_count" ||
    $echo 'CRC/MANIFEST:' 'original size' '43,' 'current size' "$shar_count!"
  fi
fi
# ============= CRC/test.pl ==============
if test -f 'CRC/test.pl' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'CRC/test.pl' '(file already exists)'
else
  $echo 'x -' extracting 'CRC/test.pl' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'CRC/test.pl' &&
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
X
######################### We start with some black magic to print on failure.
X
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
X
BEGIN { $| = 1; print "1..2\n"; }
END {print "not ok 1\n" unless $loaded;}
use CRC;
$loaded = 1;
print "ok 1\n";
X
######################### End of black magic.
X
# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
X
print "# ", CRC::Calc("abcdefg", 7), "\n";
print "ok 2\n";
SHAR_EOF
  $shar_touch -am 1207105998 'CRC/test.pl' &&
  chmod 0664 'CRC/test.pl' ||
  $echo 'restore of' 'CRC/test.pl' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'CRC/test.pl:' 'MD5 check failed'
7ab0b444aeb070a9bd5a40f57a7d4ec1  CRC/test.pl
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CRC/test.pl'`"
    test 707 -eq "$shar_count" ||
    $echo 'CRC/test.pl:' 'original size' '707,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh27030
exit 0
-- 
We have enough youth, how about a fountain of SMART?


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

Date: Mon, 7 Dec 1998 16:38:32 GMT
From: Eric Wong <egwong@netcom.com>
Subject: Re: deleting line in a textfile?
Message-Id: <egwongF3Lsw8.1MG@netcom.com>

Remo Goetschi <remo.goetschi@bigfoot.com> wrote:
: granted that I have a textfile (staff.txt) like this one:

: Remo Goetschi;4821;remo.goetschi@entreprise.com
: Michael Smith;125;michael.smith@entreprise.com
: Eddie Miller;4587;eddie.miller@entreprise.com
: Megan Riley;4581;megan.riley@entreprise.com

: Now I need a little perl programm that deletes the line matching to the
: string "Eddie Miller;4587;eddie.miller@entreprise.com" from the
: textfile.
: Who can help me?

You can do it from the command line
  % perl -ni.bak -e 'print unless ( /^Eddie Miller/ );'  staff.txt

The perlrun manpage details what each command line switch does.
The original file will be saved as "staff.txt.bak".

HTH,
Eric

[ cc'd ]


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

Date: Mon, 07 Dec 1998 17:56:42 +0100
From: Gerhard Kutzelnigg <gerhard@uni-x.net>
Subject: embedded perl mt safe?
Message-Id: <366C08CA.3D0C320F@uni-x.net>

Hi again,

I am just trying again to ask, since nobody could tell me... Does
anybody know if (or how) embedding perl in c/c++ can be made really
multi-thread-safe? It seems that perl uses global variables although
there is a perl_alloc () for each unique interpreter.

Looking at perl.h, I found a CPerlObj C++ class that should work the way
I mean, but there is no documentation for that class. So even an answer
for using plain C only would be very appreciated.:)

thanks
gerry




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

Date: 7 Dec 1998 14:51:23 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: file locking info (from the FAQ & real life)
Message-Id: <74gq1b$kp0$1@aurwww.aur.alcatel.com>

I'm helping a colleague to write a web-based application for making
engineering rework requests...  He's got data that shouldn't be tromped
upon by other folks running the same tool, so he's interested in file
locking.

I coded up a test to see if "flock" would work in our environment (given
the warnings in the documentation, I figured it'd be best to see real
results, on our system).  My tests demonstrated that file locking works
nicely...

My colleague is less than satisfied, however, that his code will continue
to work if somebody decides to rebuild perl with different options set.

Can anybody offer advice on how to proceed?  What makes flock not work
sometimes?  What can I do to be sure flock will continue to work for us
(given that perl is built and installed in a manner that's out of my
hands)?  Thanks...

-- 
John Klassa / Alcatel / Raleigh, NC, USA / $perl_monger{Raleigh}[0] / <><


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

Date: Mon, 07 Dec 1998 15:25:31 GMT
From: "Michael Tacelosky" <tac@smokescreen.org>
Subject: function for copying files
Message-Id: <LrSa2.11$qZ3.41734@client.news.psi.net>

I've read the chapter on File and Directory manipulation, and can't seem to
find the simple command to copy a file from one directory to another, or
from one name to another.

The rename() function is close, but I don't want to delete the original.

This seems so simple -- can anyone point me in the right direction?

TIA,

Tac

PS I'm using perl5 under NT, but I'm hoping that the copy function is not
OS-specific.

Smokescreen Action Network
http://www.smokescreen.org
e-mail: tac@smokescreen.org
"Raise Tobacco Taxes. Provide Smokefree Environments. No immunity."




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

Date: Mon, 07 Dec 1998 08:12:32 -0800
From: Michael Peppler <mpeppler@mbay.net>
To: "Jaymes H. Sorbel" <info@chrislands.com>
Subject: Re: Help with DBI & Perl & Sybase
Message-Id: <366BFE70.81C26305@mbay.net>

"Jaymes H. Sorbel" wrote:
> 
> I am relatively new to PERL and I am having problems with the following line
> of code.
> 
> $inwriter->execute(\$Form{'username'}, \$Form{'password'},
> \$Form{'lastname'}, \$Form{'firstname'}, \$Form{'initial'},
> \$Form{'address'}, \$Form{'city'}, \$Form{'state'}, \$Form{'zip'},
> \$Form{'phone'}, \$Form{'email'}, \$Form{'articles'}, \$Form{'employee'});
> 
> The \ before each variable is the last attempt - then I received the error
> "ct_param() failed!"   Before
> adding the \ I received the error "unable to bind non-scalar variable"

I think you're hitting a bug in DBD::Sybase.

try this patch to dbdimp.c:

*** /tmp/T0a005_o	Mon Dec  7 08:11:21 1998
--- dbdimp.c	Mon Dec  7 06:54:59 1998
***************
*** 1863,1870 ****
  	name = SvPV(ph_namesv, name_len);
      }
  
!     if (SvTYPE(newvalue) > SVt_PVMG)    /* hook for later array logic   */
          croak("Can't bind non-scalar value (currently)");
  
      if (dbis->debug >= 2)
  	fprintf(DBILOGFP, "bind %s <== '%.200s' (attribs: %s)\n",
--- 1875,1884 ----
  	name = SvPV(ph_namesv, name_len);
      }
  
!     if (SvTYPE(newvalue) > SVt_PVLV)    /* hook for later array logic   */
          croak("Can't bind non-scalar value (currently)");
+     if (SvTYPE(newvalue) == SVt_PVLV && is_inout)       /* may allow later */
+ 	croak("Can't bind ``lvalue'' mode scalar as inout parameter (currently)");
  
      if (dbis->debug >= 2)
  	fprintf(DBILOGFP, "bind %s <== '%.200s' (attribs: %s)\n",


Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com


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

Date: Mon, 7 Dec 1998 08:37:44 -0600
From: "Chris Beatson" <cbeatson@mail.ci.lubbock.tx.us>
Subject: Re: help, what's wrong with this very simple prog?
Message-Id: <74gpg6$q7f$1@spider.ci.lubbock.tx.us>



>i'm brand new to this lang.  I'm trying to write a simple prog to open an

>syntax error line 13, near "}"
\

># open the file
>open (INFILE,"CSES.DMP") or die "Can't open CSES.DMP file. Error code:
$!\n"

Needs a semicolon at the end of this line.
CB




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

Date: Mon, 07 Dec 1998 10:34:16 -0600
From: wwv1@inclab09.cs.depaul.edu
Subject: Help: How to send email with attached multimedia files uploaded from a form?
Message-Id: <366C0388.F0030AC0@hotmail.com>

Hello,
       I'm a new user of perl. Is there anybody can tell me how to send
email with attached files uploaded from a form? I'm using HP Unix
platform and Apache server.

       Any help will be greatly appreciated. Thank you.

Jane



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

Date: 07 Dec 1998 18:07:39 +0100
From: Adrian Aichner <aichner@ecf.teradyne.com>
Subject: Re: How to get name of current sub?
Message-Id: <ur9ub98ys.fsf@ecf.teradyne.com>

>>>>> "Tony" == Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> writes:

    Tony> Re: How to get name of current sub?, APA
    Tony> <aichner@ecf.teradyne.com> said:

    APA> I wondered if there is a general way to access
    APA> the name of the current subroutine in perl.

    Tony> perldoc -f caller

Thanks Tony!

I even came across caller once.  There is so much perldoc and so
little brain :-)

Indebted[1],

Adrian

    Tony> e.g.

    Tony>     -- banana.perl --
    Tony>     sub banana {
    Tony>         my ($package, $filename, $line, $subroutine,
    Tony>             $hasargs, $wantarray, $evaltext, $is_require) = caller(0);
    
    Tony>         print "$filename:$line: calling $subroutine";
    Tony>         print '(', join(',', @_), ')' if $hasargs;
    Tony>         print "\n";
    Tony>     }
    
    Tony>     &banana(1, 2, 3, 4);
    Tony>     -- end --

    Tony>     ==> banana.perl:11: calling main::banana(1,2,3,4)

    Tony> hth
    Tony> tony
    Tony> -- 
    Tony> Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
    Tony> Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
    Tony> "You see? You see? Your stupid minds!  | private email:
    Tony>     Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>

Footnotes: 
[1]  In the first sense found in http://www.m-w.com/cgi-bin/dictionary 
     :-)



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

Date: 7 Dec 1998 15:52:06 GMT
From: "William Tang" <wtang@flash.net>
Subject: How to open a background process in Perl and CGI/Perl?
Message-Id: <01be21f8$5074f200$5d68b9a3@wtang-sgl.sugar-land.geco-prakla.slb.com>

Hello, I have trouble on opening a background process in my Perl CGI
program.
In UNIX C, I can do it like:
if((childpid=fork())==0) {
    if( (setpgid(getpid(),getpid())== -1)    exit(1);
    executethebackgroundcommandhere();
    exit(1);
} else { parentprocesshere(); }
exit(0);

Can I find any similar method in Perl (or special module) to do the same
job, or in Perl CGI application, there is no way to open a background
process? I'm on Solaris2.5.1 with Perl5.004 and Apache1.3.3. Thanks



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

Date: 7 Dec 1998 16:06:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How to open a background process in Perl and CGI/Perl?
Message-Id: <slrn76nv83.4n7.sholden@pgrad.cs.usyd.edu.au>

On 7 Dec 1998 15:52:06 GMT, William Tang <wtang@flash.net> wrote:
>Hello, I have trouble on opening a background process in my Perl CGI
>program.
>In UNIX C, I can do it like:
>if((childpid=fork())==0) {
>    if( (setpgid(getpid(),getpid())== -1)    exit(1);
>    executethebackgroundcommandhere();
>    exit(1);
>} else { parentprocesshere(); }
>exit(0);

If you really just want to do a C->perl translation then have a look at
the POSIX module which allows you to do :

use POSIX;

if(($childpid=fork())==0) {
    exit 1 unless defined setpgid($$,$$);
    executethebackgroundcommandhere();
    exit(1);
} else { parentprocesshere(); }
exit(0);

sub executethebackgroundcommandhere {};
sub parentprocesshere {};

Of course that's very C-like perl but I guess that's OK...
I'd do it different myself - but it's 3am and I can't be bothered.

perlfaq8 :  How do I fork a daemon process?

might explain a more correct way of doing it (the above leaves stdin, stdout,
etc open).

-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


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

Date: Mon, 07 Dec 1998 15:21:33 GMT
From: beimer@uu.net (Barry Eimer)
Subject: https and GET
Message-Id: <366bf184.246370495@news1.alterdial.uu.net>


Can someone please show me a way to GET a document from an SSL server?
The problem that I am having is that something in the server is
causing erratic GET failures and I want to examine the headers,
however LWP does not support SSL. 

Any ideas will be greatly appreciated.
Barry



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

Date: Mon, 7 Dec 1998 17:39:38 -0000
From: "Daniel Vesma" <daniel.vesma@thewebtree.com>
Subject: I hate to ask, but i'm stuck on my logic :-(
Message-Id: <366c12e6.0@news.thefree.net>

Hi,

I'm trying to write a basic forum script. I've got this far with the script
that shows the user what messages are available. It's current form is an App
rather than a CGI for debugging.

The script should output something like

Person1 talks about subject 1
Person2 talks about subject 1
Person2 talks about subject 2
Person1 talks about subject 2

But It doesn't. It just shows

Person 1 talks about subject 1
Person 2 talks about subject 2

Both files are bellow. Thanks for any help. This is kinda urgent.

Daniel Vesma
www.thewebtree.com
www.thewebtree.com/daniel-vesma

SCRIPT
*********
open(ChatRoomFile, 'chat.txt') or die("can't find it");

$current = 1;

    while(<ChatRoomFile>)
      {

             ($ID, $N, $Name, $email, $subject, $Message) = split(/\|/, $_);

                 if($ID == $current)
                   {

                      print "\n$Name talks about $subject";

                   }
                      $current++;
      }

chat.txt
********
1|1|Person 1|daniel.vesma@thewebtree.com|subject 1|subject 1. Lets talk.
2|1|Person 2|jeff@thewebtree.com|subject 2|subject 2. Lets talk.
1|2|Person 2|jeff@thewebtree.com|subject 1|subject 1. Reply.
2|2|Person 1|daniel.vesma@thewebtree.com|subject 2|subject 2. Reply.





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

Date: Sun, 06 Dec 1998 02:32:54 -0500
From: Randy Harris <harrisr@ugsolutions.com>
Subject: Re: Need help getting dir list in V4
Message-Id: <366A3325.99DEA2EB@ugsolutions.com>

Further explanation:

opendir (DIRECT, $datadir)  ||  die "Could not access the data
directory!";
    @dirs = grep ( -d , readdir DIRECT ) ;
closedir DIRECT;
print "@dirs" ;

On NT returns list of all dirs (including . and .. ).  On Unix only
returns . and ..

I've tried dozens of different approaches, I'm stuck.


Randy Harris wrote:

> I need to read in a list of subdirectories.
>
> This sub works nicely in Perl 5:
>
> sub GetDataDirList {
>  opendir (DIRECT, $datadir)  ||  die "Could not access the data
> directory!";
>       # get all dirs (-d), avoid . and .. -
>     @dirs = grep ( -d && !/^\./, readdir DIRECT ) ;
>  closedir DIRECT;
> }
>
> I can't come up with syntax to make it work in Perl 4 (HP-UX).
> Any suggestions appreciated (even untested).



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

Date: Mon, 7 Dec 1998 07:57:02 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need help getting dir list in V4
Message-Id: <MPG.10d59aa8bdf67d7b989944@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <366A3325.99DEA2EB@ugsolutions.com> on Sun, 06 Dec 1998 
02:32:54 -0500, Randy Harris <harrisr@ugsolutions.com> says...
> opendir (DIRECT, $datadir)  ||  die "Could not access the data
> directory!";
>     @dirs = grep ( -d , readdir DIRECT ) ;
> closedir DIRECT;
> print "@dirs" ;
> 
> On NT returns list of all dirs (including . and .. ).  On Unix only
> returns . and ..

      @dirs = grep ( -d "$datadir/$_", readdir DIRECT ) ;

Evidently, on NT your current directory is $datadir. On Unix it isn't.

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


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

Date: Mon, 07 Dec 1998 17:04:04 GMT
From: "Me" <luvbeingmamaNOSPAM@home.com>
Subject: new..  where do I go?
Message-Id: <8UTa2.7$Pd4.248850@news.rdc1.on.wave.home.com>

Hi there!
I am totally new to this perl programming and am trying the Perl Builder
program.  I am looking for places where I can find "dummy" help and would
like to request either...
1- a newsgroup where questions on programming (or help for it) would be
appropriate...
2- or where I could find dummy help.  :o)

Any kind response would be greatly appreciated.

Sincerely,
Kelly

--
Remove the obvious from my email.
Spam is not welcome nor read!




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

Date: Sat, 05 Dec 1998 12:21:24 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Newbie: Secure directories??
Message-Id: <36696B94.9DD7369A@cthulhu.demon.nl>

"Christian H. Knudsen" wrote:
> 
> I have a directory with a 700 permission. I would like a script
> to be able to change the permission to 777 (for example),
> write some files in the dir and the chmod back to 700. The
> reason for this is that I would like the files in the dir to be
> hidden from any users, as it will contain secret info like
> passwords and user names.
> 
> My problem is that the script (naturally) isn't able to chmod
> the dir to 777 because of the 700 permission!
> 
> Any ideas?

Yeah, don't post the same message you posted some days ago. Go
learn about directory/file permissions user/group names etc.

Erik




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

Date: Mon, 07 Dec 1998 16:18:44 +0100
From: Rickard Olsson <epkriol@lmera.ericsson.se>
Subject: Online booking app?
Message-Id: <366BF1D4.1A8ECA61@lmera.ericsson.se>

I'm looking for a simple as possible web based online booking app. I've
scanned several CGI resources for one without any success. Does someone
out there know about such an app?

It shall be used by our sports section and replace current mailing list.

It should at least be able to:
- book yourself on specified occasion.
- cancel your own booking.
- view a list of attendants
- configurable number of attendants for specified occasion.
- be free of charge

Nice to have but not necessary:
- have a standby list
- notify/mail standbyers when a booking has been canceled

Thanks
/Rickard Olsson


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

Date: 7 Dec 1998 11:01:19 -0500
From: kreed@franklin.silcpa.org (Kevin W. Reed)
Subject: Perl Cookbook
Message-Id: <366bfbcf.0@news.redrose.net>

The Perl Cookbook from O'Reilly is pretty good.  Just got it for a
B-Day... Lots of solutions in it....



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

Date: Mon, 07 Dec 1998 17:42:01 +0100
From: David Van den Brande <brandeda@se.bel.alcatel.be>
Subject: PERL-FTP
Message-Id: <366C0559.FA3907AD@se.bel.alcatel.be>

Hi,

I would like to ftp the latest modified file in a remote directory to my

local machine.
I also would like to give this file a different name on my local
machine: the concatenation of a string variable with the original name.
The problem is that I can't do it manual with, for example xftp, (I must

perform this same task for several hundred directories), so I'm writing
a perl/shell script for it.
How can I do This?

In short: I need (an) ftp command(s) to get the latest modified file in
a directory and
copy it to a file (on my machine) witch is the concatenation of a string

variable with the original filename.

Thanks in advance,
David

--
          V              David Van den Brande, Trainee at
  -----------------      Alcatel Switching VE27
 |  A L C A T E L  |     Fr. Wellesplein 1 - 2018 Antwerp - Belgium
  -----------------      mailto:brandeda@se.bel.alcatel.be





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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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