[6360] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 982 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 20 16:47:26 1997

Date: Thu, 20 Feb 97 13:00:21 -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, 20 Feb 1997     Volume: 7 Number: 982

Today's topics:
     Re: [Q] Is it possible to insert <br> in a pod? <eryq@enteract.com>
     Re: Can I set s/// with different switches determined a (Dave Wolfe)
     Re: Class library to make C++ more Perlish? (Scott Maxwell)
     Re: compiling Perl on HPUX 9.x <dave@n1.net>
     Determining path names <nealnach@dlgef.cr.usgs.gov>
     Re: Empty contents of a file without deleting it <bartolonem@med.ge.com>
     Fairly basic Comm.pl question (Tyger)
     How to delete values <concord@cam.org>
     How to spam - legitimately <chris@ixlabs.com>
     Least-Squares/Kalman filter (Haisam K. Ido)
     limit execution time? (Murray Stokely)
     Re: Making sure 'perl -v' works (Jot Powers)
     Re: NDBM limitation (David Getchell)
     Re: NDBM limitation <brett@speedy.speakeasy.org>
     Re: Need help with variable manipulation (M.J.T. Guy)
     newbie needs help (Gerd Schering)
     Re: Perl for Win32 (Pete M. Wilson)
     Re: Perl not working as cgi on local server <sajaa@sn.no>
     Re: Perl on Windows 95 (Luu Tran)
     perl5 port problem (Fred Condo)
     Re: Q:How to change current working directory? <bartolonem@med.ge.com>
     Re: RegEx, Email & Friedl's "Mastering..." Book (Tad McClellan)
     Re: Regexp to do minimal email validation <usenet-tag@qz.little-neck.ny.us>
     relative directory address vs absolute <wade@demographics.com>
     Re: Scoping problem using my() [kinda long] (Mike Stok)
     Re: sybperl and HTML <jander@jander.com>
     unlink on Win95 (The next Pele)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Feb 1997 14:19:19 -0600
From: Eryq <eryq@enteract.com>
To: Con Lam <conlam@monitor.CS.Berkeley.EDU>
Subject: Re: [Q] Is it possible to insert <br> in a pod?
Message-Id: <330CB1C7.125D345E@enteract.com>

Con Lam wrote:

>         =over 8
> 
>         =item line 1
> 
>         =item line 2
> 
>         =item line 3
> 
>         explanation
> 
>         =back
> 
> for the lines marked by the arrows.  However, none of them are doing what I
> want.  Is what I want possible?

In practice, the above approach is supposed to do what you want (it's used
in the perl manual pages, for example).

It could be that you need to tweak the pod2man converter; I don't know (I read
all my docs in HTML using a WWW browser).

As a last-ditch alternative, if formatting is REALLY important to you,
you could make everything verbatim text.  Yuck.

Hope that helps,

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.mcs.net/~eryq
 \___||_|  \__, |\__, |__
           |___/    |___/ Make $$$ easy! Just hit shift, then 444!


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

Date: 20 Feb 97 18:08:14 GMT
From: dwolfe@miaow.sps.mot.com (Dave Wolfe)
Subject: Re: Can I set s/// with different switches determined at runtime?
Message-Id: <dwolfe.856462094@talos4>

[ mailed and posted ]

In <330B00EF.2990@pathfinder.com> Charles Herold <cherold@pathfinder.com> writes:

>I have a simple little script that changes one phrase to another in a
>file.  I'd like to allow the user to use command line switches and then
>ad them to the substitution string.  What I tried as an experiment,
>which didn't work but which shows what I wanted to do, is this:

>$switches = "gi";

>$text =~ s/$search/$replace/$switches;

>I was hoping that would give me s/$search/$replace/gi, but it doesn't,
>as I'm sure you all know.

>Is there a way to do this?

You bet! Check the perlre manpage and look for (?...). For example:

    $switches = "gi";
    $text =~ s/(?$switches)$search/$replace/;

-- 
 Dave Wolfe


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

Date: 20 Feb 1997 19:38:14 GMT
From: maxwell@natasha.jpl.nasa.gov (Scott Maxwell)
Subject: Re: Class library to make C++ more Perlish?
Message-Id: <MAXWELL.97Feb20113814@rocky.jpl.nasa.gov>

In article <5eh3cl$9mt$1@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:

> In comp.lang.perl.misc, "Charlton Barreto" <charltoN@illustra.com> writes:
> :The STL already provide associative arrays
> Are they 8-bit clean?  Can you distinguish between a missing key and
> a missing value?  Do they automatically resize themselves for reasons
> of efficiency?  Can they hold arbitrary and heterogeneous objects?
> Can those objects' types be determinable and inspectable at run time?
> Do they have their memory automatically allocated and deallocated?

Yes to all of these except the resizing question, which is a maybe
(whether or not they resize for efficiency is an implementation
detail -- good implementations will, others won't).

> Can you transparently bind them to databases, like GNU DBM or Berkeley DB?

Not as easily as in Perl, that's for sure.  But somebody had to write
a Perl module for that, and writing a C++ library to do the same for
C++'s set/map classes is analogous -- once the library were written
(and maybe it has been), it would be about as simple in C++ as it is
already in Perl.

> Are they garbage collected?  Can you dynamically build an associative
> arrays of closures with deep binding of embedded lexical variables?

No (but it's possible to write simple objects that fake it decently),
and no.  (Well, you can sorta do the second one with bind1st<> and
bind2nd<>, but Perl is better.)

> :and the <vector> and
> :<matrix> template classes which are far superior to the built-in Perl
> :or C-type arrays. 
> 
> I'm amazed to see anyone mention Perl arrays and C arrays in such
> a parallel construct, considering how little they have in common.

C++ vectors fix the C problems that you went on to name (except that
it may still take extra work to get heterogeneity, depending on
exactly what heterogeneity you want).  I'm not sure why Mr. Barreto
thinks Perl's arrays share these problems, though.

> :Regex pattern matching is available in the standard
> :libraries of most post-April-1995-DWP C++ compilers. 
> 
> I'll wager that the pattern matching in those libraries is a pale and
> impoverished echo of Perl's.  Let's check: Is it well integrated into

Yep, Perl beats C++ hollow here.  Some of the points you bring up are
satisfied, others aren't.

> :Perl scalars
> :are strings, so you can just use C++ string classes.
> 
> No, Perl scalar can hold strings, but they are not strings.  They are
> scalars that can transparently hold strings, numbers, or references
> and objects, all of which are automatically allocated, de-allocated,
> and garbage collected.  This is just one of the advantages of using
> a high-level language like Perl instead of a low-level one like C++.

Generic typing is one of Perl's advantages -- and disadvantages.  In
C++ you'll never accidentally put an apple into a bag of oranges; it's
easier to make this mistake in Perl.  (However, I've found that this
makes less and less difference to me in practice, so I'm less enamored
of this argument than I used to be.)

You can get the same genericity in C++, but you have to ask for it (in
great detail :-).  OTOH, once you've written your funky Scalar class,
it's there forever, so future code can be generic or not, as you like.
With Perl it's the other way around -- you have to do extra work to
ensure homogeneity.  Which one wins depends on what you're doing, I
guess.

Which is not to say that I like C++ better than Perl, though.
--
-------------------------+------------------------------------
   //  Scott Maxwell:    | 
\\//      maxwell@       | ``Any excuse will serve a tyrant.''
 XX natasha.jpl.nasa.gov |     -- Aesop


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

Date: Thu, 20 Feb 1997 11:51:40 -0700
From: Dave Kochan <dave@n1.net>
Subject: Re: compiling Perl on HPUX 9.x
Message-Id: <330C9D3C.6FC7@n1.net>

Ben Pressnall wrote:
> 
> can anyone help me compile Perl on a HPUX 9.X system?
> 
[ snip ]

I recently compiled Perl 5.003 under HP-UX 9.05.  Runs great.
The Configure script is super-neat.

I used the brain-dead freebie compiler that came with 9.05 and
had only one problem:  two of the sources files (can't remember
which, sorry, but you'll see it during the make  8^) need to have cpp
run on them manually with a bigger macro table size, so:

  mv blahblah.c blahblah.c.dist
  cpp -H256000 -P blahblah.c.dist blahblah.c

then run your make.  Be sure to "make test" when you're done!

YMMV.

Dave


Dave Kochan
System and Network Administrator
NetONE - Logan, UT


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

Date: Thu, 20 Feb 1997 20:25:02 GMT
From: Neal Nachtigall <nealnach@dlgef.cr.usgs.gov>
Subject: Determining path names
Message-Id: <330CB31E.4742@dlgef.cr.usgs.gov>

The other day I am sure that I saw a module or script or
something that would determine actual path names based on
a shortcut.

For example:

  $act_path = det_path("../bin");
             or
   det_path("../bin", $act_path);

# $act_path now equals /usr/local/bin or /my/home/bin

I don't see it in any of the File modules, but I don't think
I was dreaming it up.

Could someone help me out, otherwise I'll just have to go back
to sleep and see if I can dream up how to implement it.

Thanks!!
--
Neal L. Nachtigall * nealnach@dlgef.cr.usgs.gov 
Hughes STX (EROS Data Center)

No wonder nobody comes here--it's too crowded. -Yogi Berra


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

Date: Thu, 20 Feb 1997 13:10:54 -0600
From: Mike Bartolone 5-4266 <bartolonem@med.ge.com>
To: chris@ixlabs.com
Subject: Re: Empty contents of a file without deleting it
Message-Id: <330CA1BE.167E@med.ge.com>

Chris Schoenfeld wrote:
> 
> What's the most desirable method of emptying a file's contents without
> deleting it (e.g. system(cp /dev/null file)) in Perl?
> --
> Chris Schoenfeld
> IX Development Laboratories
> Santa Rosa, California
> (707)-543-8030 Ext. 12

That might work..but I think it would be faster to do this:

open(FILEHANDLE,">filename");
close(FILEHANDLE);


-- 
Michel Bartolone            | Let us endeavor so to live 
bartolonem@med.ge.com       | that when we come to die
bartolon@execpc.com         | even the undertaker will be sorry.


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

Date: 20 Feb 1997 20:25:16 GMT
From: tyger@fiat.gslis.utexas.edu (Tyger)
Subject: Fairly basic Comm.pl question
Message-Id: <5eibvc$fke@geraldo.cc.utexas.edu>

Hey there y'all,

I need to use Comm.pl to interact with a little interactive shell utility 
that works much like the "passwd" command (ie: command + arguement, then 
prompting for two lines of input followed by line feeds).  I've been 
picking apart the telnet examples that are included at the end of the 
Comm.pl file (the open_proc, interact and expect calls) - but in this 
case, I dont really need to use any of the shell/tty calls, because this 
will run in the background and I will not need to switch in and out of 
interactive shells (like in a telnet session).  So...

Does anyone have an example (or just point me to one) of a perl script,
that invokes Comm.pl, and carries on a simple transaction with an
interactive shell utility (like passwd for example) - since it's not
involving another host, I dont need any of those funky shell, socket, and
etc calls. 

Thanks everyone.

T'gr

--
-------------------- Tyger - http://www.eden.com/~tyger --------------------
----------- If the thunder don't get you then the lightning will -----------


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

Date: Thu, 20 Feb 1997 13:41:41 -0500
From: Alex Chkliar <concord@cam.org>
Subject: How to delete values
Message-Id: <330C9AE5.361E@cam.org>

Hello, world!

I'm working with the DBM files. Please answer how I can delete an entire
record from my
%users file correctly. 
I've tried:
delete $users{$key}; #works ok
delete $users{$values} #doesn't work and leaves my values in the file.

I could replace my $values with "" but I fill it's not a proper way to
do it.

Thank for your help.
Alex.


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

Date: Thu, 20 Feb 1997 12:42:51 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: How to spam - legitimately
Message-Id: <330CB74B.43@ixlabs.com>

We have a client who has 18,000 registered web site users.

They want the users to have the ability te request certain daily data
sent to them via email (they give us the address when they register).

All of these emails will be different based on user preferences.

What is the most efficient way of sending these out without calling
sendmail 18,000 times? 

We are using Perl5 on a Solaris box.



-- 
Chris Schoenfeld
IX Development Laboratories   
Santa Rosa, California
(707)-543-8030 Ext. 12


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

Date: 20 Feb 1997 18:33:37 GMT
From: idoh@news.intelsat.int (Haisam K. Ido)
Subject: Least-Squares/Kalman filter
Message-Id: <5ei5e1$7bd@intelsat2.intelsat.int>

I checked out CPAN before this question :-).

Is anyone aware of a perl module that can do batch least squares, 
weighted least squares, and/or recursive least squares ...?

Regards,
--
+-------------------------------------------------------------------+
             Haisam K. Ido, mailto:h.ido@intelsat.int
+-------------------------------------------------------------------+  
           Intelsat, The Flight Dynamics Section,  Box 60
            3400 International Dr.; Washington, DC 20008
               202.944.7654, 202.944.7847 (telefax)
+-------------------------------------------------------------------+                     


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

Date: Thu, 20 Feb 1997 19:53:52 GMT
From: murray@southeast.net (Murray Stokely)
Subject: limit execution time?
Message-Id: <330ca553.12756335@nntp.southeast.net>

   Is there any way to limit the execution time of a Perl script somehow, in
case it gets caught in an infinite loop or something.  In csh this would be
accomplished with "limit cputime 60".  
   Obviously the goal is just to not make that happen, but I modify this script
constantly and its called in a crontab so I don't always test it after each
modification and recently a simple typo crippled the machine when about 10
processes of the script were stuck in the loop simultaneously.
  Thanks for any help.


Murray Stokely ( murray@southeast.net )
http://www.cdrom.com/pub/artpacks


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

Date: 20 Feb 1997 19:47:13 GMT
From: jot.feb97@tmp.medtronic.com (Jot Powers)
Subject: Re: Making sure 'perl -v' works
Message-Id: <5ei9o1$m10@gazette.medtronic.com>

In article <01bc1f20$60ae9540$7ce42ac2@steve>, "Stephen K. Bohler" <skbohler@ix.netcom.com> writes:
>I've just tried to determine the version of Perl running on my client's
>server and it tells me that it is version 4. However, they have the
>/usr/local/lib/perl5 libraries on it.

Where are you getting perl from?  Ie, what is the output of

which perl

Occasionally I get bit by the fact that on my Auspex, they have
installed /bin/perl which is version 4, and I have installed 5.00X
in /usr/local/bin.  Since bin shows up in my path before 
/usr/local/bin, the perl version is 4.  However, if you set your
shebang (#!) correctly and chmod it I get the right version, it's just
when I do a "perl program" that I get a problem.

After an hour or so of debugging, I realized that require 5; is a 
_really_ good thing for reminding me of this problem.

>Can anyone explain this discrepancy?

This is as good a guess as I can make without more info.

-- 
Jot Powers  jot.feb@tmp.medtronic.com
Unix System Administrator, Medtronic Micro-Rel
"Subtlety is the art of saying what you think and getting out of the way
before it is understood."




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

Date: Thu, 20 Feb 1997 16:30:07 GMT
From: david.getchell@paonline.com (David Getchell)
Subject: Re: NDBM limitation
Message-Id: <330c4f56.1311863@snews.zippo.com>

On Wed, 19 Feb 1997 18:57:20 -0500, David Gallone <dgl@offis.lu>
wrote:

>Hi,
>
>Here is an extract from NDBM man pages (on SINIX).
>
>> The sum of the sizes of a key/content pair must not exceed the 
>>     internal block size (currently 4096 bytes). Moreover all key/content 
>>     pairs that hash together must fit on a single block. dbm_store will 
>>     return an error in the event that a disk block fills with inseparable 
>>     data. 
>
>
>This seems to be a very hard constraint making NDBM of little use for
>real applications.
>
>Is there a work around ?

I wrote a set of Perl programs which used a fairly large (250K
records) NDBM database. The keys were US Census block group names, of
the form "PA*007*0042*2", which is to say, the second block group in
the 42nd tract in the 7th county in Pennsylvania. I had problems with
excess collisions returning errors, as described above. What I did to
fix the problem was carefully analyze my keys to remove all the
useless bits. For example, the state letters varied only from A to Z,
which can be expressed in 5 bits apiece, the county code can be
expressed in 10 bits, and so forth. By concatenating the result using
pack, I was able to get the hash to perform better. I don't understand
the internal hash algorithm, but this technique saved my application.

Two other notes:

Speed was irrelevant for my application as the results were being fed
into a mathematical model which takes hours to run. That it took a
minute or less to build the data sete was fine. I am sure, however,
that all that packing of bits had to slow it down some.

Don't ever try to move a large NDBM file. The file is built by
skipping blocks that aren't used. If you try to move it, UNIX has to
fill in all those missing blocks with blank blocks, and the file will
get huge. Dumping and reloading is your option here. I know this is
mentioned in the documentation, but I thought it bore repeating.



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

Date: 20 Feb 1997 12:29:28 -0800
From: Brett McCormick <brett@speedy.speakeasy.org>
Subject: Re: NDBM limitation
Message-Id: <7vsp2r43x3.fsf@speedy.speakeasy.org>


I would suggest using gdbm (GNU dbm).  It has no limit, isn't too slow
and works great!  That's what I use for all my apps.

--brett

Randal Schwartz <merlyn@stonehenge.com> writes:

> 
> >>>>> "David" == David Gallone <dgl@offis.lu> writes:
> 
> David> Hi,
> David> Here is an extract from NDBM man pages (on SINIX).
> 
> >> The sum of the sizes of a key/content pair must not exceed the 
> >> internal block size (currently 4096 bytes). Moreover all key/content 
> >> pairs that hash together must fit on a single block. dbm_store will 
> >> return an error in the event that a disk block fills with inseparable 
> >> data. 
> 
> 
> David> This seems to be a very hard constraint making NDBM of little use for
> David> real applications.
> 
> David> Is there a work around ?
> 



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

Date: 20 Feb 1997 19:34:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Need help with variable manipulation
Message-Id: <5ei905$p41@lyra.csx.cam.ac.uk>

Jesse Glick  <jesse@ginger.sig.bsh.com> wrote:
>"D. M. Johnson" <ez045864@peseta.ucdavis.edu> writes:
>> 1) If $name = randal, how can I reverse this.  I need to get
>>    $name = ladnar (Assuming I don't know how many characters are
>>    in the name.)
>
>join '', reverse split //, $name

or just

$revname = reverse $name;


Mike Guy


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

Date: 20 Feb 1997 20:42:51 GMT
From: gerd4000@mailszrz.zrz.TU-Berlin.DE (Gerd Schering)
Subject: newbie needs help
Message-Id: <5eid0b$ta@hermes.uhland.de>


-- 
Hello,
first of all I hope I hit the right group (but as i am a newbie, please pardon
me!)
I have the following problem:
I want to traverse a directory tree:
I start at a given directory (=$startdir) and I want to put all subdirs on a
stack for later processing. But something goes wrong with (my use of) the file
test operator: the stack is always empty - though there are subdirs.
So what's wrong?
I use perl version 5.003_07. 
It would be nice if you could reply (at least too) by email
because I will not  be able to follow the newsgroups for the next few days
(upgrade of my linux box, but i still can get mail via ...)

The (relevant) code is included below:


#!/usr/bin/perl -w

die "\n\tUsage: traverse.pl [dirname]\n\n" unless scalar(@ARGV) == 1;

@dirstack = @filestack = ();

$startdir = $ARGV[0];
opendir(STARTDIR, $startdir);
@infiles = readdir (STARTDIR);

# get rid of "." and ".."

shift (@infiles);
shift (@infiles);

# process  each file

while ($name = shift(@infiles)) {
    if (-d $name) {
	print "dir: ", $name, "\n";
	push (@dirstack, $name);

    }
    print $name, "\n";
}
 
print "dirstack: ",@dirstack, "\n";



Gerd 

PS.: Send replies (if any) to the address below. The address in the header 
might be misleading or not availabe!
-----------------------------------------------------------------------------
-- Gerd Schering                          email: Schering@zrz.TU-Berlin.DE --
-- TU Berlin, Zentraleinrichtung Rechenzentrum                             --
-- Sekretariat E-N 50, Einsteinufer 17, 10587 Berlin                       --
-- X400: S=Schering OU=zrz P=TU-Berlin A=d400 C=de   fax: +49 30 314 21060 --
----------------------------------------------------------------------------- 


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

Date: Thu, 20 Feb 1997 18:33:32 GMT
From: wilsonpm@gamewood.net (Pete M. Wilson)
Subject: Re: Perl for Win32
Message-Id: <330c98ac.14694854@news.gamewood.net>

"Ian Samson" <IDS@Scrooge.HSRC.ac.za> wrote:
>
>Perl for Win32? Does this mean there is a perl version that runs on Windows
>95? Or is it still the ntperl that requires to be installed and configured
>on an NT server?
>
>I have had numerous requests on the IE-HTML list for this information.
>

Check out www.activeware.com for the (fomerly hip) current port of
Perl to Win95 or WinNT.




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

Date: 20 Feb 1997 19:01:12 GMT
From: "Jarle Aasland" <sajaa@sn.no>
Subject: Re: Perl not working as cgi on local server
Message-Id: <01bc1f60$7b5fd210$ab18f8c2@jaasland>

Very many people have trouble with this. First, make sure you have the
version of Perl found at http://www.activeware.com/. Then install it
running install.bat (I think it is).

In theory, the install procedure should make all the registry changes for
you, but I have excperienced that this is not always the case.

Check your registry entries based on this Microsoft document on the
subject: http://www.microsoft.com/kb/articles/q150/6/29.htm

This should do the trick!

Good luck, 
Jarle Aasland
NORWAY


> I have set up perl5 on my NT and am using Peer Web Service.  Perl runs
> fine under cmd.exe but when I put hello.pl in my cgi-bin and type in
> http://localhost/cgi-bin/hello.pl I get the "file save menu" in
> netscape.  This happens even though I have set applications/x-perl to
> run ../perl5/perl.exe  



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

Date: Thu, 20 Feb 1997 16:46:05 GMT
From: luutran@sci.csupomona.edu (Luu Tran)
Subject: Re: Perl on Windows 95
Message-Id: <5ehv78$a43@netline-fddi.jpl.nasa.gov>

In article <01bc1ee2$dec49a80$9c71adce@crc3.concentric.net>, "Mike Conley" <at932@detroit.freenet.org> wrote:
>
>
>Hank LeMieux <hanklem@ibm.net> wrote in article <330B53FE.872@ibm.net>...
>
>> 
>> 2) Install a server on your machine and run it locally.  That's how I
>> test my scripts.
>> 
>What is an effective way to do this on win 95? I want to test scripts,
>not run a Web server, so it should be really simple.
>

Actually, I've found that the easiest way to do test CGI/Perl scripts 
to be run on a Unix server is just to install a little server on my 
own win95 machine.  It took me, oh, 15 mins to do this.  Once 
installed, you don't need to be connected to the net to test your 
scripts/pages.  Just use a local loopback (e.g., http://127.0.0.1/)

The one I like best is Fnord.  It's small, free, and fast.  You can 
d/l it from tucows (look under server section or just search for 
fnord).


-- luu

Luu Tran                          
luutran@sci.csupomona.edu
webmaster: http://www.bayscenes.com/np/mdonline/
------------------------------------------------


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

Date: Thu, 20 Feb 1997 10:18:00 -0800
From: fred@lightside.net (Fred Condo)
Subject: perl5 port problem
Message-Id: <fred-2002971018000001@dcs75.dcs-chico.com>

I recently built the perl5 port under FreeBSD 2.1.6.1, and perl displays
warning messages whenever invoked:

system@mail$ /usr/local/bin/perl -d -e 42
warning: setlocale(LC_CTYPE, "") failed.
warning: LC_ALL = "(null)", LC_CTYPE = "(null)", LANG = "en_US.ISO_8859-1",
warning: falling back to the "C" locale.

How can I a) fix or b) suppress these warnings? Thanks!
-- 
http://www.lightside.net/~fred/ + net access + http://www.lightside.net/
"Attempts to control the use of encryption technology are wrong in
principle, unworkable in practice, and damaging to the long term economic
value of the information networks." - UK Labour Party


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

Date: Thu, 20 Feb 1997 13:03:55 -0600
From: Mike Bartolone 5-4266 <bartolonem@med.ge.com>
To: jonesaa@worldnet.att.net
Subject: Re: Q:How to change current working directory?
Message-Id: <330CA01B.41C6@med.ge.com>

Anthony Jones wrote:
> 
> I know there is a simple explaination for this, but I don't have it.
> 
> How can you change the current working directory inside a perl script?
> 
> The reason I am asking is, I have to untar a file in the directory where
> the file resides, NOT in the directoy I run the script from, or the home
> directory of the user.  The tar file is created to untar to the current
> (.) directory.
> 
> Thanks for the help
> 
> Anthony Jones


First, here is how to do this:

chdir("dir_name");

Second, go get the "Learning Perl" book by O'Reilly and assoc. Its
good and covers most of the newbie questions. You may want to invest
in the "Programming Perl" book also by O'Reilly. 


-- 
Michel Bartolone            | Let us endeavor so to live 
bartolonem@med.ge.com       | that when we come to die
bartolon@execpc.com         | even the undertaker will be sorry.


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

Date: Thu, 20 Feb 1997 12:51:20 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: RegEx, Email & Friedl's "Mastering..." Book
Message-Id: <8f6ie5.f73.ln@localhost>

Jeffrey (jfriedl@tubby.nff.ncl.omron.co.jp) wrote:

: Abigail  <abigail@ny.fnx.com> wrote:
: |> On 18 Feb 1997 10:47:35 GMT, Jeffrey wrote in comp.lang.perl.misc:
: |> ++ 	%header = $header =~ m/^(^[^:]+):\s+)(.*)/g;
: |> 
: |> I looked at this expression for a while, but I can't see any reason
: |> why the regex starts with two anchors.  Did I miss some deeper magic?

: No, I just thought it made a cute smiley.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think so too!

: (yeah, that's it, that's the answer :-)


_ _
^(^
 o


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 20 Feb 1997 19:16:58 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Regexp to do minimal email validation
Message-Id: <5ei7va$t79$1@news.netusa.net>

Randal Schwartz  <merlyn@stonehenge.com> wrote:
>>>>>> "Jon" == Jon Drukman <jsd@cyborganic.com> writes:
>Jon> say i want to do a quick'n'dirty check to see if an email address
>Jon> matches user@somewhere.com or user@some.where.com or
>Jon> user@ab.cd.ef.fg.fhg.com...
>Jon> /^\w+@[a-z0-9][\w\.]+/
><Bzzzt!>  Wrong.
>The really short answer, if you are really lazy, is that you just
>*can't*.  You can't.  There's no point.  Send the mail, and if it gets

While you can't check for sure, here is/was my quick and dirty check
for a reasonable From: line in mail:

/^From:.*\s<*([^ <>@]*)@([^ <>@.]+)[^ <>@]*[.]([a-z][a-z]|com|net|org|edu\
|gov|mil|int|arpa|firm|store|web|arts|rec|info|nom|[0-9]+]*)(> *| .*)$/i

It could be better. It will accept <<<bozo@bo...zo>, although it will
catch <bozo@.bo.zo>. For my purposes it helpe to be able to catch
<bozo@bozo.com> type addresses, hence the parenthesis. With the
exception of the bozo@bozo test, I don't think there is any valid
@-style address for which that will create a false positive. Since
not all 26^2 two letter TLDs are valid, there are a lot of addresses
it will accept that could have been checked for. Also note the
rather hacky approach I used towards handling these three cases:

From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
From: usenet-tag@qz.little-neck.ny.us (Eli the Bearded)
From: usenet-tag@qz.little-neck.ny.us

Elijah
------
bang paths and .NOSPAM left as an excercise for the reader


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

Date: Thu, 20 Feb 1997 13:00:55 -0500
From: Wade Leftwich <wade@demographics.com>
Subject: relative directory address vs absolute
Message-Id: <330C9157.6EA1@demographics.com>

Is there a fairly easy way to convert relative directory addresses
(like ../../mydir/myfile.txt) to absolute ones (like 
/dir1/dir2/dir3/mydir/myfile.txt)?

This is for a CGI script that opens, parses and returns files to the 
user. I would like to be able to allow relative file paths (with a 
'..' in them), but unless I can retrict it to allowed directories it 
would be something of a security problem.
---------------------
Wade Leftwich <wade@demographics.com>
American Demographics / Ithaca NY


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

Date: 20 Feb 1997 19:36:03 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Scoping problem using my() [kinda long]
Message-Id: <5ei933$f14@news-central.tiac.net>

In article <330a1697.21624751@news.conterra.com>,
Doug Alcorn <doug.alcorn@sonoco.com> wrote:

>$order_slit = 00260;
>if ($order_line[4] eq "LB") {
>	# get the fraction portion
>	($order_slit, my $fraction) = ($order_slit =~ m/(\d*){\d\d)/);
>	# convert to decimal and drop of the leading zero
>	($fraction /= 64) =~ s/^0*(\.\d*)/$1/;
>	# concatinate the decimal fraction to the integer inches
>	$order_slit .= $fraction;
>} else {
>	# $order_slit is in metric convert to decimal inches
>	$order_slit /= 25.4;
>}
>

 [...]

>main::(plnt_part_num.pl:64):            ($fraction /= 64) =~
>s/^0*(\.\d*)/$1/;
>  DB<2> X fraction
>  DB<3> X fraction
>  DB<4> 
>
>I want the scope of fraction to be the "then" of the if block.  My
>question is why is $fraction undefined at this point?  I expected it
>to be defined to 60.  It worked before I put the my() in there.  In
>fact, I originally used two new variables there instead of changing
>the value of $order_slit.  I had both of them defined with my() and
>that worked.  

It's there, you just can't see it with the debugger as my variables don't
live in the symbol table.  Consider:

$ cat try.pl
#!/usr/local/bin/perl -w

($foo, my $bar) = ('one', 'two');
print "foo is $foo bar is $bar\n";
$ ./try.pl
foo is one bar is two
$ perl -d try.pl
Stack dump during die enabled outside of evals.

Loading DB routines from perl5db.pl patch level 0.9904
Emacs support available.

Enter h or `h h' for help.

main::(try.pl:3):       ($foo, my $bar) = ('one', 'two');
  DB<1> n
main::(try.pl:4):       print "foo is $foo bar is $bar\n";
  DB<1> X foo
$foo = 'one'
  DB<2> X bar
  DB<3> $visibleBar = $bar

  DB<4> X visibleBar
$visibleBar = 'two'
  DB<5> print $bar
two

 .. as $visibleBar = $bar is executed in a context that can see $bar and
$visibleBar is in the symbol table you have an indirect way of getting at
$bar (also the print gets executed in a context where $bar is visible.)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 20 Feb 1997 13:53:03 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: sybperl and HTML
Message-Id: <4tf7s41c.fsf@jander.com>

barg@nickel.as.arizona.edu (Irene Barg) writes:

> 
> Hello,
> 
> I'm running sybperl-2.05 on a Sun SPARCstation 20, Solaris 2.5.
> 
> I get the following error when I try to load a
> CGI form which will eventually call some sybperl subroutines.
> 
> Error: HTTPd: malformed header from script /d4/sybase/www/docs/htdocs/cgi-bin/test/target 
> 
> The top of the CGI form looks like this:
> 
> #!/net/nickel/d0/barg/bin/perl
> # Sybperl stuff
> use Sybase::CTlib;
> BEGIN {$ENV{SYBASE} = "/d0/sybase/sybase10"; unshift @INC, "../../lib";}
> 
> &display_form ();
> 
> #------------------------------------------------------------------------
> # display_form -- Display form where the user enters the SQL query.
> #------------------------------------------------------------------------
> 
> sub display_form
> {
> ....
> }
> 
> If I comment out the line "use Sybase::CTlib;", then my form displays
> correctly.  

You're getting some kind of compile-time error. Since it's occurring
before you've printed out the mandatory header, it's giving you that
error msg. To determine the exact error, examine the httpd error log.

You could also print out the required header as the first action in
the BEGIN block. That way you would see the error. Or, you could trap
it using eval {} within the BEGIN block.























-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 20 Feb 1997 20:39:51 GMT
From: gt1535b@acmex.gatech.edu (The next Pele)
Subject: unlink on Win95
Message-Id: <5eicqn$6vi@catapult.gatech.edu>

Hi there.  I'm running the Win95 port of perl, and I was wondering
if there was any difference b/t the Unix Perl version of unlink and
the ported version.  Are there links in Win95 like in Unix?

thanks,
Daryl

--
<>< Daryl Bowen	<><
Georgia Institute of Technology
Internet: gt1535b@prism.gatech.edu
Siemens Stromberg-Carlson Co-op


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 982
*************************************

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