[10417] in Perl-Users-Digest
Perl-Users Digest, Issue: 4010 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 19 16:02:47 1998
Date: Mon, 19 Oct 98 13:00:26 -0700
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, 19 Oct 1998 Volume: 8 Number: 4010
Today's topics:
anyone used File::lockf?? <ff@otis.arraycomm.com>
Re: Apache-User (John Stanley)
Re: Assigning to $! <jdporter@min.net>
Atlanta PERL Programmers Needed !!!!!!! (Register Agent for $29US)
chmod() ??? <phinneas@eskimo.com>
Re: chmod() ??? (Larry Rosler)
Re: chmod() ??? <barnett@houston.Geco-Prakla.slb.com>
Re: CPAN and Netscape 4.5/Linux droby@copyright.com
Easy Fix ... Re: Resubmitted ... Removing spaces betwee <whitepr@scp1.bellcore.com>
Re: Glob Prob <ebohlman@netcom.com>
grep in perl <meenu@ms.washington.edu>
HELP! Error w/ Config.pm : tie %%Config, Config; <ruprechta@hotmail.com>
how do you search subdirectories for a file? <jatara_brown@hp.com>
Re: how do you search subdirectories for a file? (Sean McAfee)
Installing modules on Win'95 olrcc@scisun.sci.ccny.cuny.edu
Re: lack of flock() for Win95/98? fix? (Daniel Beckham)
missing file while "make"ing modules (Axel Kuester)
Re: New Module: File::Finder -- OO version of File::Fin <jdporter@min.net>
None (Piet Barber)
Re: Passing by Reference for Performance Reasons? (Mark-Jason Dominus)
Re: Perl Sockets, receiving data. <zenin@bawdycaste.org>
Re: Perl Y2K copmliance (Patrick Timmins)
Q: Simple parsing of string (Greg)
Re: QUERY_STRING + code ??? <evonzee@tritechnet.com>
Re: QUERY_STRING ???? (Patrick Timmins)
Re: QUERY_STRING ???? (Larry Rosler)
regexp question rhaig@news.hackboy.com
Re: regexp question (Larry Rosler)
Re: regexp question (Bart Lateur)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Oct 1998 18:46:39 GMT
From: Farhad Farzaneh <ff@otis.arraycomm.com>
Subject: anyone used File::lockf??
Message-Id: <vun26s2xv4.fsf@otis.arraycomm.com>
Hello,
I'm trying to use the lockf module to lock files across the network but
have not had much luck. Would really appreciate a hint or a clue. Here's
a simple script that shows the problem:
#!/bin/perl -w
use strict;
use File::lockf;
open F, "<foo" or die "Unable to open foo\n";
my $err = File::lockf::lock(\*F);
print "Error = $err\n";
which prints
Error = 9.
Thanks in advance for any help. Would also appreciate direct e-mail because
this newsgroup grows so fast and if I don't check for a couple of days I
lose the messages off our server.
--
Farhad
------------------------------
Date: 19 Oct 1998 18:23:51 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Apache-User
Message-Id: <70g03n$h4n$1@news.NERO.NET>
In article <70fp88$7go$1@black.news.nacamar.net>,
Christian Koch <christian.koch@fuzzy-online.de> wrote:
>I want to creat an User for my Apache Web-Server with a Perl-Script. There
>is a tool htpasswd to do it.
>My problem is, that I can't write the user and password in the command line.
>The tools nedds the password in a special input line. What con I do, that
>the Perl-Script can insert the password in this input line.
Interestingly enough, the tool to manage the dbm files of users
(dbmmanage) is a perl script. If you peruse the source, you will see
that there is an "add" command which allows adding users with specified
pre-crypted passwords. If this isn't handy enough, it is trivial to add
a new command that crypts the password you provide on the command line
before adding it.
------------------------------
Date: Mon, 19 Oct 1998 15:43:23 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Assigning to $!
Message-Id: <362B965B.68CB44E9@min.net>
Michal Rutka wrote:
>
> John Porter <jdporter@min.net> writes:
> > @output_from_bar = `bar.pl`;
> >
> > And in bar.pl, dup STDERR onto STDOUT.
> > Or you might prefer to have a shell do that for you.
>
> Or how about:
> do 'bar.pl';
> and test $@ instead?
Because that doesn't capture whatever bar.pl writes to stdout and
stderr, which is what the guy said he needed to capture.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 18:47:08 GMT
From: j@w.com (Register Agent for $29US)
Subject: Atlanta PERL Programmers Needed !!!!!!!
Message-Id: <362b8828.21775587@news.mindspring.com>
Digital Glue Inc. is seeking several PERL programmers located in the
Atlanta area. Experience with CGI and web-based database connectivity
is essential. You will be working off-site on an hourly-subcontractor
arrangement. Please reply with resume and work samples if possible to
jeff@digitalglue.com
You may see our work at www.digitalglue.com
------------------------------
Date: Mon, 19 Oct 1998 11:26:01 -0700
From: "Phinneas G. Stone" <phinneas@eskimo.com>
Subject: chmod() ???
Message-Id: <362B8439.B4E0CE89@eskimo.com>
I'm having a hard time getting chmod to work. I'm using a subroutine to
create a hard-coded html file using data from a database. The routine is
in a library file and is called from the main program in a higher
directory. The new file is created fine, but its permissions are
defaulted to -rw-------. When I use the chmod function, nothing happens.
My server is a local isp (not the same as my email) so I have don't have
access to server configurations. I'm not sure where the error logs are
kept and their customer service people have been anything but helpful.
Here is a sample of the code I'm having the problem with:
sub codeit {
$file = "/usr/home/dds/public_html/gear/$fields[4].html";
open (FILE, "> $file") || die "Can't open file: $!\n";
print FILE "<html>\n<head>\n<title>$title</title>\n</head>\n";
print FILE "[lots of html] ... ";
print FILE "\n</body>\n</html>";
close (FILE);
$cnt = chmod 0755, '$file';
print "<h3>Sucessfully created page: $fields[4].html</h3>\n" if
(-e$file);
print "$cnt files chmod-ed\n"; #for debugging
}
When I call the subroutine (assume $fields[4] = "itemname") the response
is:
Sucessfully created page: itemname.html
0 files chmod-ed
The new file is written fine and is in the directory where it should be,
but it still has the -rw------- permissions. Any help would be greatly
appreciated.
Phinneas
------------------------------
Date: Mon, 19 Oct 1998 11:48:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: chmod() ???
Message-Id: <MPG.109529565f805a5a9898c7@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <362B8439.B4E0CE89@eskimo.com> on Mon, 19 Oct 1998 11:26:01 -
0700, Phinneas G. Stone <phinneas@eskimo.com> says...
...
> $cnt = chmod 0755, '$file';
Those single-quotes are preventing the substitution of the name, so you
are trying to chmod a file named $file, which probably doesn't exist.
Try:
$cnt = chmod 0755, $file or die "Couldn't chmod $file. $!\n";
It's a good idea to check *all* system calls, just as you did for
'open'. Especially when you think that's where your trouble is :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Oct 1998 14:04:29 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: chmod() ???
Message-Id: <362B8D3D.918FA2F8@houston.Geco-Prakla.slb.com>
Phinneas G. Stone wrote:
>
<snip>
> $cnt = chmod 0755, '$file';
<snip>
Well, one thing that jumps out at me is that you are trying to have perl
interpolate a variable, but have put it in quotes such that it will not
be interpolated.
$cnt = chmod 0755, "$file";
should help. It may not be the only problem, but I'm fairly confident
that it is one.
Cheers,
Dave
--
Dave Barnett Software Support Engineer (281) 596-1434
If you're born again, do you have two belly-buttons?
------------------------------
Date: Mon, 19 Oct 1998 18:20:20 GMT
From: droby@copyright.com
Subject: Re: CPAN and Netscape 4.5/Linux
Message-Id: <70fvt3$nu4$1@nnrp1.dejanews.com>
In article <slrn72jjdo.99t.PerSteinar.Iversen@elbonia.p52.hioslo.no>,
PerSteinar.Iversen@adm.hioslo.no wrote:
> Does anybody else have this problem with CPAN and
> Netscape 4.5/Linux? The HTML pages that CPAN
> keeps on ftp-servers are displayed as text,
> not as HMTL, not very useful. This applies to
> the Linux version of Netscape 4.5, the Windows
> version does this OK.
>
> For example, this page is displayed as text
> in my Linux netscape:
>
> ftp://sunsite.uio.no/pub/languages/perl/CPAN/README.html
>
> Any ideas how to fix this?
>
> -psi
>
Perhaps you should contact Netscape technical support. This does not seem to
be a Perl problem.
As far as I can tell, it's also not a CPAN problem, or a Netscape 4.5
problem, as the page you cite above works fine for me using RedHat 5.0 Linux
(2.0.32) and Netscape 4.5.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Oct 1998 14:47:01 -0400
From: Paul White <whitepr@scp1.bellcore.com>
Subject: Easy Fix ... Re: Resubmitted ... Removing spaces between fields in file records
Message-Id: <362B8925.53BD@scp1.bellcore.com>
Here the trick is in the FORMAT statement,
where spaces " " cannot exist between format
fields otherwise spaces are inserted between
data fields in records.
pw
Paul White wrote:
>
> Paul White wrote:
> >
> > I am trying to write a record to a file
> > that is a series of data fields separated
> > by commas.
> >
> > Unfortunately, spaces " " are inserted into
> > every record that I write.
> >
> > Here is the code:
> >
> > format DATAREC
> > @<<<< @<<<< @<<<<<<<<<
> > $rec_a, $rec_b, $rec_c
> > .
> > open (DATAREC,">output.dat");
> > for (i=0;i=5:i++){
> > $rec_a = "aaaaa" . ",";
> > $rec_b = "bbbbb" . ",";
> > $rec_c = $rec_a . $rec_b;
> > write DATAREC;
> > }
> > close (DATAREC);
> >
> > Here is the output, which I don't want:
> > aaaaa, bbbbb, aaaaabbbbb
> > aaaaa, bbbbb, aaaaabbbbb
> > aaaaa, bbbbb, aaaaabbbbb
> > aaaaa, bbbbb, aaaaabbbbb
> > aaaaa, bbbbb, aaaaabbbbb
> > aaaaa, bbbbb, aaaaabbbbb
> >
> > Here is what I want as an output:
> > aaaaa,bbbbb,aaaaabbbbb
> > aaaaa,bbbbb,aaaaabbbbb
> > aaaaa,bbbbb,aaaaabbbbb
> > aaaaa,bbbbb,aaaaabbbbb
> > aaaaa,bbbbb,aaaaabbbbb
> >
> > All comments, suggestions ... welcomed.
> >
> > Paul
------------------------------
Date: Mon, 19 Oct 1998 18:57:47 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Glob Prob
Message-Id: <ebohlmanF138oB.3z2@netcom.com>
Martin <minich@globalnet.co.uk> wrote:
: I have the following:
: @threads = <*.*>;
: which won't include in the array files with no extension. Is there anyway to
: modify the glob to let it do that?
What OS is your script running under? Under Unix, that glob means "all
files with a '.' in their names," since "extensions" have no inherent
meaning to the filesystem. Just a plain "*" will do (but of course, that
will only match extensionless files under Win32. If you need to be
platform-independent, you should ditch globbing and use readdir() and its
cousins).
------------------------------
Date: Mon, 19 Oct 1998 11:05:39 -0700
From: Meenu <meenu@ms.washington.edu>
Subject: grep in perl
Message-Id: <Pine.OSF.4.02A.9810191058050.30723-100000@hilbert1.ms.washington.edu>
Hi, This question is bit complicated using grep with in perl script.
I wrote a perl script to get the yesterday's date & time, based on current
local time.
$currtime = time ();
$yesterS = $currtime - 24 * 60 * 60 ;
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime($yesterS);
if ($mon = 9)
{
$month = Oct;
}
so on ... for all the months.
and then what I'm tryin' to day is ..grep "month/day" from some accesslog
file
grep "$month/$day" accesslog > Prev_DayLOG;
However this command is giving me an error. Can anyone help me out with
this one. I'm not even sure if grep should be able to get the data from
accessfile using this command. or are there any other ways to extract
the data from access_log. I need to automate this script so that it
updates the Prev_dayLog ..everyday.
Please help me out with this one.
Thanks
Meenu
------------------------------
Date: Mon, 19 Oct 1998 14:56:34 -0400
From: Langden Aulger <ruprechta@hotmail.com>
Subject: HELP! Error w/ Config.pm : tie %%Config, Config;
Message-Id: <362B8B62.8DEC7017@hotmail.com>
Greetings,
I can't seem to eye any syntax problems w/ Config.pm (for Perl 5.003).
I think I am doing something obviously wrong; these errors mysteriously
disappeared
after I installed and took the '^M's out of CGI.pm. They reappeared
after I re-installed
them to another directory.
I don't know what happened in the first place which worked.
There were no errors in my script, which is calling CGI.pm (which BEGINs
Config.pm).
HELP!
-RA.
------
------------------------------
Date: 19 Oct 1998 18:01:36 GMT
From: "JaTara Brown" <jatara_brown@hp.com>
Subject: how do you search subdirectories for a file?
Message-Id: <01bdfb87$858b5660$417f450f@vcsjatarab1.vcd.hp.com>
Hi!
My project involves programming in Perl and is actually quite simple: write
a script that searches through a directory (INCLUDING subdirectories), find
files with certain extensions (say .abc and .xyz), and creates separate
files that contain a list of those files with certain extensions (abcfiles
and xyzfiles). Simple, right? Not for me. I wanted my script to read in
all files located in that directory including those in subdirectories. For
some reason I am unable to do that. I've tried:
opendir (DIR, "."); <-- this worked only for top level
(subdirectories ignored)
opendir (DIR, "/unix/jatarab/"); <-- same thing
opendir (DIR, "/unix/jatarab/*"); <-- does NOT work
opendir (DIR, glob("/unix/jatarab/*")) <-- doesn't work either
I have consulted numerous FAQs, tutorials, and Perl gurus trying to find a
solution to this. One said that "opendir" was non-recursive and wasn't
capable of doing what I wanted it to do. If that's the case, are there any
alternatives I can try? Thanks!
JaTara Brown
------------------------------
Date: Mon, 19 Oct 1998 18:27:25 GMT
From: mcafee@seawolf.rs.itd.umich.edu (Sean McAfee)
Subject: Re: how do you search subdirectories for a file?
Message-Id: <hwLW1.2598$fS.7921411@news.itd.umich.edu>
In article <01bdfb87$858b5660$417f450f@vcsjatarab1.vcd.hp.com>,
JaTara Brown <jatara_brown@hp.com> wrote:
>My project involves programming in Perl and is actually quite simple: write
>a script that searches through a directory (INCLUDING subdirectories), find
>files with certain extensions (say .abc and .xyz), and creates separate
>files that contain a list of those files with certain extensions (abcfiles
>and xyzfiles). Simple, right? Not for me. I wanted my script to read in
>all files located in that directory including those in subdirectories. For
>some reason I am unable to do that. I've tried:
[snip]
>I have consulted numerous FAQs, tutorials, and Perl gurus trying to find a
>solution to this. One said that "opendir" was non-recursive and wasn't
>capable of doing what I wanted it to do. If that's the case, are there any
>alternatives I can try? Thanks!
It's hard to believe that multiple Perl gurus hadn't heard of File::Find,
which is designed exactly for what you want to do. It's part of the
standard Perl distribution, so do "perldoc File::Find" to learn about it.
Here's a script to get you started. (It's got a flaw or two which I leave
it as an exercise for the reader to fix.)
use File::Find;
find sub { /\.([^.]+)$/ && push @{$extension{$1}}, $File::Find::name },
'/unix/jatarab';
$, = $\ = "\n";
while (($extension, $files) = each %extension) {
open FILE, ">${extension}files"
or die "Can't open ${extension}files: $!\n";
print FILE @$files;
close FILE;
}
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Mon, 19 Oct 1998 18:53:10 GMT
From: olrcc@scisun.sci.ccny.cuny.edu
Subject: Installing modules on Win'95
Message-Id: <70g1qm$rbf$1@nnrp1.dejanews.com>
Hi everybody,
I'm having a problem with installing Perl Modules on Windows 95.
I've got ActiveState Perl 5.005002 built and Cygwin port of make
(latest release).
Doing the standard routine
1. perl Makefile.PL <-- fine
2. make <-- produces an error
Makefile:644: *** missing separator
The offending string and next two lines look like this
$(PM_TO_BLIB)
<<
@$(TOUCH) $@
I tried to install different modules to no avail. BTW, this particular one
is Math-MatrixReal-1.2.
Any suggestions,
Thanks in advance
Oleg,
learning Perl
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Oct 1998 14:54:34 -0400
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: lack of flock() for Win95/98? fix?
Message-Id: <MPG.109554f3c8f139c798968c@news.supernews.com>
Does flock work on WinNT? For some reason I have always been under the
impression that it didn't work at all? I'm I confusing that with fork?
hmm...
In article <70frjp$j7v$1@camel29.mindspring.com>, Allan@due.net says...
>
> Jan VanderStoel wrote in message <362982ed.0@blushng.jps.net>...
> >I attempted to run a Perl script using the flock() function on a Win 98
> >platform using Perl 5.005. The script failed giving an error message
> saying
> >that the flock() function is not implemented on this platform. The docs do
> >not indicate that flock() is not implemented. This script does work on Win
> >NT 4. Is there a fix for the Win 95/98 platform?
>
>
> Linux, FreeBSD? <g>
>
> AmD
>
>
>
------------------------------
Date: Mon, 19 Oct 1998 19:01:32 GMT
From: A.Kuester@ostalb.netsurf.de (Axel Kuester)
Subject: missing file while "make"ing modules
Message-Id: <362b8bbd.10155783@news.dicon.de>
Hello,
I4ve got a strange message while trying to build a few modules for
>Perl/VMS i've got from CPAN. The same (ore very similar ) message
occures with all the Modlules.
The file stadef.h, which is to be included can not be found on the
whole system.
So, what to do??
Thanks for tips,
Axel
perl makefile.pl ---> all ok
mmk --> the following message occures:
$ perl makefile.pl
Checking if your kit is complete...
Looks good
Writing Descrip.MMS for VMS::Process
$ mmk
perl "-Iperl_root:[lib]" "-MExtUtils::Install" -e "pm_to_blib({split('
',<STDIN>
)},'[.blib.lib.auto]')" <.MM_tmp
cp show_sys_clone.pl [.blib.lib.VMS]show_sys_clone.pl
cp process.pm [.blib.lib.VMS]process.pm
perl "-Iperl_root:[lib.VMS_AXP.5_00502]" "-Iperl_root:[lib]" -e "use
ExtUtils::M
ksymlists;" -e "Mksymlists('NAME' => 'VMS::Process', 'DL_FUNCS' =>
{ }, 'DL
_VARS' => [])"
perl -e "print
""[.blib.arch.auto.VMS.Process]Process.olb/Include=Process\n[.bli
b.arch.auto.VMS.Process]Process.olb/Library\n"";" >>PROCESS.OPT
perl -e "print qq{PerlShr/Share\n}" >>PROCESS.OPT
Copy/NoConfirm PROCESS.OPT [.BLIB.ARCH.AUTO.VMS.PROCESS]PROCESS.OPT
perl "-Iperl_root:[lib.VMS_AXP.5_00502]" "-Iperl_root:[lib]"
perl_root:[lib.ExtU
tils]xsubpp -typemap perl_root:[lib.ExtUtils]typemap PROCESS.xs
>PROCESS.c
Warning: long symbol VMS__Process_process_list_names
trimmed to VMS_Proces_proces_list_names
at perl_root:[lib.extutils]xsubpp line 943
Warning: long symbol VMS__Process_get_one_proc_info_item
trimmed to VMS_Pc_g_o_pc_io_item
at perl_root:[lib.extutils]xsubpp line 943
Warning: long symbol VMS__Process_get_all_proc_info_items
trimmed to VMS_Pc_g_al_pc_io_items
at perl_root:[lib.extutils]xsubpp line 943
Warning: long symbol VMS__Process_decode_proc_info_bitmap
trimmed to VMS_Pc_do_pc_io_bitmap
at perl_root:[lib.extutils]xsubpp line 943
Please specify prototyping behavior for process.xs (see perlxs manual)
CC/DECC
/Include=[]/Standard=Relaxed_ANSI/Prefix=All/Obj=.obj/NoList/Define=("VE
RSION=""1.04""","XS_VERSION=""1.04""")/Include=(perl_root:[lib.VMS_AXP.5_00502.C
ORE])/Optimize PROCESS.c
#include <statedef.h>
.^
%CC-F-NOINCLFILE, Cannot find file <statedef.h> specified in #include
directive.
at line number 28 in file PERL_ROOT:[LIB.VMS.PROCESS]PROCESS.XS;1
%MMK-F-ERRUPD, error status %X10B91264 occurred when updating target
PROCESS.OBJ
$
The perl is build on a Alpha, using VMS 7.1
$ perl "-V"
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=VMS, osvers=V7.1, archname=VMS_AXP
uname='VMS alcar1 V7.1 AlphaStation 200 4/100'
hint=none, useposix=false, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='CC/DECC', optimize='undef', gccversion=undef
cppflags='undef'
ccflags
='/Include=[]/Standard=Relaxed_ANSI/Prefix=All/Obj=.obj/NoList'
stdchar='char', d_stdstdio=define, usevfork=true
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
alignbytes=8, usemymalloc=N, prototype=define
Linker and Libraries:
ld='Link', ldflags ='/NoTrace/NoMap'
libpth=/sys$share /sys$library
libs=
libc=(DECCRTL), so=exe, useshrplib=undef, libperl=undef
Dynamic Linking:
dlsrc=dl_vms.c, dlext=exe, d_dlsymun=undef, ccdlflags=''
cccdlflags='', lddlflags='/Share'
Characteristics of this PERLSHR image:
Compile-time options: DEBUGGING
Built under VMS
Compiled at Oct 19 1998 13:42:07
%ENV:
PERL_ROOT="DKA0:[SOFTWARE.PERL.]"
@INC:
perl_root:[lib.VMS_AXP.5_00502]
perl_root:[lib]
perl_root:[lib.site_perl.VMS_AXP]
perl_root:[lib.site_perl]
.
$
------------------------------
Date: Mon, 19 Oct 1998 15:57:11 -0400
From: John Porter <jdporter@min.net>
Subject: Re: New Module: File::Finder -- OO version of File::Find
Message-Id: <362B9997.12B7DD52@min.net>
Tom Christiansen wrote:
>
> Sounds like a good way to render this inaccessible to
> regular programmers.
O.k., all you regular programmers out there should ignore the
File::Finder module I posted recently, because it uses deeply techno-
magical "object-oriented programming", which is reserved for use
by "practitioners" of "methodologies" and other such ivory-tower
egg-heads. The inappropriateness of object-oriented programming for
real-world solutions by regular programmers like you is clearly
exemplified by the failure of strongly OO languages; don't even
THINK about learning Java or (God help us) Python.
> File::Find is perfectly simple. Why obfuscate it?
Global variables in the interface? Ugh.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 14:48:56 -0400 (EDT)
From: pietb@nic.mil (Piet Barber)
Subject: None
Message-Id: <Pine.SUN.4.02.9810191436190.12493-100000@ops.nic.mil>
> Date: Mon, 19 Oct 1998 18:28:49 +0200
> From: "Christian Koch" <christian.koch@fuzzy-online.de>
> Subject: Apache-User
> Message-Id: <70fp88$7go$1@black.news.nacamar.net>
> I want to creat an User for my Apache Web-Server with a Perl-Script.
> There is a tool htpasswd to do it. My problem is, that I can't write
> the user and password in the command line. The tools nedds the
> password in a special input line. What con I do, that the Perl-Script
> can insert the password in this input line.
Hmm. the htpasswd program that comes with Apache doesn't like to take
stuff from STDIN, for some reason. In the past, I have tried in vain to
get it to cooperate with all kinds of |'s and "-|"'s and OPENs and such.
What I eventually settled with was the htdigest command, you can send
pipes to it quite easily.
If you don't want to use the htdigest method (which basically uses DBM and
crypt and salt), you can make your own htpasswd file by smart use of crypt
and salt
Here's how a password is crypted: (perldoc -f crypt for more info)
=---------
$encrypted_pw = crypt ($dudes_password, salt());
# Now append the user's name and the crypt'ed password to the
# .htaccess file. (your job)
sub salt {
# subroutine to generate two (lowercase) random alpha-numeric
# characters. Including upper and lowercase is an exercise
# left to the reader's fun and enjoyment. (your job)
local ($salt);
$salt = pack('c' , 97+(int(rand(26)))) . pack('c' , 97+(int(rand(26)))) ;
$salt;
}
=---------
------------------------------
Date: 19 Oct 1998 14:01:11 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Passing by Reference for Performance Reasons?
Message-Id: <70fup7$lpi$1@monet.op.net>
In article <362ad9b8.1936484@dilbert.crrrwg.de>,
Joachim Zobel <jzobel@my-dejanews.com> wrote:
>Yes, but I copy them to my variables to have sensible names.
You might try this:
$a = 'W' x 1_000_000;
$b = join "-", 1 .. 1_000_000;
myfunc(\$a, \$b);
sub myfunc {
local *Many_W = shift;
local *Many_numbers = shift;
# Now do something with $Many_W
# and $Many_numbers
}
But the real answer is: Stop trying to micro-optimize everything
until (1) you know that the program is too slow for the intended use,
and (2) you have profiled to find out where the bottlenecks are.
------------------------------
Date: 19 Oct 1998 18:16:53 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Sockets, receiving data.
Message-Id: <908820822.624398@thrush.omix.com>
[posted & mailed]
djbelly@my-dejanews.com wrote:
: Is the connection opened or closed?
: (Something to do with my SOCKET "file" variable?)
: Is there data waiting to be received?
: (recv() and <SOCKET> statements lock and return no value if there is none.)
perldoc -f select
You want the four argument version.
See also "Unix Network Programming" by Richard Stevens.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 19 Oct 1998 17:50:04 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Perl Y2K copmliance
Message-Id: <70fu4c$l00$1@nnrp1.dejanews.com>
In article <70fdqa$hnh$1@newsreader2.core.theplanet.net>,
"Ron Hejdeman" <ron@hejdeman.freeserve.co.uk> wrote:
> Anyone out there know if perl is Y2K compliant on Suns and Win-95 ?
in perlfaq 4 - Data Manipulation :
Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Oct 1998 19:24:02 GMT
From: gdevittREMOVE@interport.net (Greg)
Subject: Q: Simple parsing of string
Message-Id: <362c9034.8713689@news.eclipse.net>
Admittedly a newbie to perl, I'm about to tear out what's left of my hair.
I'm trying to take a string and run it through two simple steps :
1) Change all + characters to spaces.
2) If the first 6 chars of the string <> "Posted" then (do something).
I can't, for the life of me, figure out the correct parsing and comparison
statements to do this.
And and all help will be *greatly* appreciated.
(Is there a good, simple, resource available to learn the syntax parsing
operators ? I've searched high and low, but can't find anything helpful.
I'm sure I'm overlooking something.)
TIA.
* Reply address modified to reduce spam.
------------------------------
Date: Mon, 19 Oct 1998 13:16:08 -0500
From: Eric Von Zee <evonzee@tritechnet.com>
Subject: Re: QUERY_STRING + code ???
Message-Id: <362B81E7.F644E512@tritechnet.com>
[courtesy copy mailed]
_cim_ wrote:
> I wrote a script that checks QUERY_STRING and then acts according to
> it. The script when run alone works 100%, but i want to use it inside
> html like this:
>
> <A HREF="http://www.a.com/cgi-bin/script?var1=10">
> <IMG SRC="http://www.a.com/cgi-bin/script?var2=20"></A>
>
> <snip bogus code>
What it looks like you are doing wrong is not giving the browser anything
it can use. When the browser sees your html code:
<A HREF="http://www.a.com/cgi-bin/script?var1=10">
<IMG SRC="http://www.a.com/cgi-bin/script?var2=20"></A>
will do the following: For the anchor (<a href...) it will provide a
link to the script, and, when the link is clicked, will expect the script
to provide an HTML page. Not a link. You may want to use the CGI.pm
redirect, or make your sub link return an html page.
When your browser sees the <IMG SRC= tag, it visits the script, expecting
image data. What it gets now is a line of text... which it doesn't know
what to do with. You probably want to open STDOUT in binmode, open an
image file in binmode, and dump the image to STDOUT. I'm sure there is a
module does this, but, not having used one, I don't know it's name.
Search CPAN (www.perl.com/CPAN).
Incidentally, this is not a Perl question. This is a browser/CGI-related
question. See comp.infosystems.www.* groups. Followups set.
HTH,
-Eric
--
Best Regards, | Psychotics are consistently
Tritech Marketing | inconsistent. The essence of
| sanity is to be inconsistently
Eric Von Zee | inconsistent.
Webmaster | -- Larry Wall
------------------------------
Date: Mon, 19 Oct 1998 18:46:10 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: QUERY_STRING ????
Message-Id: <70g1di$qlt$1@nnrp1.dejanews.com>
In article <362b7637.44202388@news.online.ee>,
cim@online.ee (_cim_) wrote:
> I wrote a script that checks QUERY_STRING and then acts according to
> it. The script when run alone works 100%, but i want to use it inside
> html like this:
>
> <A HREF="http://www.a.com/cgi-bin/script?var1">
> <IMG SRC="http://www.a.com/cgi-bin/script?var2"></A>
>
> but it doesn't work. What am i doing wrong?
name=value for a GET eg:
<A HREF="http://www.a.com/cgi-bin/script?foo=var1">
<A HREF="http://www.a.com/cgi-bin/script?bar=var2">
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Oct 1998 12:23:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: QUERY_STRING ????
Message-Id: <MPG.109531795f94d889898c8@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <70g1di$qlt$1@nnrp1.dejanews.com> on Mon, 19 Oct 1998
18:46:10 GMT, Patrick Timmins <ptimmins@netserv.unmc.edu> says...
> In article <362b7637.44202388@news.online.ee>,
> cim@online.ee (_cim_) wrote:
> > I wrote a script that checks QUERY_STRING and then acts according to
> > it. The script when run alone works 100%, but i want to use it inside
> > html like this:
> >
> > <A HREF="http://www.a.com/cgi-bin/script?var1">
> > <IMG SRC="http://www.a.com/cgi-bin/script?var2"></A>
> >
> > but it doesn't work. What am i doing wrong?
>
> name=value for a GET eg:
>
> <A HREF="http://www.a.com/cgi-bin/script?foo=var1">
> <A HREF="http://www.a.com/cgi-bin/script?bar=var2">
This thread is off-topic, but we might as well get it right for the
record.
'name=value' is only a convention for a GET. Whatever follows the '?'
is placed by the server into $ENV{QUERY_STRING}, which the CGI program
can parse any way it wants. And it was parsing it correctly, but then
sending the wrong thing back to the browser.
The real problem was based on misunderstanding of the server-client
interaction, which is *really* off-topic.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 19 Oct 1998 14:21:59 -0500
From: rhaig@news.hackboy.com
Subject: regexp question
Message-Id: <70g3gn$ucq$1@cartman.hackboy.com>
ok... someone is going to make me feel silly, but that's what newsgroups
are for right?
here's the situation:
I have 2 variables $oldid and $newid
I have a string that is of the pattern: user.$oldid[.something]
I need to substitute $oldid with $newid, and I have to make sure don't
get an accidental match
(i.e. $oldid="tom", s/\.$oldid/\.$newid, would match ".tompson" as well)
I've tried
s/\.${oldid}[$\.]/\.$newid/;
but that doesn't match because of $\
I've tried
s/\.${oldid}[$ \.]/\.$newid/;
that doesn't work either (neither of these codelets match with the end of line
case)
I've tried
s/\.${oldid}[\.$]/\.$newid/;
but that doesn't match because of $]
and yes, in my real code, I'll be creating a backreference and not
clobbering the \. if I find it.
I know I could do this with
s/\.${oldid}$/\.$newid/;
s/\.${oldid}\./\.$newid/;
(and that's what I'm doing for now) but now it's the principal of the matter.
thanks in advance for loaning me a clueon.
--
Rob
------------------------------
Date: Mon, 19 Oct 1998 12:42:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regexp question
Message-Id: <MPG.1095360a48a1d6299898c9@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <70g3gn$ucq$1@cartman.hackboy.com> on 19 Oct 1998 14:21:59 -
0500, rhaig@news.hackboy.com <rhaig@news.hackboy.com> says...
> ok... someone is going to make me feel silly, but that's what newsgroups
> are for right?
Most of us think they are for learning.
> here's the situation:
>
> I have 2 variables $oldid and $newid
>
> I have a string that is of the pattern: user.$oldid[.something]
>
> I need to substitute $oldid with $newid, and I have to make sure don't
> get an accidental match
> (i.e. $oldid="tom", s/\.$oldid/\.$newid, would match ".tompson" as well)
>
> I've tried
> s/\.${oldid}[$\.]/\.$newid/;
> but that doesn't match because of $\
...
> I know I could do this with
> s/\.${oldid}$/\.$newid/;
> s/\.${oldid}\./\.$newid/;
> (and that's what I'm doing for now) but now it's the principal of the matter.
No, it's the principle.
You could do the single match on 'dot or end-of-string' as (\.|$). But
I think what you really want is the word-break assertion '\b', which you
will find in perlre.
> thanks in advance for loaning me a clueon.
I know about pions and muons and gluons and prions and protons and
neutrons and deuterons and hadrons and leptons, but not about clueons.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Oct 1998 20:55:35 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: regexp question
Message-Id: <362ba6bd.989748@news.ping.be>
rhaig@news.hackboy.com wrote:
>I have 2 variables $oldid and $newid
>
>I have a string that is of the pattern: user.$oldid[.something]
>
>I need to substitute $oldid with $newid, and I have to make sure don't
>get an accidental match
>(i.e. $oldid="tom", s/\.$oldid/\.$newid, would match ".tompson" as well)
It sounds like you want to use "\b", to match only complete words:
s/\b$oldid\b/$newid/;
This will replace tom, but will leave tompson and atom alone.
Bart.
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4010
**************************************