[8340] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1957 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 23 10:18:08 1998

Date: Mon, 23 Feb 98 07:00:47 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 23 Feb 1998     Volume: 8 Number: 1957

Today's topics:
    Re: [Fwd: A Few Questions about Form Handling] (Tom Grydeland)
    Re: add user automatically to the passwd file with a Pe <Paul.Makepeace@POBox.com>
        ANNOUNCE: DOCModify 1.2 to modify fields in every file <pivari@geocities.com>
        ANNOUNCE: IndexMaker 4.3: an index.html maker from PDF, <pivari@geocities.com>
        Color checking function <rets@meta3.com>
        Conning strict refs? (was Re: Can't use string ("") as  <Paul.Makepeace@POBox.com>
    Re: emacs??? <c.evans@clear.net.nz>
        Error message <simon@sebby.demon.co.uk>
        finding the second instance of a pattern match on a lin <Mark.Fynes@cs.tcd.ie>
    Re: finding the second instance of a pattern match on a <tchrist@mox.perl.com>
    Re: FTP files without Net::FTP? <c.evans@clear.net.nz>
        How to get the encrypted password string ? (Baher M. Safwat)
    Re: if you're going to answer FAQs... Proposal: use SEE (Tom Grydeland)
        Is the PERL 5 Year 2000 compliance ? <pwwc@netvigator.com>
    Re: Is the PERL 5 Year 2000 compliance ? <craig@mathworks.com>
    Re: Is the PERL 5 Year 2000 compliance ? (hymie!)
    Re: Is the PERL 5 Year 2000 compliance ? (I R A Aggie)
    Re: lwp-mirror: at vs cron <paul.joslin@sdrc.com>
    Re: Off-topic (Sorry, but I need your help) <Paul.Makepeace@POBox.com>
    Re: Perl4 -> Perl5 warning turned fatal message on open (Tom Grydeland)
    Re: Philisophical Response? Perl5/oop (Nathan V. Patwardhan)
    Re: Q: scalar @{[/$f/g]} (M.J.T. Guy)
    Re: search and edit a single line of a Textfile (Tom Grydeland)
    Re: search and edit a single line of a Textfile <tchrist@mox.perl.com>
        Why not RegEx in $/? <cnwetzel@linguistik.uni-erlangen.de>
        Win32::Mutex - help requested <mm@condat.de>
    Re: Win95 dial-up network programming <jim.michael@gecm.com>
    Re: Works on Linux but not NT <c.evans@clear.net.nz>
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl <stu@grayechnologies.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 23 Feb 1998 13:58:28 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: [Fwd: A Few Questions about Form Handling]
Message-Id: <slrn6f3044.6h2.Tom.Grydeland@mitra.phys.uit.no>

On Sat, 21 Feb 1998 13:25:43 -0500,
Lee Nelson <ldn123NOSPAM@pobox.com> wrote:
> This is a multi-part message in MIME format.
> --------------61E0D6EF59A0076E24104F5E

Don't do that.  Please.

> I'm a Perl beginner, but I'm going to take a stab at this one...


Some questions are asked more often than others.  These are called
"Frequently Asked Questions", abbreviated FAQ.

In many cases, to avoid answering the same questions over and over,
some helpful soul compiles a list of such questions with authoritative
answers.  It is commonly considered a minimum effort to search for such
a list and consult it before posting your problem to the newsgroup
-- especially if you're a beginner, since your problem is even less
likely to be new. -- 

With your copy of perl, you should have received extensive
documentation, and the Perl FAQ is part of this documentation.

A search for the word "cgi" in the headlines of the FAQ pages gives
only six hits:

perlfaq3.pod:=head2 How can I generate simple menus without using CGI or Tk?
perlfaq3.pod:=head2 How can I make my CGI script more efficient?
perlfaq3.pod:=head2 Where can I learn about CGI or Web programming in Perl?
perlfaq9.pod:=head2 My CGI script runs from the command line but not the
    browser.  Can you help me fix it?
perlfaq9.pod:=head2 How do I make sure users can't enter values into a
    form that cause my CGI script to do bad things?
perlfaq9.pod:=head2 How do I decode a CGI form?


> I think that the fields arrive in order in the input stream.  If
> that is the case, then you can simply build your output string
> while you are parsing the input initially, as shown in the
> modified routine below.  Note that $output is initialized.


The proper way of doing this is using the CGI module.


>             Lee Nelson

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 23 Feb 1998 13:03:26 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: add user automatically to the passwd file with a Perl Script
Message-Id: <6crs5c$sl6$1@rockcake.bt.net>

Hagen Seyring wrote in message <34f13e81.0@news.sireco.de>...
>I want add user automatically to the passwd file with a Perl Script.
>Are there any perl modules or scripts which i can use?

Yes!

# perl -e '`/usr/sbin/useradd`'

Try:

$ man passwd
$ man shadow

This is a system-specific Unix question. Adding lines to files is easy in
Perl.

Cheers, Paul.




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

Date: Mon, 23 Feb 1998 10:30:54 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: DOCModify 1.2 to modify fields in every file
Message-Id: <34F14FDD.A315A43A@geocities.com>

Hi,

I'm glad to announce the version 1.1 of DOCModify.
DOCModify is a very flexible and powerfull PERL script. It permits you
to modify in every format file the fields you specify in the
configuration file modify.cfg. It works
 with PERL 5.x on UNIX and Wintel Systems.
This tool is a free ANFACE Software tool.

What's new in 1.2 version:
Add separator option
 -separator character         the separator used in configuration file
(default ";")

This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Hangar/4794/

Enjoy it!

Send me your suggestions.



--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/





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

Date: Mon, 23 Feb 1998 09:51:30 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: IndexMaker 4.3: an index.html maker from PDF,HTML,VRML and other files
Message-Id: <34F146A2.379C47D8@geocities.com>

Hi,

I'm glad to announce the version 4.3 of IndexMaker a perl script to make

an index.html file from PDF, HTML, VRML and other files.
At the moment, it uses
the /Author field, the first /Title field and in the /Subject field
every matched PDF files,
the <TITLE> </TITLE> field and  the META Description and Author fields
in every matched HTML files
the Info node field in every matched VRML 1.0 files
the WorldInfo node field info and title in every matched VRML 2.0 files
and the name of the file in the others.
It should work with PERL 4 and 5.

What's new with version 4.3
In the configure file now it's possible to describe the extensions of
the
categories  HTML files, PDF files, VRML files, Graphic files, Compressed
files,
Others


This is the URL where you can find the tool
http://www.geocities.com/CapeCanaveral/Lab/3469

Enjoy it!
Have a nice Christmas and a happy new year!

Send me your suggestions

--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/





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

Date: Mon, 23 Feb 1998 06:27:09 -0600
From: Ken Holm <rets@meta3.com>
Subject: Color checking function
Message-Id: <34F16B1D.865C8AD9@meta3.com>

Perhaps this will be useful to some folks.  Use it freely.  Modify, make
better, etc.

-K

################
sub checkColor {
    my ($color) = @_;
    $color =~ tr/a-z/A-Z/;
    my %colors = ("AQUA"   => "#00FFFF", "BLACK"   => "#000000", 
		  "BLUE"   => "#0000FF", "FUCHSIA" => "#FF00FF", 
		  "GRAY"   => "#808080", "GREEN"   => "#008800", 
		  "LIME"   => "#00FF00", "MAROON"  => "#800000", 
		  "NAVY"   => "#000080", "OLIVE"   => "#808000", 
		  "PURPLE" => "#800080", "RED"     => "#FF0000", 
		  "SILVER" => "#C0C0C0", "TEAL"    => "#008080", 
		  "YELLOW" => "#FFFF00", "WHITE"   => "#FFFFFF");

    return($colors{$color}) if ($colors{$color});
    return (0) unless $color || (length $color != 7);
    my $return = 0;
    my $hold = $color;
    if (length $color == 7) {
	$color =~ s/[G-Z]//;
	$color =~ s/\W//g;
	if ($color eq substr($hold, 1, 6)) {
	    $return = $hold;
	}
    }
    return($return);
}


Usage:

my $Color;

doWhatever() if ($Color = checkColor(RGBHexTriplet | ColorName) );

The function first checks to see if the info passed to it is one of the
sixteen colors okayed by HTML 3.1 (many more in HTML 4).  If it is the
corresponding RGB Hex triplet is passed back prepended with a '#'.  If
the passed info is not one of the sixteen colors, it checks to see if
the info passed is a RGB Hex triplet (with the first character being a
'#').  If so, that triplet is turned into all CAPs and passed back.  If
neither of the previous two conditions are met, a return value of zero
(false) is returned.


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

Date: Mon, 23 Feb 1998 11:19:34 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Conning strict refs? (was Re: Can't use string ("") as a subroutine ref while "strict refs" in use)
Message-Id: <6crm2e$qk9$1@rockcake.bt.net>

In the interests of saving taxpayers money I've snipped a lot. Hope I
haven't lost too much context (if in doubt, http://www.dejanews.com/)

Paul Makepeace wrote in message
<887664292.20906.0.nnrp-07.9e98490c@news.demon.co.uk>...
>
>$^W = 1;
>use strict refs;
=snip

Generated a hash of (text_string => \&sub_to_call) which in this case
text_string and sub_to_call were textually related (eg admin => \&Admin) so
offered the following hack for fun:

=cut
>Of course, if making one of those SubTable's looks boring,
>
>my @SubTable = qw(Admin Logs Targets Usenet);
>my %SubTable;
>@SubTable{map {lc $_} @SubTable} = map {\&$_} @SubTable;
>
>It's not big and it's not clever but it does give you a level of job
>security.
>
>Cheers, Paul.
>
>(I'm slightly surprised \&$_ got past strict refs...? [5.004_02/NT])

OK, so how *does* \&$_ not get caught by strict refs? It's starting to bug
me now...

Paul.




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

Date: 23 Feb 1998 22:46:57 +1300
From: Carey Evans <c.evans@clear.net.nz>
Subject: Re: emacs???
Message-Id: <871zwutzzk.fsf@psyche.evansnet>

scott@softbase.com writes:

> When the closing brace does not line up, you know you are in
> trouble and need to go looking for a finger check. You instinctively
> know something is wrong because the indention quits lining up
> properly.

You also get a good idea after doing (paren-set-mode 'paren) when it
displays in red instead of green, or in the wrong place.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	  GNU GPL: "The Source will be with you... always."


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

Date: 23 Feb 1998 12:39:04 GMT
From: "Simon Doyle" <simon@sebby.demon.co.uk>
Subject: Error message
Message-Id: <01bd405d$57254b40$fd013287@00478>

Hope I'm in the correct newsgroup, here goes..

When I run a perl script of any kind I get the following message.

perl: can't resolve symbol '__iob'

Is this a problem with perl or something else...I'm desperate.


Thanks in advance, sorry if I'm in the wrong place.

sdoyle@sebby.demon.co.uk


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

Date: Mon, 23 Feb 1998 11:46:49 -0000
From: "Mark Fynes" <Mark.Fynes@cs.tcd.ie>
Subject: finding the second instance of a pattern match on a line
Message-Id: <6crngt$27l@web3.tcd.ie>

Hi,

if I'm searching for a pattern which may occur more than once in a line
say 4 x's, arbitrary text and 4 x's again,

/xxxx(.*?)xxxx/ and then $1 is what I'm looking for.

What if there were a few of these on the one line?

I suppose split() could be used to ensure that you break up the incoming
lines
so there is only one per line, but what could you use as a pattern for
split. Doesn't it
remove the pattern from the new array elements created? So by using
split /xxxx/ "$_"/ I wouldn't have the ability to do the above pattern
match?


any clarity on this issue would be much appreciated

regards
Mark Fynes
Mark.Fynes@cs.tcd.ie





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

Date: 23 Feb 1998 13:08:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: finding the second instance of a pattern match on a line
Message-Id: <6crscf$p8f$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, "Mark Fynes" <Mark.Fynes@cs.tcd.ie> writes:
:What if there were a few of these on the one line?

To match only the first per variable:

    if ( /pat/ ) { ACTION }

But to find all matches in the variable:

    while ( /pat/g ) { ACTION }

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like 
reading a suicide note -- three days too late."
	    --Tom Christiansen <tchrist@mox.perl.com>


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

Date: 23 Feb 1998 23:24:22 +1300
From: Carey Evans <c.evans@clear.net.nz>
To: Power Tools Busines Services NV <ptbs@ping.be>
Subject: Re: FTP files without Net::FTP?
Message-Id: <87wwemsjop.fsf@psyche.evansnet>

Power Tools Busines Services NV <ptbs@ping.be> writes:

> I 've read the other articles in this newsgroup and I discovered the use
> of Net::FTP.  I 've downloaded the modules and discovered that they
> might be very useful.
> Then I wanted to use them myself.  I contacted my provider and then the
> problems occured.  They only deliver the standard PERL package, and they
> don't allow us to use "perl Makefile.pm" to add new modules.

1. Get a new provider.
2. Convince your current provider to upgrade to 5.004, because of the
   *security holes* in earlier versions.  Then tell them they might as
   well install the standard libnet library (and LWP if you're
   ambitious) while they're at it.
3. Copy the libnet files into the directories your provider gives you
   and "use lib" them.  (Maybe "perl Makefile.PL" them yourself and
   copy the directory tree over.)
4. Copy everything out of Net::FTP etc. and put it at the top of your
   script.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	  GNU GPL: "The Source will be with you... always."


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

Date: Mon, 23 Feb 1998 10:17:29 GMT
From: bsafwat@egyptonline.com (Baher M. Safwat)
Subject: How to get the encrypted password string ?
Message-Id: <34f14aad.612539585@news>

I use Solaris 2.5.1 on Sun Ultra1 ,
when using the perl function to get the password of a certain user
it return the "x" from the /etc/passwd  file instead of the encrypted
string from the /etc/shadow

	:
	:
($encstring) = (getpwnam("username"))[1];
$salt = substr($encstring,0,2);
$encpass = substr($encstring,2);
	:

what is the correct usage ?!
or which function to use instead?

thanks



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

Date: 23 Feb 1998 13:30:42 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: if you're going to answer FAQs... Proposal: use SEEFAQ and/or OFFTOP
Message-Id: <slrn6f2ug1.6h2.Tom.Grydeland@mitra.phys.uit.no>

On Sun, 22 Feb 1998 23:11:55 +0000,
Russell Schulz <Russell_Schulz@locutus.ofB.ORG> wrote:

> the problem I mentioned is dealing with a bimodal person where half
> of the posts are useful, and half are the same rote text.

My "solution" has been to score down posts with *exactly one* reference.

The immediate RTFMs go away, while any discussion survives, and useful
references can always be hunted down by hand.

It's not perfect, but it works for me.

> Russell_Schulz@locutus.ofB.ORG  Shad 86c

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Mon, 23 Feb 1998 19:18:23 -0800
From: Paul <pwwc@netvigator.com>
Subject: Is the PERL 5 Year 2000 compliance ?
Message-Id: <34F23BFF.3C29@netvigator.com>

Dear all,

Do anyone know whether the PERL 5 is Year 2000 compliance ?  Or, anyone
is responsible for this issue ?

Thanks,
Paul


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

Date: Mon, 23 Feb 1998 09:01:30 -0500
From: Craig Ciquera <craig@mathworks.com>
To: pwwc@netvigator.com
Subject: Re: Is the PERL 5 Year 2000 compliance ?
Message-Id: <34F18139.185AA5CC@mathworks.com>

Check out this link for some great information on this issue:

http://language.perl.com/news/y2k.html

Craig

Paul wrote:

> Dear all,
>
> Do anyone know whether the PERL 5 is Year 2000 compliance ?  Or, anyone
> is responsible for this issue ?
>
> Thanks,
> Paul



--
Craig Ciquera                       Tel: (508) 647-7547
The Mathworks, Inc.                 FAX: (508) 647-7002
24 Prime Park Way, Natick MA 01760
mailto:craig@mathworks.com          Web: http://www.mathworks.com




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

Date: 23 Feb 1998 14:24:53 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: Is the PERL 5 Year 2000 compliance ?
Message-Id: <6cs0rl$2fk$1@news.smart.net>

In our last episode, the evil Dr. Lacto had captured our hero,
  pwwc@netvigator.com, who said:

>Do anyone know whether the PERL 5 is Year 2000 compliance ?  

Perl 5 is year-2000 compliant.  Are your perl programs compliant?

 ..hymie!
http://www.smart.net/~hymowitz * agis customers: e-mail and web service refused
hymie@lactose.smart.net ********** pgp public key: e-mail pgp@lactose.smart.net
===== Unsolicited commercial e-mail spam will be forwarded to postmasters =====


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

Date: Mon, 23 Feb 1998 09:43:08 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is the PERL 5 Year 2000 compliance ?
Message-Id: <fl_aggie-2302980943080001@aggie.coaps.fsu.edu>

In article <34F23BFF.3C29@netvigator.com>, pwwc@netvigator.com wrote:

+ Do anyone know whether the PERL 5 is Year 2000 compliance ?  Or, anyone
+ is responsible for this issue ?

Did you look in the FAQ? look in the docs? search DejaNews?

Taken from 'perldoc -f gmtime':

   Also, $year is the number of years since 1900, not simply the last 
   two digits of the year.

What does that sound like to you?

James - and yes, this _is_ a quiz...

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: 23 Feb 1998 09:32:26 -0500
From: Paul Joslin <paul.joslin@sdrc.com>
Subject: Re: lwp-mirror: at vs cron
Message-Id: <y4dn2fi4cjp.fsf@sdrc.com>

>>>>> "Bill" == Bill Jones <webmaster@fccj.cc.fl.us> writes:

    Bill> [courtesy cc of this posting sent to cited author via email]
    Bill> If 'cron' is dying because it wants input - I would look at
    Bill> where the 'input' is supposed to come from...

    Bill> Other than that, are there any other messages?

    cron is not dying because it wants input, nor is it expecting
arguments.  The cron log file indicates the command completes successfully.
For both "at" and "cron", the script is called as "/x/y/z/do_mirror", where
/x/y/z is the full path name to the command.  The filesystem is not
automounted, and there are no ENV variables in the path.
--
Paul R. Joslin          I do quarrel with logic that says,
paul.joslin@sdrc.com    `Stupid people are associated with X,
+1 513 576 2012         therefore X is stupid.'  Stupid people
                        are associated with everything.'
			--Larry Wall in
			<1992Dec31.203724.26018@netlabs.com>


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

Date: Mon, 23 Feb 1998 10:29:42 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: Off-topic (Sorry, but I need your help)
Message-Id: <6crj4t$ppa$1@rockcake.bt.net>


Bill Jones wrote in message <34F05161.DE87BE44@fccj.cc.fl.us>...
>Unix kicks asss,
>Unix is the standard,
>MS does not run on Unix,

Rumours I've heard, http://www.microsoft.com/ does run on Unix :-)

Paul




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

Date: 23 Feb 1998 13:43:41 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Perl4 -> Perl5 warning turned fatal message on open() call
Message-Id: <slrn6f2v8c.6h2.Tom.Grydeland@mitra.phys.uit.no>

On 22 Feb 1998 10:16:02 GMT,
enaiman <enaiman@ndsisrael.com> wrote:

> What gives?  What is the official way to work with indirect filehandles?

IO::File or IO::Handle

> (I also know about using my instead of local, I just wanted a script that
> ran in both 4 & 5.)

There are several reasons to upgrade and abandon old Perls, not the
least of which is the CERTifiable security risks associated with older
Perls.

> I'm working on upgrading a system written in Perl 4.036 to Perl5, and I
> don't want to have to re-write everything.  Where can I find a complete
> list of CHANGES between Perl 4 and 5?  I have read some of them and haven't
> found a reference to the above problem.

> Ephrayim "EJ" Naiman


Anyway, if you're adamant on staying in the dark ages, try:

local(*FH);	# typeglobbing
open(FH, "<no_such_file") || die "Nono: $!\n";

# etc


-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 22 Feb 1998 19:21:28 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Philisophical Response? Perl5/oop
Message-Id: <6cptro$lrr@fridge.shore.net>

Laurel Shimer (autopen@autopen.com) wrote:

: subroutine calls, etc.) that I am 'writing in Perl 5'. He, of course,
: feels that to write in Perl 5 is to write object oriented only.

No.  He's incorrect.  There's been much written in Perl (using 'Perl
5') that's not OOP.

Ohh the buzzwords that people will fall for.  That Java is bound to do
us all in.  :-)

--
Nathan V. Patwardhan



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

Date: 23 Feb 1998 14:10:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Q: scalar @{[/$f/g]}
Message-Id: <6cs01h$m1v$1@lyra.csx.cam.ac.uk>

Andrew Johnson  <ajohnson@gpu.srv.ualberta.ca> wrote:
>
>as of 5.004:
>
>$e=()=/$foo/g;
>
>but although I've mentioned it before, I've yet to hear whether
>this (apparently undocumented) behaviour is intentional or
>merely an accident of other changes in 5.004.

It was an entirely deliberate bug fix, and not a side effect of any other
change.   Versions of Perl before 5.004 had a bug that the empty list
was not acceptable as the LHS of an assignment, if it was written as ().
An empty list could be assigned to if it was written in some more
complex way, or you could assign to a non-empty list:

$e=@{[]}=/$foo/g;
$e=1?():()=/$foo/g;
$e=(undef)=/$foo/g;

All rather clumsier than Andrew's version.


Mike Guy


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

Date: 23 Feb 1998 13:47:58 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: search and edit a single line of a Textfile
Message-Id: <slrn6f2vge.6h2.Tom.Grydeland@mitra.phys.uit.no>

On 22 Feb 1998 18:40:38 GMT,
Laurel Shimer <autopen@autopen.com> wrote:

>    if ($line =~ "servertask=") {print "$line \n";}

That is horribly wrong.

What you need is:

    if ($line =~ /^servertask=/) { ... }

or

    if (index $line, "servertask=" == 0) { ... }


perldoc perlop
perldoc perlre
perldoc -f index

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 23 Feb 1998 14:52:28 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: search and edit a single line of a Textfile
Message-Id: <6cs2fc$3mg$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    Tom.Grydeland@phys.uit.no (Tom Grydeland) writes:
:That is horribly wrong.
:What you need is:
:or
:    if (index $line, "servertask=" == 0) { ... }

Unfortunately, so is that.  That parenthefies:

    if (index($line, ("servertask=" == 0) ) { ... }

But you wished it to mean:

    if (index($line, "servertask=") == 0) ) { ... }

Please just use parens.  You'll be much happier.

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


    "You can only measure the size of your head from the inside." --Larry Wall


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

Date: Mon, 23 Feb 1998 14:05:24 +0100
From: Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de>
Subject: Why not RegEx in $/?
Message-Id: <34F17414.5287@linguistik.uni-erlangen.de>

Why isn't it possible to use a regular expression for
$/ ($INPUT_RECORD_SEPARATOR)? The perlvar page says:

 Remember: the value of $/ is a string, not a regexp. 
 AWK has to be better for something :-)  

I think it could be very useful to cover different
separators when processing big input texts, cause
not all input has a uniform structure. Imagine formats
like HEADER-BODY-FOOTER, separated by empty lines, and
the BODY consisting of a large list of units which are
separated by "some-literal-string". If I want to parse
that input correctly, I can do it in three ways:

$/="":   
  resulting in three chunks (HEADER-BODY-FOOTER), one 
  of them (BODY) possibly too large to be read into 
  memory all at once;

$/="\n": 
  resulting in a lot of separate lines, but I have 
  to glue them together by hand to get the needed
  information chunks;

$/="some-literal-string":
  resulting mainly in the right chunks, but the first
  and the last have to be processed to extract the
  HEADER and FOOTER parts.

All of these alternatives are ugly; either too much
system resources are consumed or a lot of effort is
needed to rearrange the input lines to get the desired
logical units. Writing my own I/O-Routines seems to
be odd for me, when the whole problem could be solved
by allowing regular expressions for $/.

Do you think such a feature would be useful? Why
didn't Larry Wall include it (see quote above)?

Christian


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

Date: Mon, 23 Feb 1998 13:40:42 +0100
From: Michael Mueller <mm@condat.de>
Subject: Win32::Mutex - help requested
Message-Id: <34F16E48.154258EA@condat.de>

Hi all,

I've got a little problem with the Win32::Mutex package.
The Perl-version I use is the recent one from ActiveState
(Build 315).

I tried the following little script, which steadily refuses
to work properly. In my opinion, it should work, but I have
to admit that this mutex stuff is quite new to me. So
perhaps there's some foolish newbie-mistake in there. ;-)

---------------------------
use Win32::Mutex;

Win32::Mutex::Create($Mut,0,"MyMutex") || die $!;
$Mut->Wait(10000) || die $!;
print "Access to resource\n";
$Mut->Release() || die $!;
---------------------------

After the execution of the script I receive the error message:
"No such file or directory at mutextst2.pl line 4."
(Line 4 is the one with Wait-procedure-call.)

What file or directoy is meant?
How do I use the Win32::Mutex package correctly?

Many thanks in advance,
Michael

-------------------------------------------------------------
 Michael Mueller
 Condat GmbH, Alt-Moabit 91d, 10559 Berlin
 eMail: mm@condat.de
 ------------------------------------------------------------



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

Date: Mon, 23 Feb 1998 09:33:39 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Win95 dial-up network programming
Message-Id: <34F188C3.7156@gecm.com>

Fred K. Lenherr wrote:
> 
> I've used Perl for networking on UNIX systems, but can't get it to work
> on my home Win 95 system (dial-up access with dynamic IP addresses).
> 
> The ports and FAQ's for Win32 all seem to assume you're running NT.
> I've got Perl installed and working fine, but how do I do a connect()
> and
> other network stuff?

You can use the same API call. RAS Dial or something like that. 
Try a Win32 newsgroup or dejanews for further info. HTH.

Cheers,

Jim


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

Date: 23 Feb 1998 23:12:36 +1300
From: Carey Evans <c.evans@clear.net.nz>
To: jmohr@grizzly.ccsd.k12.wy.us
Subject: Re: Works on Linux but not NT
Message-Id: <87zpjisk8b.fsf@psyche.evansnet>

jmohr@grizzly.ccsd.k12.wy.us writes:

[snip]

> perl -p -i -e 's/(<STRONG)/$1 class=\"special\"/g' *.html
> 
> Recently I downloaded perl for WindowsNT, but when I try the same
> command line statement I get the following error:
> 
> "Can't do inplace edit without backup."

Did you read the perlrun docs?  Anyway, the answer's probably:

    perl -p -i~ -e 's/(<STRONG)/$1 class=\"special\"/g' *.html

Unix file systems allow reading from a deleted file.  NT does not, at
least in the environment Perl runs in.

Looking at how Perl does it, I would never use just "-i" anyway, since
the file could be deleted completely, or truncated, if I killed the
script at the wrong time.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	  GNU GPL: "The Source will be with you... always."


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

Date: 23 Feb 1998 13:07:08 GMT
From: "Stu" <stu@grayechnologies.com>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <01bd405b$ff1af400$0fd29cce@kiki.graytechnologies.com>



Daniel P. B. Smith <dpbsmith@world.std.com> wrote in article
<EopCqt.J75@world.std.com>...
> In article <34EDBD17.16475955@medit3d.com>,
> Colin Dooley  <colin@medit3d.com> wrote:
> >Steve Dover wrote:
> >> 
> >> Time marches on, but by design, a given date or timestamp datam
> >> will only be allocated so many bits.  At some point in time,
> >> more bits will need to be allocated.  There's no way around it.
> >
> >In a billion years the Sun will explode and you won't need to
> >worry about it any more. This suggests that a 64 bit time_t
> >ought to be enough...
> 
> How can you tell?  When I was in junior high school, the continents
didn't
> drift.  I don't mean that scientists didn't KNOW they drifted.  I mean
> that scientists DID know that they DIDN'T drift.  Continental drift had
> been a cockamamie theory put forward by a few geologists in the 1930's
and
> it had been disproved, debunked.  It didn't happen.
> 
> Sometime between the fifties and the eighties, the continents cut loose
> from their mooring and began to drift.
> 
> And I've lost track of what the Universe does--we've gone through so many
> cycles of it's-continuous-creation, no-it's-a-big-bang,
> no-it-explodes-then-collapses, does to, does not, 'tis to, 'tis not...
> 
> No, I wouldn't want to gamble on 64 bits being enough.  
> 
> (As for expecting to live that long: no, dammit, I don't.  And it's very 
> annoying, because some scientists just think they found out the basic
> clue to cell aging--the DNA gradually forms endless loops or something. 
I
> can just see it: with MY luck, the secret of immortality will be
> discovered a decade or so after I die.  It's enough to make one pout.)
> 
> -- 
> Daniel P. B. Smith
> dpbsmith@world.std.com
> 

People have defined time as a real linear value. So 64
bits of seconds maybe seem like enough time, but is that enough
nanoseconds? picoseconds? Technology is making much smaller
things much more important (higher frequencies, smaller times).

We'll never have enough bits and by the nature of time, any fix is -
temporal.

-- 
-- Stu
-- Gray Technologies, Inc
-- to reply delete the REMOVE from the e-mail address


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

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

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