[11495] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5095 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 9 14:07:29 1999

Date: Tue, 9 Mar 99 11:00:24 -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           Tue, 9 Mar 1999     Volume: 8 Number: 5095

Today's topics:
    Re: [HOW TO?] Strip all but certain characters from a s (Abigail)
        AS/400 Perl <kmrobert@us.ibm.com>
        Compiling perl "somewhere else" <elf@halcyon.com>
    Re: constant in Perl? (Abigail)
    Re: constant in Perl? (Mark-Jason Dominus)
    Re: Continue Script After Error? (M.J.T. Guy)
        FAQ 3.14: How can I generate simple menus without using <perlfaq-suggestions@perl.com>
    Re: Finding comments in a file using regular expression (M.J.T. Guy)
        FL - Boca Raton - Sr. Programmer/Analyst <resume@mulliganservices.com>
    Re: flock / sysopen / open confusion (Bart Lateur)
    Re: How to find the hostname of the visitors (Abigail)
        LDAP: perl.dll not found - where is it? (Andrew Haveland-Robinson)
        length of a string. <steven@" <"REMOVE>filipowicz.com">
    Re: length of a string. <jglascoe@giss.nasa.gov>
    Re: lower/upper case conversion <staffan@ngb.se>
        New regex features (was Re: FAQ 4.20: How do I find mat <dgris@moiraine.dimensional.com>
        Newbie needs help!! <hr5aa@herts.ac.uk>
    Re: Newbie needs help!! <jglascoe@giss.nasa.gov>
        ODBC Memory Leak (Pat  Garvey)
        Perl & PostgreSQL <fabascal@gredos.cnb.uam.es>
    Re: Perl & PostgreSQL <staffan@ngb.se>
    Re: Perl & PostgreSQL <dgris@moiraine.dimensional.com>
    Re: Perl format statement question <dave@californiaic.com>
    Re: Perl format statement question (Mark-Jason Dominus)
    Re: Perl script to emulate communications program <david@kasey.umkc.edu>
        Perl scripts written for UNIX. Will they work on NT? <chris.ball@spsg.org>
        Problem with strftime from POSIX.pm <rflens@xs3.xs4all.nl>
    Re: pwd: cannot determine current directory! <cpierce1@ford.com>
        RCS/CVS for perl scripts <nirav@arl.arizona.edu_no_spam>
        Run dos application from cgi in NT shengguan@my-dejanews.com
    Re: Search Text DB file with results... <staffan@ngb.se>
    Re: Sendmail (Chris Murray)
    Re: Speed-optimizing regular expressions (Sean McAfee)
    Re: split? (I R A Aggie)
    Re: Using Multiple Servers (Abigail)
    Re: y2k and 4-digit dates (was Re: foreach and while) <staffan@ngb.se>
    Re: y2k and 4-digit dates (was Re: foreach and while) <staffan@ngb.se>
    Re: y2k and 4-digit dates (was Re: foreach and while) <tchrist@mox.perl.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 9 Mar 1999 16:53:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: [HOW TO?] Strip all but certain characters from a string
Message-Id: <7c3jln$9mc$3@client2.news.psi.net>

Jason Hatcher (Jason@InsideMedicine.com) wrote on MMXVI September
MCMXCIII in <URL:news:7c27f6$dpo@enews2.newsguy.com>:
;; I am looking for an efficient way to strip a string down to only certain
;; characters.


tr/// or perhaps s///.



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


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

Date: Tue, 09 Mar 1999 11:13:30 -0600
From: Kevin Roberts <kmrobert@us.ibm.com>
Subject: AS/400 Perl
Message-Id: <36E556BA.92339BD5@us.ibm.com>

I am trying to run some perl programs on an AS/400 (V4R4M0) and keep
running into a problem when trying to read environment variables.

When the perl program tries to access an environment variable I get the
following error in the perl execution window:

system(CRTCLPGM PGM(QTEMP/QACXKY249S) SRCFILE(QTEMP/QCLSRC)
SRCMBR(QACXKY249S)) failed, Exception Message ID: CPF0801

The source in the temporary cl program is the following:
 PGM
 CRTSRCPF FILE(QTEMP/QACXKY249S) RCDLEN(132)
 OVRDBF FILE(STDOUT) TOFILE(QTEMP/QACXKY249S)
 uname
 ENDPGM

The line with "uname" won't compile because it is not a CL command.

Any help is appreciated.
Kevin Roberts
kmrobert@us.ibm.com




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

Date: Tue, 9 Mar 1999 10:47:48 -0800
From: Elf Sternberg <elf@halcyon.com>
Subject: Compiling perl "somewhere else"
Message-Id: <Pine.GUL.4.10.9903091042550.29528-100000@coho.halcyon.com>


	I'm trying to create a customized perl package using RPM (Redhat
Package Manager.)  The box on which I'm compiling perl is laid out
differently from the ones on which I'll be eventually installing it, and
I'd like a little help modifying the behavior of installperl.  The binary
and Config files typically imbed the /usr/local/lib strings internally,
and I want those to be there during the compilation and build, but when I
'make install' I would like those files to end up in, say,

/tmp/usr/local/lib/perl
/tmp/usr/local/bin/perl

	Then I can use tar or rpm, cd'ing to /tmp, archive the new,
pristine binary tree from there, then copy it to my machines that don't
have perl and untar it there from the root.  Is there a way to do this?

		Elf

Elf M. Sternberg, rational romantic mystic cynical idealist
       If you're so smart, why aren't you naked?
A.A 1493                        http://www.halcyon.com/elf/



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

Date: 9 Mar 1999 16:36:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: constant in Perl?
Message-Id: <7c3imp$9mc$1@client2.news.psi.net>

Greg Bacon (gbacon@itsc.uah.edu) wrote on MMXV September MCMXCIII in
<URL:news:7c1jec$40m$1@info2.uah.edu>:
~~ In article <36E43A99.554D506B@gte.com>,
~~ 	Yu Fang <yfang@gte.com> writes:
~~ : 	#!/usr/local/bin/perl
~~ : 	require 'header.pl';
~~ : 
~~ : 	print PI, "\n";
~~ : 
~~ : It won't work, which means we still can't treat PI as a constant
~~ : anywhere we want. 
~~ 
~~ Sure you can.  Make your header a module and, from it, import whatever
~~ symbols you'd like to be able to see.  See the perlmod and Exporter
~~ manpages for the lowdown.


Why the overkill of Exporter?


$ cat header.pm
use constant PI => 3.1415;  # And something.

1;
$ cat main.pl
#!/usr/local/bin/perl -w

use header;
 
print PI, "\n";

__END__
$


That works just fine.



Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


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

Date: 9 Mar 1999 12:36:10 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: constant in Perl?
Message-Id: <7c3m6a$t8r$1@monet.op.net>

In article <7c3imp$9mc$1@client2.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Greg Bacon (gbacon@itsc.uah.edu) wrote on MMXV September MCMXCIII in
>~~ Sure you can.  Make your header a module and, from it, import whatever
>~~ symbols you'd like to be able to see.  See the perlmod and Exporter
>~~ manpages for the lowdown.
>
>
>Why the overkill of Exporter?
>
>
>$ cat header.pm
>use constant PI => 3.1415;  # And something.


If you `use constant', you are using the Exporter anyway:

% perl -Mconstant -le '$, = "\n"; print keys %INC' 
Carp.pm
Exporter.pm
strict.pm
constant.pm
vars.pm

So using `constant' to avoid the overhead of Exporter is futile.

A low-overhead solution looks like this:

	use myconstants;

Where `myconstants.pm' contains:

	# Note that there is NO PACKAGE DECLARATION HERE.
	sub PI () { 3 }
	sub NUMBER_OF_NOSTRILS () { 2 }
	sub fine_structure () { 7.29735308e-3 }
	1;

That works perfectly well, and you don't need the exporter at all.

(Potential disadvantage: Only one package can `use myconstants'; if
you do a subsequent `use myconstants' in a different package in the
same program, it is ineffective.  To avoid this, you need to use the
exporter, or do the exportation yourself.)






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

Date: 9 Mar 1999 17:41:02 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Continue Script After Error?
Message-Id: <7c3mfe$h6i$1@pegasus.csx.cam.ac.uk>

Tad McClellan <tadmc@metronet.com> wrote:
>   If you just want to eliminate empty files, you can do that right here:
>
>    foreach $file (grep -s, sort { -M "$dir_path/$a" <=> -M "$dir_path/$b" } 
>                                 @files) {

You've left out the $dir_path in the -s.   And it would be a *tiny*
amount more efficient to do the grep before the sort (also untested :-):

    foreach $file (sort { -M "$dir_path/$a" <=> -M "$dir_path/$b" }
                   grep -s "$dir_path/$_", @files) {


Mike Guy


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

Date: 9 Mar 1999 10:45:15 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 3.14: How can I generate simple menus without using CGI or Tk?  
Message-Id: <36e55e2b@csnews>

(This excerpt from perlfaq3 - Programming Tools 
    ($Revision: 1.33 $, $Date: 1998/12/29 20:12:12 $)
part of the standard set of documentation included with every 
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq3.html
if your negligent system adminstrator has been remiss in his duties.)

  How can I generate simple menus without using CGI or Tk?

    The
    http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz
    module, which is curses-based, can help with this.

-- 
"When I originally designed Perl 5's OO, I thought about a lot of this
stuff, and chose the explicit object model of Python as being the least
confusing. So far I haven't seen a good reason to change my mind on that."
(Larry Wall, February 1997, on perl5-porters)


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

Date: 9 Mar 1999 17:16:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Finding comments in a file using regular expressions
Message-Id: <7c3l10$fq1$1@pegasus.csx.cam.ac.uk>

M.J.T. Guy <mjtg@cus.cam.ac.uk> mistakenly wrote:
>What the poster wants is "lines whose first non-whitespace character is
>NOT #".     Since we can write a character which is not whitespace
>and not # as  [^\S#] (don't you love those double negatives?), try
>
>    if (/^\s*[^\S#]/)

Rats.    That should of course be [^\s#].   Which goes to support my
next point.       :-)

>You may find it clearer to think in terms of what you *don't* want  -
>lines whose first non-whitspace character is #:


Mike Guy




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

Date: Tue, 09 Mar 1999 17:40:39 GMT
From: "Jennifer Larson" <resume@mulliganservices.com>
Subject: FL - Boca Raton - Sr. Programmer/Analyst
Message-Id: <r2dF2.6538$Yq5.108745879@news2.pompano.net>

Mulligan Services is currently in need of a Perl/CGI Guru in South Florida.
Superior programming and systems analysis skills. 3+ years using Perl and
CGI to develop real world web applications, 2+ years using Perl to access a
relational database (Sybase preferred), 2+ years using Unix, knowledge of
Apache Web Server, C, shell scripting, vi editor. Great benefits, excellent
starting salary, 55k  100k. EOE

Send correspondence or resume to:
resume@mulliganservices.com
fax: 954-741-2106





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

Date: Tue, 09 Mar 1999 16:46:55 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: flock / sysopen / open confusion
Message-Id: <36e55047.8302957@news.skynet.be>

JPAH-FLA wrote:

>I'm confused. In a recent post by Tom Christiansen he said that another
>Perl group poster had "closed the barndoor after the horses has escaped"
>[1]. The person had done something like
>
>EXAMPLE:
>
>  open F,$myfile;
>  flock F,$LOCK_EX;
>  (do file I/O)

Are you sure it wasn't:

  open F,">$myfile";
  flock F,$LOCK_EX;

In this case, yes, the file is emptied BEFORE it gets locked.

   HTH,
   Bart.


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

Date: 9 Mar 1999 16:50:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to find the hostname of the visitors
Message-Id: <7c3jh1$9mc$2@client2.news.psi.net>

ashishji@hotpop.com (ashishji@hotpop.com) wrote on MMXVI September
MCMXCIII in <URL:news:7c370v$8s2$1@nnrp1.dejanews.com>:
-- How could I find the Hostname of the visitors coming to the my site.


Ask them for their business cards, and stop them at the gate if
that doesn't include their hostname.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Tue, 09 Mar 1999 17:57:38 GMT
From: andy@-nospam-haveland.com (Andrew Haveland-Robinson)
Subject: LDAP: perl.dll not found - where is it?
Message-Id: <36fd60c6.345073078@news.demon.co.uk>

I'm going mad...
I've had perl working fine in many incarnations on NT for ages, until trying
to get LDAP installed...

I'm using ActiveState 5.005_02 and have installed Netscape's SDK...
After spending hours looking for solutions to this, it isn't just me that's
confused, others have posted the same question without getting any answers.
There seems to be so much confusion out there, and with few definitive
answers. There are so many versions, packages, libraries, dlls etc. and with
little explanation to help us build a clear picture of what things are and
why they are there.

All I want to do is query an LDAP server using Perl (or ASP). Surely it
can't be that difficult? Someone must have done it before!

Are there any non-module routines that can do this using just lowlevel
sockets and ports similar to a non-sendmail SMTP conversation?

I'm so frustrated with this. :-(

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HRA Web Services                         Tel. +44 (0)1252-845697
6 Haywarden Place, Hartley Wintney,                 ICQ: 1331640
Hants RG27 8UA England                   Web: http://www.1HR.net


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

Date: Tue, 09 Mar 1999 17:51:45 +0100
From: "Steven <steven@" <"REMOVE>filipowicz.com">
Subject: length of a string.
Message-Id: <920998313.20853.0.spot.c30bf8a6@news.demon.nl>

Hi All,

I'm a beginner to Perl and have a small problem.
This is some code I made :

     if (length ($fields[9]) == 0) { $fields[9] = "nocar.jpg"};

What it should do is check to see if the length of $field[9] is 0 , if
then put the value/string 'nocar.jpg' in it.
I just can't get it working!

Any help is welcome!

PS : If possible reply via email as well : steven@filipowicz.com .
Thanks!


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

Date: Tue, 09 Mar 1999 13:28:48 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: "Steven <steven@" <"REMOVE>filipowicz.com">
Subject: Re: length of a string.
Message-Id: <36E56860.3264C844@giss.nasa.gov>

"Steven
> 
> Hi All,
> 
> I'm a beginner to Perl and have a small problem.
> This is some code I made :
> 
>      if (length ($fields[9]) == 0) { $fields[9] = "nocar.jpg"};
> 

I don't see a problem here.  How is your code not working?

$foo = "biz" if length $foo == 0;
$foo = "biz" unless length $foo != 0;
$foo = "biz" unless length $foo;
$foo = "biz" unless $foo;
$foo = $foo || "biz";
$foo ||= "biz";

	Jay Glascoe
--  
	"Yes, we will have peace, we will have peace when
	 you and all your works have perished [...]
	 You are a liar, Saruman, and a corrupter of men's
	 hearts.  [...]
	 When you hang from a gibbet at your window for
	 the sport of your own crows, I will have peace 
	 with you and Orthanc."

	-- Theoden, House of Eorl, King of Rohan


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

Date: Tue, 09 Mar 1999 19:24:38 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: lower/upper case conversion
Message-Id: <36E56766.BC8FD299@ngb.se>

"Dennis M. Hancy" wrote:
> 
> Probably a simple question, but how can I convert a string to upper or
> lower case in Perl?

uc(), lc(), \U, \u, \L, \l, \E

Read the documentation, man (perlfunc, perlre). (Man in this case being
something I call you. I'm not suggesting you should use man rather than
perldoc)

HTH
Staffan


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

Date: 09 Mar 1999 11:47:37 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: New regex features (was Re: FAQ 4.20: How do I find matching/nesting anything?)
Message-Id: <m33e3e4i0m.fsf@moiraine.dimensional.com>

[ posted and mailed ]

[ this is a reply to an old message, I've had very little
  free time lately to do interesting things like talk about
  perl ]

ilya@math.ohio-state.edu (Ilya Zakharevich) writes:

> The syntax has not been simplified yet to the simplest possible one,
> either with (?p $postponed ), or with //p.

Ok, question time.  I apparently have misunderstood how this
shoudl work.

I have this-
    my $regex;          # declare, don't initialize  (why?)
    my $input = <DATA>;
    $regex = qr!
        \(
        (?:
          (?: [^()]+ )
        |
          (?p{ $regex })
        )*
        \)
        !x;
    print "[$1]\n" while $input =~ /($regex)/g;
    __END__
    (this ( is (an( example ) (of ) some)) balanced) parens

Running it produces-

    [( example )]
    [(of )]

which makes no sense to me.  I expected it to return-

    [(this (is ( an( example ) (of ) some)) balanced)]

What it actually returns is what I would expect to see
from

  qr! (?: [^()]+ ) !x;
    
Is this the expected behavior?

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Tue, 9 Mar 1999 18:03:13 +0000
From: Dev <hr5aa@herts.ac.uk>
Subject: Newbie needs help!!
Message-Id: <Pine.SOL.3.91.990309175856.14889A-100000@gemini>

I have just started using Perl and have come up against a rather annoying 
problem. I am writing a script file that will take users comments and 
place them in a text file, and give the user a dynamically created HTML 
page, thanking him/her for their input. The error I get when I compile it 
is "Missing comma after first argument to open function at comments.cgi 
line 49, near "$fname)". Here is a sample of the code:

$fname = ">>", $COMMENT_FILE;  
open(OUT $fname);

This was an example taken from a book, and I copied it verbatim, which is 
why this error is soooo annoying!! Can anyone help?!??!?

Dev   >:)<-<


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

Date: Tue, 09 Mar 1999 13:18:32 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Dev <hr5aa@herts.ac.uk>
Subject: Re: Newbie needs help!!
Message-Id: <36E565F8.8E1DCAC7@giss.nasa.gov>

[posted and mailed]

Dev wrote:
> 
<snip>
> is "Missing comma after first argument to open function at comments.cgi
> line 49, near "$fname)". Here is a sample of the code:
> 
> $fname = ">>", $COMMENT_FILE;

I think that comma should be a dot, ".".
Your code sets "$fname" to ">>".

try:

$fname = ">>" . $COMMENT_FILE;

or, better:

$fname = ">>$COMMENT_FILE";

> open(OUT $fname);

Now you're missing a comma:

open OUT, $fname;

> This was an example taken from a book, and I copied it verbatim, which is
> why this error is soooo annoying!! Can anyone help?!??!?

Just out of curiosity, which book?

> 
> Dev   >:)<-<

	Jay Glascoe
--
"Soup on all fours?"
"Of course.  Whaddaya think, Soup is a biped?" - mst3k


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

Date: Tue, 09 Mar 1999 18:52:17 GMT
From: pfg@wishard.edu (Pat  Garvey)
Subject: ODBC Memory Leak
Message-Id: <36e56cbc.337774163@news.iupui.edu>

I suspect a memory leak in ODBC for Win32 mod. I very quickly will use
up ALL available memory to Perl on NT if I run the following
algorithm:

       forever {
	 $db = new Win32::ODBC($CONNECTIONSTRING);
	 $db->Sql($SqlStatement);
	 $db->Close();
      }


 .....if I connect once, I never run out of memory. See below:

      $db = new Win32::ODBC($CONNECTIONSTRING);
      forever {
          $db->Sql($SqlStatement);
      }
      $db->Close();


Anyone have any  ideas?

  Pat Garvey


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

Date: Tue, 09 Mar 1999 17:19:53 +0100
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: Perl & PostgreSQL
Message-Id: <36E54A29.519822C8@gredos.cnb.uam.es>

Please, could some of you introduce me on how to work with relational
databases (PostgreSQL, for example) and perl?
What "packages" do I need? What about ODBC in UNIX with PostgreSQL and
perl?
Thanks in advance.
Fede



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

Date: Tue, 09 Mar 1999 19:27:27 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Perl & PostgreSQL
Message-Id: <36E5680F.F7B28ACD@ngb.se>

Federico Abascal wrote:
> 
> Please, could some of you introduce me on how to work with relational
> databases (PostgreSQL, for example) and perl?
> What "packages" do I need? What about ODBC in UNIX with PostgreSQL and
> perl?

Check out PG.pm at http://www.postgresql.org/docs/Pg.pm.shtml

HTH
Staffan


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

Date: 09 Mar 1999 12:02:23 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Perl & PostgreSQL
Message-Id: <m3yal632rk.fsf@moiraine.dimensional.com>

Staffan Liljas <staffan@ngb.se> writes:

> Check out PG.pm at http://www.postgresql.org/docs/Pg.pm.shtml

PG.pm is probably not the best solution for working with
Postgres anymore.  I'd highly recommend using DBI and
DBD::Pg instead.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Tue, 9 Mar 1999 08:08:48 -0800
From: "David Eaves" <dave@californiaic.com>
Subject: Re: Perl format statement question
Message-Id: <36e549fe.0@news.globalpac.com>

won't @<<<\</td> work?

JPAH-FLA wrote in message <36E50FF6.A3009370@nospam.com>...
>Hello. I'm using perl to render a HTML doc, and format statements are
>very good at table tags. However, I'm running into one small problem in
>that the field descriptor is conflicting with the HTML tag, for
>instance:
>
>format LISTF =
><tr>
><td align="center">@###### </td>
>$conf
><td align="center" colspan="2"> @<<<</td>
>$dev
>
>the problem is that the field for $dev is considered to be @<<<<, then
>meaningless /td> is appended to it. Of course I really wanted the field
>to be @<<< and the </td> appended.
>
>I'm getting around this by adding a space like:
><td align="center" colspan="2"> @<<< </td>
>
>but are there other more appropriate solutions? The space throws off
>column centre and width.
>
>Cheers, & Thank-You for considering this question.




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

Date: 9 Mar 1999 12:47:50 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl format statement question
Message-Id: <7c3ms6$le$1@monet.op.net>

In article <36e549fe.0@news.globalpac.com>,
David Eaves <dave@californiaic.com> wrote:
>won't @<<<\</td> work?

No; the backslash appears in the output.


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

Date: Tue, 09 Mar 1999 11:25:03 -0600
From: David L Nicol <david@kasey.umkc.edu>
To: mr_potato_head@my-dejanews.com
Subject: Re: Perl script to emulate communications program
Message-Id: <36E5596F.39003AA7@kasey.umkc.edu>

> >... if response is not received
> >in x seconds timeout


perldoc -f alarm

________________________________________________________________________
  David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
             ++++ stop the execution of Mumia Abu-Jamal ++++
  ++++ more info: http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++


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

Date: Tue, 9 Mar 1999 17:01:18 -0000
From: "Chris" <chris.ball@spsg.org>
Subject: Perl scripts written for UNIX. Will they work on NT?
Message-Id: <920998806.27852.0.nnrp-11.c1ed40e5@news.demon.co.uk>

Can you help?  We are about to move our web site from a UNIX server to one
running Windows NT 4.0.  Does anyone know if we will encounter any problems
with our Perl scripts when we move them over? (these are currently used to
accomplish tasks such as; Logging information, updating pages, and managing
a chat room).

also,

If their is going to be a problem with compatibility, then will the perl
scripts need significant alterations, or is as simple as changing the file
names/references?

I would really appreciate any help regarding this problem.

Thanks in advance,

Chris.






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

Date: 9 Mar 1999 18:20:37 GMT
From: "Ronald F. Lens" <rflens@xs3.xs4all.nl>
Subject: Problem with strftime from POSIX.pm
Message-Id: <7c3opm$jt6$1@news2.xs4all.nl>

All,

I've run across a wierd problem with strftime from POSIX.pm. The weekday
and week of year function (%w and %W) both only return 0. Am I doing
something silly or is something else. My program for testing is :
------------------------
#!/usr/local/bin/perl -w
use POSIX;
$ds=POSIX::strftime('%w %W',0,0,0,9,2,99);
print "$ds\n";
----------------------
The output is :
0 00
I'm using perl 5.004_04 coming from a RedHat 5.2 distribution. The problem
also occurs on a Solaris and a BSDI machine.

Does anyone have a clue what is amiss?

Thanks,
Ronald Lens



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

Date: Tue, 09 Mar 1999 10:16:19 -0500
From: Clinton Pierce <cpierce1@ford.com>
To: Bill Moseley <moseley@best.com>
Subject: Re: pwd: cannot determine current directory!
Message-Id: <36E53B43.FA90A7F0@ford.com>

Bill Moseley wrote:
> 
> I've got STDERR redirected to a log file in a Perl CGI script.
> I'm receiving this message every once in a while in the log file.  I
> haven't been able to figure out what makes it happen, and the script
> seems to run fine.
> 
> pwd: cannot determine current directory!
> 
> Other than 'use lib' and my file open()s, I'm not ever looking at the
> current directory.

The "normal" suspect for this is: You're in a directory which has been
deleted.  Or, in some shells you've traversed through a symlink which is No
Longer There.  open() needs to determine your current directory if you open
a file with relative pathnames.  Backticks and system() need the current
directory if you run anything without a fully qualified pathname (hope
you're not doing that in a CGI).  "use lib" might even do that if the
PERL5LIB variable has a "." in it, or if it can't find libraries I think
"use" looks in the current directory too.


-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Tue, 09 Mar 1999 10:41:24 -0700
From: Nirav Merchant <nirav@arl.arizona.edu_no_spam>
Subject: RCS/CVS for perl scripts
Message-Id: <36E55D43.5E0C7079@arl.arizona.edu_no_spam>

Greetings,
    I was looking for suggestions to manage/version control  perl
scripts that we create in house. The problem being ...a single project
may have 2 to 3 scripts being worked on by 2 students.
RCS/CVS are more "module" based and do not work well for individual
files [ correct me if I am wrong].
    Do you folks have any suggestions on how to manage small projects of
this size ..i.e we could put individual files in subdirectories and
import them as modules ...but that would make the process more painfull.

    Please respond to the newsgroup or my e-mail ..I will post a
summary.

Thanks,
Nirav

PS: I checked langauge.perl.com CPAN and dejanews before posting this.



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

Date: Tue, 09 Mar 1999 17:06:46 GMT
From: shengguan@my-dejanews.com
Subject: Run dos application from cgi in NT
Message-Id: <7c3keu$l66$1@nnrp1.dejanews.com>

Hi,

    I would like to run pkunzip to extract file using cgi. But it seem like no
file is extracted after running. Please help. The platform is NT4.0 with SP4.
Below is the code I'm using:

print "Content-type: text/html \n\n";

print "<html><body bgcolor=white><center>
        <h1>Start Decompressing...</h1><hr size=0>";
$result=`C:/WEBSHARE/WWWROOT/cgi-bin/pkunzip.exe test.zip`;

print "<h3>$result<br>Exit Code:$?<br>";
if($?) {
        print "Failed!<br>";
}else{
        print "Successful!<br>";
}
print "</h3><hr size=0><h1>Terminated!</h1>";

Thank you.
Eng Sheng Guan

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


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

Date: Tue, 09 Mar 1999 19:16:36 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Search Text DB file with results...
Message-Id: <36E56584.76B4D488@ngb.se>

Mike Lee wrote:
> 
> Hi !,
> 
> Does anyone know how to make a DB search with the results look like
> AltaVista
> ???

I think I've answered this before... 

Do this (If you're not worried about time or memory issues): Slurp all
the results into the array @results. Have a hidden variable called
'page' or something on the form. Let $page default to 0. Then send the
results to your output routine like this: 

my $start = $page * 10;
my $end = $page * 10 + 10 > $#results ? $#results : $page * 10 + 10;
my_output_routine(\@results[ $start .. $end ], $page, $#results );

Now you have a ref to the wanted results in $_[0], the pagenumber in
$_[1], and the number of results in $_[2]. (The two last in perl
meaning, i.e, you have $_[2] + 1 results...)

so you can let my_output_routine output the total number of results. To
make a link to the next page, do the following, where $qs is the
querystring:

	$nextpage = $page + 1; 
	$qs =~ s/page=\d+/page=$nextpage/;
	print qq|<a href="my_script?$url">next 10</a>|;

to get the previous page, do

	$prevpage = $page + 1; 
	$qs =~ s/page=\d+/page=$prevpage/;
	print qq|<a href="my_script?$url">prev 10</a>|;

You get the point.

You can easily adapt the number of results to show at the time. It's
also easy to output page numbers with results. This is left as an
exercise to the reader.

HTH
Staffan


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

Date: Tue, 09 Mar 1999 16:54:16 GMT
From: chris.murray@spam.pwgsc.gc.ca (Chris Murray)
Subject: Re: Sendmail
Message-Id: <36e551f4.262272397@news.pwgsc.gc.ca>

You might want to check what the value of $SENDMAIL is set to.  You
might want to see if it looks something like:

$SENDMAIL='/usr/lib/sendmail -t';

Cheers,

Chris


On Tue, 9 Mar 1999 00:31:44 GMT, Rajan Alexander <raj@nyct.net> wrote:

>I am using Matt Kruse's sendmail script and it gives the error "Broken
>Pipe" without a line number.  Here are most likely the offending lines:
>
>open (SENDMAIL,"$SENDMAIL") || die "Ain't Gonna Happen";
>print SENDMAIL "To: raj\@nyct.net\n";
>print SENDMAIL "Subject: \$SUBJECT\n";
>...
>
>close(SENDMAIL);  
>
>
>Does anyone have any experience with this?  I am using my ISP's server.



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

Date: Tue, 09 Mar 1999 17:13:45 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Speed-optimizing regular expressions
Message-Id: <dFcF2.10613$Ge3.42272147@news.itd.umich.edu>

In article <36E7B21043DFDD2A.59D741B1943B44C0.D18D6F4D90825555@library-proxy.airnews.net>,
Joe Stewart  <complangperlmisc@NOSPAMTHANKS.httptech.com> wrote:
>I have a webserver running 250+ virtual hosts. In order
>to free up file handles we have stopped running separate
>logfiles for each client, instead logging everyone to a
>single rotated logfile, with their hits prefixed by the
>domain name of the virtual server it belongs to.

>Now, once a day we are running a perl script to separate
>the 30-50 meg master logfile into per-domain logfiles.

>The code I am using looks like this:

>$domain = $ARGV[0];
>open (IN, "master_access_log") || die "Couldn't open master log!\n";
>open (OUT, "$domain_access_log") || die "Couldn't open $domain access log!\n";
>while (<IN>) {
>        if (s/$domain //o) {
>                print OUT;
>                }
>close (OUT);
>close (IN);

>This works, but it is painfully slow; taking between 10 and
>20 seconds per host, depending on the size of the logfile that day.

You didn't specify what part of each line is the domain, but I'll assume
it's everything up to the first space.  The following approach processes
the entire master access log at once.  It uses "sort" to group the lines
by domain, then merely changes the output file when the domain changes:

open(IN, "sort +0 master_access_log |") || die "Can't open pipe: $!\n";
while (<IN>) {
    s/^(.*?) //;
    if ($1 ne $last_domain) {
        close(OUT);
        open(OUT, ">$1_access_log");
        $last_domain = $1;
    }
    print OUT;
}
close(OUT);
close(IN);

I'm assuming that it's more efficient to use Unix's sort than Perl's, but
I don't know for sure, and I don't have any giant web logs to run a
benchmark on.  If you want to find out, or aren't on a system with "sort",
try this instead:

open(IN, "master_access_log") || die "Can't open access log: $!\n";
while (<IN>) {
    ($domain, $data) = split / /, $_, 2;
    push @{$domain{$domain}}, $data;
}
while (($domain, $list) = each %domain) {
    open(OUT, ">${domain}_access_log")
        || die "Can't open ${domain}_access_log: $!\n";
    print OUT @$list;
    close(OUT);
}

This will really burn through your memory, though, and thus may not work
at all.  If it's a problem, yet another approach would be to only process,
say, 100000 lines at a time:

open(IN, "master_access_log") || die "Can't open master_access_log: $!\n";
$n = 0;
while (<IN>) {
    ($domain, $data) = split / /, $_, 2;
    push @{$domain{$domain}}, $data;
    if (++$n == 100000 || eof) {
        while (($domain, $list) = each %domain) {
            open(OUT, ">>${domain}_access_log")
                || die "Can't append to ${domain}_access_log: $!\n";
            print OUT @$list;
            close(OUT);
        }
        %domain = ();
        $n = 0;
    }
}

 ...Come to think of it, this may be the best way overall.

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: 8 Mar 1999 21:47:52 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: split?
Message-Id: <slrn7e8hh1.cff.fl_aggie@enso.coaps.fsu.edu>

On Mon, 08 Mar 1999 21:33:36 GMT, bing-du@tamu.edu <bing-du@tamu.edu> wrote:

+ There is a string  $test = "3:http://www.test.edu/building.html".
+ How to split this string to get two parts.  One is "3" and the other is
+ "http://www.test.edu/building.html"?

+  ($first, $second) = split(/:/,$test);
+ Then $first is "3".  However $second is just "http" instead of
+ "http://www.test.edu/building.html" which is what I want.

+ Any idea?  Thanks in advance.

Yeah, consult 'perldoc -f split', where we see split has an optional
third argument, LIMIT.

$test = "3:http://www.test.edu/building.html";
($first,$second)=split /:/,$test,2;
print "first: $first\n";
print "second: $second\n";

Results:

first: 3
second: http://www.test.edu/building.html

James - durn aggees



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

Date: 9 Mar 1999 16:58:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Using Multiple Servers
Message-Id: <7c3jvn$9mc$4@client2.news.psi.net>

On Line Auctions UK (support@onlineauctions.co.uk) wrote on MMXVI
September MCMXCIII in <URL:news:36E49950.4FBE2EEE@onlineauctions.co.uk>:
{} I have got two servers one with the main script on it and another that i
{} want to pass data to. I need to post two variables like
{} http://host.com/cgi-bin/script.cgi?var1=thing&var2=thing2 to the script
{} on the other server. But how do actually code this in Perl.


man perlipc




Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: Tue, 09 Mar 1999 19:01:02 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <36E561DE.39EE75C4@ngb.se>

Russell Schulz wrote:
> >> actually, for the overwhelming majority of cases (AD1-AD9999), 
> >> [4 digit dates do fix everything]
> > Actually, AD1-AD9999 isn't really the overwhelming majority of all
> > cases. 
> I never said AD1-9999 are the overwhelming majority of dates.

Why does this give me the feeling that I'm dealing with topmind? No,
honestly, I see your point: Overwhelming majority of cases, not dates.
But NB: That is for you. I think we both agree on that it's important to
think very clearly about context... If you ever do freelance work, you
should be careful to check with your customer what kind of dates they
are dealing with... If they are a historical institute, they might just
need that extra digit... And if they're a astronomical institute, I'd
give them 10 extra... Memory isn't THAT expensive these days. :-)

> for the overwhelming majority of cases ANYONE has to consider, I 
> believe 4 digit AD dates are the solution.

Or maybe you don't agree. I don't know. I'd say: Use what's appropriate
for the situation. I kindof agree with abigail, that for writing a list
of things to do, 6 digit years, even in some stupid 1/2/00 format, is
more than enough (though I personally conform to ISO standards...)

> but in the overwhelming majority of the cases under consideration, 
> even including these people, it is enough.

OK.

> there has been for a long time.  when did you first hear about a 106
> year old person getting a mailed notice reminding him/her that school
> was starting, and he/she'd better be ready to attend?

I think this was a problem even BEFORE computors and computor
programmers...

Staffan


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

Date: Tue, 09 Mar 1999 19:32:38 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <36E56946.B7D63AD6@ngb.se>

Abigail wrote:
> No it won't. You still have to display it to be useful. And 1/2/2000 will
> still be ambiguous, no matter how you store it internally.  Most users
> have no idea what the ISO format is; and even if they know, "1/2/2000"
> doesn't indicate it's in ISO format. You would have to start writing
> down something like "20000201" and hope people realize it's a date in
> ISO format and not something triggered by a Y2K bug.

I usually output "February 2nd, 2000", which people tend to understand.
The conversion is a, what, ten-line perl sub? When it comes to input
it's tougher. Then I usually require people to input ISO dates, by
stating (yyyymmdd) next to the input field. Off course it would be
possible to interpret (almost) any other format as well, as long as I
know which format it is....

Staffan


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

Date: 9 Mar 1999 11:58:02 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: y2k and 4-digit dates (was Re: foreach and while)
Message-Id: <36e56f3a@csnews>

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

In comp.lang.perl.misc, Staffan Liljas <staffan@ngb.se> writes:
:Then I usually require people to input ISO dates, by
:stating (yyyymmdd) next to the input field. 

That doesn't work for most "regular" people.  It's very strange
to them.

--tom
-- 
Hi, this is Ken. What's the root password?


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5095
**************************************

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