[8150] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1768 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 30 08:08:58 1998

Date: Fri, 30 Jan 98 05:00:45 -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           Fri, 30 Jan 1998     Volume: 8 Number: 1768

Today's topics:
        %ENV under mod_perl <mike@hq.npc.co.th>
    Re: Another "uninitialized variable" problem <ged@fortec.tuwien.ac.at>
    Re: check URL <sbekman@iil.intel.com>
    Re: Converting to Leadingcap format? <tchrist@mox.perl.com>
    Re: email address <tchrist@mox.perl.com>
        Getting error using mkdir <nahabedian@mail.dec.com>
        Help: Can clients use select? <charles.nahhas@ans.alcatel.co.uk>
        How does REMOTE_USER work <lsmeets@best.ms.philips.com>
        How to use File::Copy::copy() with Mail::Send? <ets@egnetz.uebemc.siemens.de>
    Re: HTML/CGI to play midi file? <flavell@mail.cern.ch>
    Re: local() scoping rules - unusual results <tchrist@mox.perl.com>
        perl indexingengine <marthy@feskar.net>
    Re: perl on line documentation? <sbekman@iil.intel.com>
        perldoc -k: apropos functionality for perl scripts? <stephen@cogsci.ed.ac.uk>
    Re: Problems converting Bourne shell to Perl (Tad McClellan)
    Re: regex with variables? (Doug)
        require "./setup.pl"; # with relative path never works  <david@thames.com>
        require "./setup.pl"; never works for me! <david@thames.com>
    Re: require "./setup.pl"; never works for me! <xxTony.Curtis@vcpc.univie.ac.at>
    Re: Sending data to a printer?? <tchrist@mox.perl.com>
        Sending mail from NT4.0 <lyshaugl@oslo.geco-prakla.slb.com>
    Re: Some possible bugs shaker@netusa1.net
        Strings to integers HELP please <rippo@kc3ltd.co.uk>
    Re: Why can't I unzip? <tchrist@mox.perl.com>
    Re: Writing Multilingual Software philippe.verdret@eurolang.fr
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 30 Jan 1998 16:08:44 +0700
From: "Khemarath Choke-Mangmi" <mike@hq.npc.co.th>
Subject: %ENV under mod_perl
Message-Id: <6as5av$brs$1@eagle.npc.co.th>

I have problem using something like

$ENV{NLS_LANG} = 'THAI_THAILAND.TH8TISASCII';
$ENV{ORACLE_HOME} = '/oracle';

under mod_perl. it works fine under normal perl programs.
But under Apache mod_perl, sometimes it works, sometimes does not.

I'm using DBI 0.91 DBD::Oracle 0.47 My Oracle version 7.1 on DEC 2100 OSF/1
V. 3.2

Embedded Perl version 5.00404 for Apache/1.2.5 mod_perl/1.07_03 process
7251,
running since Wed Jan 28 11:19:05 1998
----------------------------------------------------------------------------
----

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=dec_osf, osvers=3.2, archname=alpha-dec_osf
    uname='osf1 osfry2.npc.co.th v3.2 214 alpha '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2 -Olimit 3200', gccversion=
    cppflags='-std -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    ccflags ='-std -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /lib /usr/lib /usr/ccs/lib
    libs=-lgdbm -ldbm -lm
    libc=/usr/shlib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-shared -expect_unresolved
"*" -O3 -s -L/usr/local/lib'

Characteristics of this binary (from libperl):
  Built under dec_osf
  Compiled at Dec  8 1997 12:09:15
  @INC:
    /usr/lib/perl5/alpha-dec_osf/5.004
    /usr/lib/perl5
    /usr/lib/perl5/site_perl/alpha-dec_osf
    /usr/lib/perl5/site_perl
    .

Any idea?

Thanx
Khemarath




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

Date: Fri, 30 Jan 1998 13:09:13 -0800
From: Georg Edelmayer <ged@fortec.tuwien.ac.at>
Subject: Re: Another "uninitialized variable" problem
Message-Id: <34D24179.13EC@fortec.tuwien.ac.at>

Chipmunk wrote:
Hi

 
> So, the uninitialized value could be in the line:
> {$fence_bits = ($fence_bits | "01000")}
> 
> However, I noticed that you did initialize $fence_bits in your code.
> My only advice is to make sure it really is initialized when you reach that line.
> Perhaps a temporary debug statement:
> warn '$fencebits is ', (defined($fence_bits) ? 'defined' : 'not defined'), "\n";
i tried the following for quick and dirty testing:

$fence_bits="00000";
print $fence_bits."\n";
$fence_bits = ($fence_bits | "10000");
print $fence_bits."\n";

and the output is:

00000
Use of unitialized value at test.pl line 3.
10000

so $fence_bits is initialized and in the next line uninitialized???

so not an answer but another question :-(

> 
> Hope that helps!
> 
> Chipmunk

Georg


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

Date: Fri, 30 Jan 1998 09:56:07 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
To: Wei Weng <wweng@attila.stevens-tech.edu>
Subject: Re: check URL
Message-Id: <34D18797.59E2@iil.intel.com>

Wei Weng wrote:
> 
> Hi
> Is there anyway to use perl to test a URL is valid or not?
> say URL like http://www.ibm.net/products.html.
> any help will be grealty appreciated.
> 
 
Take the checkbot - A perl5 script to check validity of links in www
document trees 

http://dutifp.twi.tudelft.nl:8000/checkbot/
by Hans de Graaff
 
______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/


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

Date: 30 Jan 1998 00:07:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Converting to Leadingcap format?
Message-Id: <6ar5jf$up$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Mike Noel <noel@integrityonline.com> writes:
:Ok.  This is mostly for the amusement of the experienced perl hacks.
:You know how it is when you just want something to work and it doesn't
:have to be pretty? Several times I've had to convert a string from mixed
:case to Leadingcap format (eg, "miKe" -> "Mike").  I am imagining that
:there is a super slick way to do this but here's my solution.
:
:What's the one liner?
:
:sub fixccard
:{
:    # This sub fixes the card name to the Leadingcap format.
:    local($name) = $_[0];

Don't use local.  It doesn't declare a local variable, you know.
It just does a run-time save on a global value.  Very different.
Only my declares local variables.

:    $name =~ tr/A-Z/a-z/;

Don't use tr.  It only works on naove things, not including the
word you see there.

:    $name =~ /^(\w)/;

Did you check for success there?

:    $letter = $1;

I don't recall a declaration of that variable.

:    $letter =~ tr/a-z/A-Z/;
:    $name =~ s/^(.)/$letter/;

What are you doing with that captured $1 there?

:    return($name);
:}

I suppose I could do it more slowly if I tried, but that would take work. :-(

Let's pretend that tr/// works (this is just a convenient fagade, of
course).

    sub fixccard {
	my $string = shift;
	substr($string, 0, 1) =~ tr[A-Z][a-z];
	substr($string, 1)    =~ tr[a-z][A-Z];
	return $string;
    }

Then again, using a similar notion, you could write

    sub fixccard {
	my $string = shift;
	$string =~ s{
			^	    # let's anchor to the start

			( 	    # this one's a keeper
			  [^\W\d_]  # locale resistant way to say a letter
			)

			( 	    # oh, let's keep this one, too.
			  [^\W\d_]  # vide supra
			     +	    # but we want more, MORE I tell you!
			)

		    }{
			my $initial    = $1;       	# start
			my $remainder  = $2;            # rest

			$initial   =~ tr[a-z][A-Z];     # to upper
			$remainder =~ tr[A-Z][a-z];     # to lower

			$initial . $remainder;

		    }sex;				# s to kill $*
							# e for RHS
							# x for LHS
	return $string;
    }


Of course, we're still ignoring the fact that tr is just plain wrong here
because it doesn't covperate with Latin-1.

If you had consulted perlfaq4 (tsk tsk), you would found the correct solutiion
under ``How do I capitalize all the words on one line?''.  

    $string = "\u\L$string";

or 

    $string = ucfirst(lc($string));

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    Q. Why is this so clumsy?
    A. The trick is to use Perl's strengths rather than its weaknesses.
            --Larry Wall in <8225@jpl-devvax.JPL.NASA.GOV>


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

Date: 30 Jan 1998 00:10:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: email address
Message-Id: <6ar5p4$up$4@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    cberry@cinenet.net (Craig Berry) writes:
:So, for example, if $email were obtained from the user, I might write:

Bogotic.

(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\
xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"
]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[
^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;
:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))
*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\
n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\04
0)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-
\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\(
(?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]
\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\
\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\0
37\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xf
f\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\03
7]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\04
0\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]
|\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x
80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]
)|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\
\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff
])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-
\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-
\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\01
5()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(?
:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\0
15()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^
\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<
>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xf
f])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\x
ff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:
[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\00
0-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x8
0-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*)
?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000
-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]
|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[
^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\
\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:
[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff
]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\
]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff
])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8
0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

If you want your program to be readable, consider supplying the argument.
            --Larry Wall in the perl man page 


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

Date: Thu, 29 Jan 1998 13:02:58 -0800
From: Lauri Nahabedian <nahabedian@mail.dec.com>
Subject: Getting error using mkdir
Message-Id: <34D0EE82.1FFFDDB3@mail.dec.com>

Hi,

Perl newbie here.  I have Perl 5 installed on my NT machine which is
running IIS 3.0.

I'm trying to create a directory using the mkdir function, but keep
getting an 'Invalid argument' error returned in $!.

Here is a piece of the code:
 .
 .
 .
# get the current date
require "ctime.pl";
$Date = &ctime(time);

($day, $month, $date, $time, $year) = split(/ +/, $Date);

$rootDirectory = "C:\\InetPub\\wwwroot\\ProjectExperience";
$subDirectoryName = $month . $date . $year;

print "rootDirectory is $rootDirectory <br>";
print "subDirectoryName is $subDirectoryName <br>";

chdir $rootDirectory || die "Can't chdir to $rootDirectory: $!<br>";

$retcode = mkdir($subDirectoryName, 0777);
if ($retcode == 0) {
  print "An error has occurred...<br>";
  print "Error making the subdirectory $subDirectoryName in the
directory
$rootDirectory.<br>";
  print "retcode was $retcode.<br>";
  print "system error is $! <br>";
}

This is what prints out:

rootDirectory is C:\InetPub\wwwroot\ProjectExperience
subDirectoryName is Jan291998
An error has occurred...
Error making the subdirectory Jan291998 in the directory
C:\InetPub\wwwroot\ProjectExperience.
retcode was 0.
system error is Invalid argument

Anyone have any idea what would be causing this error and how I would go
about fixing it?  FYI, the ProjectExperience directory has FULL CONTROL
permissions for EVERYONE at this point (don't know if this matters or
not).

Thanks for the help.

- Lauri



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

Date: 30 Jan 1998 10:16:55 GMT
From: "Charlie Nahhas" <charles.nahhas@ans.alcatel.co.uk>
Subject: Help: Can clients use select?
Message-Id: <01bd2d67$c01624c0$6b793ec2@charles.nahhas.ans.alcatel.co.uk>

Help:

I am writing a couple of scripts that talk over TCP/IP sockets.
On the Server end, I have used the select function to act as a poll. This
works succesfully, blocking until there is something to read on one of the
monitored sockets.

I have tried this on the client end and I cannot get it to work. Does
anyone know if there is a reason why this cannot be done? Is there an
alternative to the  select function? (I am using recv in nonblocking mode).
All responses will be well appreciated. 

Thanks,
Charlie.


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

Date: Fri, 30 Jan 1998 10:18:00 +0100
From: Luc Smeets <lsmeets@best.ms.philips.com>
Subject: How does REMOTE_USER work
Message-Id: <34D19AC8.17CC@best.ms.philips.com>

After authentication I want to use the given username.
REMOTE_USER is an evironment variable which should return the username.

Problem:
 REMOTE_USER returns nothing.

Questions:
 Are the environment variables initialized by the browser (so, the
 browser is causing the problem) or by the HTTP-server (I use Apache)?
 How do I use the environment variables in my Perl scripts? Do I need a
 module for it?

Thanks if you can help me,

Luc


 
===================================
                           Luc Smeets
       Philips Medical Systems Nederland B.V.
             P.O. Box 10000, 5680 DA Best
        Department XRD-CIS, Room QJ-1132
 Voice: +31-40-2763645, Fax: +31-40-2762416
           mailto:lsmeets@best.ms.philips.com
===================================


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

Date: Fri, 30 Jan 1998 12:37:56 +0100
From: "Hr. Jochen Stenzel" <ets@egnetz.uebemc.siemens.de>
Subject: How to use File::Copy::copy() with Mail::Send?
Message-Id: <34D1BB94.71A@egnetz.uebemc.siemens.de>

Hello,

to send mail in my scripts, I use a simple function on the base of
Mail::Send. Addresses and body are get by parameter. Until now, all
bodies were strings, and the following worked according to the
documentation of Mail::Send:


	# construct new mail object
	$msg=new Mail::Send;

	# assign mail data
	$msg->to(join(',', @{$to}));
	$msg->cc(join(',', @{$cc})) if defined $cc && defined @{$cc} &&
$#{$cc}>-1;
	$msg->subject($subject);

	# assign mail text
	$handle=$msg->open;
	print $handle body;

	# complete the message and send it
	$handle->close;

Now, there are cases in which I would like to attach a file. Because I
could not found a way to attach a file directly with Mail::Send (there
is no attach() method), I thought that File::Copy::copy() could work to
make an ASCII attachment the message body - the documentation says that
it accepts scalars, file references and filehandle globs as both source
and target parameters and handles the various types automatically right.
So, to be able to send both plain strings and complete files, I slightly
changed the code to

	# assign mail text
	$handle=$msg->open;
	copy($body, $handle);

This seems to be wrong - it doesn't work. I cannot see why now because
Mail::Send::open() builds an anonymous glob with Symbol::gensym() and
replies it, and such globs are described as to be accepted by
File::Copy::copy() - what did I misunderstood? And what would be a
better way to do this job?

Thanks for any help

		J. Stenzel


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

Date: Fri, 30 Jan 1998 11:10:12 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HTML/CGI to play midi file?
Message-Id: <Pine.A41.3.95a.980130110651.67640A-100000@sp057>

On Thu, 29 Jan 1998, Scott Norris wrote:

> Also, what/where is the CGI Meta FAQ?

Altavista search for "cgi metafaq".  For me it listed 4 documents: 
number 2 was "it".  Use the web, Luke. 

And there's an appropriate usenet group - f'ups redirected.



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

Date: 30 Jan 1998 02:22:29 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: local() scoping rules - unusual results
Message-Id: <6ardh5$97c$3@csnews.cs.colorado.edu>
Keywords: local, scoping

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, dfh@dwroll.dw.lucent.com () writes:
:Can anyone comment on whether:
:   (1)  local() is breaking the "rules"?  (See example below)

Well, yes, there seems to be a bug.

:   (2)  My understanding of the "rules" is incorrect?

No, but I'd still like to take this opportunity to re-emphasize that
local() does not declare a local variable.  Did you hear that?  Let me
try again.

local doesn't declare local variables.
local doesn't declare local variables.
local doesn't declare local variables.

Instead, local() does a run-time save on the global value that lasts
until that scope is executed.  It's still a fully visible global variable.

Only my() declares local variables.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    #else /* !STDSTDIO */     /* The big, slow, and stupid way */
        --Larry Wall in str.c from the 4.0 perl source code


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

Date: Fri, 30 Jan 1998 11:43:31 +0100
From: Martin Raknerud <marthy@feskar.net>
Subject: perl indexingengine
Message-Id: <Pine.LNX.3.95.980130114039.23307A-100000@torsk.feskar.net>


hey,

im in need of making a small indexing machin for my website, and i was
wondering if anyone had made/had any ideas for how to make such a thingy
with perl...

have writen a smaler searchengine in perl, but since this needs to run
true all the files its supposed to search _every time_ a search is done,
it tends to get really ugly.

Martin



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

Date: Fri, 30 Jan 1998 09:59:30 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
To: Michael Wang <mwang@alhena.ibk.ml.com>
Subject: Re: perl on line documentation?
Message-Id: <34D18862.1CFB@iil.intel.com>

Michael Wang wrote:
> 
> Does perl has on line documentation? For example, if I
> want to find the syntax for truncate, seek, split? Thanks.

http://www.cclabs.missouri.edu/things/instruction/perl/perl5man/perlfunc.html
 

______________________________________________________________________
Stas Bekman     mailto:sbekman@iil.intel.com [just another webmaster]
Home Page:      http://www.eprotect.com/stas
A must visit: 	http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home:  http://www.linux.org.il/


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

Date: Fri, 30 Jan 1998 10:02:27 GMT
From: Stephen Eglen <stephen@cogsci.ed.ac.uk>
Subject: perldoc -k: apropos functionality for perl scripts?
Message-Id: <b26iur2e0uk.fsf@cogsci.ed.ac.uk>

Hi,

I write quite a few perl scripts and document them with perldoc (or, from
older days, with embedded nroff from wrapman).  Is there a way of
emulating the whatis database for unix man pages, so that something
like "perldoc -k keyword" would find all the perl scripts with
keyword in their "=head 1 NAME" field of the documentation?  I'm quite
happy to write this script, but I was just checking:

 - has anyone else written one already?
 - would anyone else be interested in using it?

Cheers, Stephen


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

Date: Thu, 29 Jan 1998 21:23:39 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Problems converting Bourne shell to Perl
Message-Id: <r3hra6.78a.ln@localhost>

Steve Bourgeois (sbourgeo@ici.net) wrote:

: I've been going nuts with this one.


You have to be kidding.

It is a Frequently Asked Question. Guess you haven't looked them
over huh?

It will save you from going nuts from several other things in
the future...


: In Bourne shell, I can do the following to pass info to a command:

: 	COMMAND  <<_EOF_
: 	line 1
: 	line 2
: 	...
: 	_EOF_


: How can I do this in Perl?  The Perl "here document" functionality
: seems similar, but it doesn't appear to work the same way. 


Perl FAQ, part 4:

   "Why don't my <<HERE documents work?"


It lists three causes of failure.

You for sure have a #2 there.

You might also have a #3. Hard to tell.



: Any info would be appreciated,

Any checking of the docs that came with your perl distribution 
before posting to Usenet would be appreciated.


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


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

Date: Fri, 30 Jan 1998 20:04:04 GMT
From: doug@1dlabs.com (Doug)
Subject: Re: regex with variables?
Message-Id: <6asfjc$k4k$1@acdc.3dlabs.com>

Thanks for the replies.   I didn't know about the \Q 
Everything works now.

Cheers
Doug



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

Date: Fri, 30 Jan 1998 12:50:28 GMT
From: "gfgfgfgf" <david@thames.com>
Subject: require "./setup.pl"; # with relative path never works for me
Message-Id: <01bd2d7c$88ca5d00$f401a8c0@p166>

require "./setup.pl"; # never works for me

I always have to supply the full path such:-

require /home/www/cgi/setup.pl"; # that's fine

I've had this problem with various servers and perl versions

Que???

Please post & mail any replies

Cheers Dave  david@thames.com


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

Date: Sat, 31 Jan 1998 12:21:00 -0000
From: "David Rayner" <david@thames.com>
Subject: require "./setup.pl"; never works for me!
Message-Id: <886163099.22373.0.nnrp-06.9e9837ac@news.demon.co.uk>

require "./setup.pl"; never works for me!

I always have to put in the full path eg

require "/home/www/cgi/setup.pl";

This seems to happen on a variety of servers

Que ????

Please post amd mail replies

TIA




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

Date: 30 Jan 1998 13:27:24 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: require "./setup.pl"; never works for me!
Message-Id: <7xvhv2rvtf.fsf@beavis.vcpc.univie.ac.at>

Re: require "./setup.pl"; never works for me!, David
<david@thames.com> said:

David> require "./setup.pl"; never works for me!  I always
David> have to put in the full path eg

David> require "/home/www/cgi/setup.pl";

David> This seems to happen on a variety of servers

Let me guess: CGI ?

   http://www.boutell.com/

tony


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

Date: 30 Jan 1998 02:16:38 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Sending data to a printer??
Message-Id: <6ard66$97c$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Hinrich Specht <hspecht@bytes.de> writes:
:I have a problem since i am not very familiar with perl.
:I have an existing perl script that sends data to a specified email
:address. Now I want the data to be printed on a printer. Can anyone tell
:me how I do that???

Pipe to lpr.

:(Maybe it\xb4s a stupid question but I haven\xb4t got the time to learn pearl
           ^ you got something against apostrophes?
:at the moment....)

If you don't have time to learn, don't beg.  Go hire a programmer.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

#define SVs_RMG   0x00008000  /* has random magical methods */
    --Larry Wall, from sv.h in the v5.0 perl distribution


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

Date: Fri, 30 Jan 1998 10:24:08 +0100
From: Lars Lyshaug <lyshaugl@oslo.geco-prakla.slb.com>
Subject: Sending mail from NT4.0
Message-Id: <34D19C37.34D497ED@oslo.geco-prakla.slb.com>

All,

I've never done any programming in Perl, but a collegue made me believe
that it would cover my needs anyway.

I have a NT 4.0 domain controller. Here, I run misc. (CMD)scripts for
logging disk use, etc, etc..
I need to find a way to 'pipe' the content of my logfiles automatically
to a pre-defined mail recipient.
Perl5 is installed on the server. IIS is NOT installed on the server,
nor is Microsoft Outlook. Office95 is, though.

Maybe Perl isn't what I'm looking for, but it's worth a try. I would
like to learn enough about it to make small scripts that the MS Command
Shell isn't able to do for me. Thanks.

Best regards, Lars.



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

Date: Fri, 30 Jan 1998 06:01:12 -0600
From: shaker@netusa1.net
Subject: Re: Some possible bugs
Message-Id: <886161381.1421803532@dejanews.com>

In article <comdog-ya02408000R2901982209430001@news.panix.com>,
  comdog@computerdog.com (brian d foy) wrote:
>
> >1. I am working with the following version of perl:
> >
> >Version 4.0 Patch Level 36 1993/02/05
> >

> you can't complain about bugs if you refuse to upgrade. to
> something modern. :)
>

I will gladly upgrade. However, it is going to take some time. We have
perl and several other 'tools' in a central (so-called) software bank. I
have to persuade the maintainers of this to perform the upgrade for me.

V.Chandrasekhar

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 30 Jan 1998 09:48:38 +0100
From: Richard Wilde <rippo@kc3ltd.co.uk>
Subject: Strings to integers HELP please
Message-Id: <34D193E5.4363@kc3ltd.co.uk>

Please help,

I am writing an order subcription form in html.

The html input:-

<INPUT TYPE="text" size="2" name="quanity">

The Perl script does this:-

 ...
$quanity=form{'quanity'}
$total=$quanity*$price
 ...

The perl script must ignore the form{'quanity'} variable if there are
any non-numerical characters in it.

For example if the user inputs:

'3*8' - Perl will treat this as 3
'10p' - Perl will treat this as 10
'1 3' - Perl will treat this as 1
'p10' - Perl ignores this

I would be grateful if somebody could give me a solution.

I look forward to hearing from you.
Rippo
KC3


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

Date: 30 Jan 1998 02:09:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why can't I unzip?
Message-Id: <6arcov$97c$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Tom Phoenix <rootbeer@teleport.com> writes:
:if your machine is (as I suspect) a Windows-type
:machine, you probably want the precompiled binary. 

Full source is our guard against worms, viruses, and similar 
infestations.  Precompiled binaries are our greatest problem
in this regard.  I cannot believe people grab hardware on 
a diskette and trust it.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    It won't be covered in the book.  The source code has to be useful for
    something, after all...  :-)
            --Larry Wall in <10160@jpl-devvax.JPL.NASA.GOV>


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

Date: Fri, 30 Jan 1998 03:11:11 -0600
From: philippe.verdret@eurolang.fr
Subject: Re: Writing Multilingual Software
Message-Id: <886151031.1232994317@dejanews.com>

In article <34D080E5.41C6@iil.intel.com>,
  Bekman Stanislav <sbekman@iil.intel.com> wrote:
>
> Hello,
>
>
> Anyway I wrote a tool in Perl. Now I have to port it (its output of all
> print() calls ) to a different human languages, (french, italian,
> russian and etc.)
>
> Do any of you has an experience of how these things should be done?
> I think that making the original in English and then  translating all
> print()'s arguments to
> some language is unfeasable... (especially because of upgrades)
>
> I thought about writing a map file per language where real text will be
> stored like:
> $MESS1 = "This is message one";
> $MESS2 = "This is message two";
>
> but I'll have to track what's $MESS1 and I'll get lost if I 'll have
> only
> print $MESS1 in the code.
>
> I know that these things are exist, e.g. mysql can talk to you in a few
> languages, but there are only a limited number of possible replies
> there. In my case there are pretty interactive system with many print()s
> statements
>
> Do you familiar with some other techniques of solving this problem?
>

You can certainly derived a useful solution of the following code:

use Babel;

$errmes = FR->new;
print $errmes->compose(qw(msg1 arg1));

$errmes = WO->new;
print $errmes->compose(qw(msg1 arg1));

$errmes = EN->new;
print $errmes->compose(qw(msg1 arg1 arg2));


#################### The Babel Class ################
require 5.000;
use strict;

package Babel;
$Babel::VERSION = '1.01';

use Carp;

my $debug = 0;
my $pkg = caller;

sub new {
  my $self = shift;
  my $class = (ref $self or $self);

  if ($class eq $pkg) {
    $class = defined $_[0] ? $_[0] : "\U$ENV{'LANG'}";
  }
  if ($class eq '') {
    $class = 'EN';         # En disespoir de cause ;-)
  }
  print STDERR "Current language is $class\n" if $debug;
  if (ref $self) {		# Object method
    $self = bless { %{$self} }, $class;
  } else {			# class method
    $self = bless { }, $class;
    $self->initialize;
  }
  $self;
}
sub message {
  my $self = shift;
  if (@_) {
    $self->{message} = { @_ };
  } else {
    $self->{message}
  }
}
sub language {
  my $self = shift;
  ref($self);
}
sub compose {
  my $self = shift;
  my $id = shift;
  my $msg = $self->{'message'}->{$id};
  unless (defined $msg) {
    my $class = ref $self;
    croak qq!no message for "$id" in the "$class" class!;
  }
  my $argnum = @_;
  my @formats = ($msg =~ /((?:[^%]|^)(?:%%)*%)/g);
  my $formatnum = @formats;
  if ($argnum != $formatnum) {
    croak qq!bad argument number in message "$id": $argnum, $formatnum
expected\n$msg!;
  }
  sprintf($msg, @_);
}
sub debug {
  my $self = shift;
  $debug ^= 1;
}

package FR;
@FR::ISA = qw(Babel);

sub initialize {				# id => message content
  my $self = shift;
  $self->message(
		   'msg1' => 'un premier message en frangais : %s',
		   'msg2' => 'un second message en frangais : %s, %s',
		  );
}

1;

package WO;
@EN::ISA = qw(Babel);

sub initialize {
  my $self = shift;
  $self->message(
		   'msg1' => 'li dieuk tchi Wolof: %s',
		   'msg2' => 'nya rel bi tchi Wolof: %s, %s',
		  );
}

package EN;
@EN::ISA = qw(Babel);

sub initialize {
  my $self = shift;
  $self->message(
		   'msg1' => 'a first message in english: %s',
		   'msg2' => 'a second message in english: %s, %s',
		  );
}

1;
__END__

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

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

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