[10794] in Perl-Users-Digest
Perl-Users Digest, Issue: 4395 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 10 06:09:00 1998
Date: Thu, 10 Dec 98 03:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Dec 1998 Volume: 8 Number: 4395
Today's topics:
Re: Access a database on a other server (Victor B Wagner)
Re: ascii fixed file: revision help (Andre L.)
Re: Assignment to same variable (Larry Rosler)
Re: Assignment to same variable <uri@sysarch.com>
Re: Better way to get values from a list? ptimmins@netserv.unmc.edu
Re: Can someone tell me why .... (Ronald J Kimball)
Creating super-simple DBM files (Rev. Waldo of Flatbush)
Re: Decent Editor ptimmins@netserv.unmc.edu
Re: extracting& sorting from ascii file <newsposter@cthulhu.demon.nl>
Re: Hash from Two Array? <sisl@ihug.co.nz>
Header not printing (second time) in format <achoy@us.oracle.com>
Re: help, have to figure perl out in 4 days!! <etienne@anonimo.isr.ist.utl.pt>
How to effectively match _many_ regular expressions at <maa@zurich.ibm.com>
Re: How to read a binary file in Perl? How to install m (Ronald J Kimball)
IS there a difference really? $var and ${var}? Example. <rich_guy@hotmail.com>
Re: Need help on comparing a file to itself by array in <ebohlman@netcom.com>
new PDF-PL library/discussion site? <sean@cbcu.cam.ac.uk>
opening /dev/sequencer <etienne@anonimo.isr.ist.utl.pt>
Re: PELRSHOP - not recognising SSI (Tad McClellan)
perl attachement x-beliebige datei simc@gmx.net
Re: reading comma delimited data files <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Regular Expression help (Ronald J Kimball)
Re: Regular Expression help (Ilya Zakharevich)
Trouble getting started with DBM (Bart Lateur)
Re: win32 messages <e.christensen@nertjob.dk>
writing to /dev/sequencer <etienne@anonimo.isr.ist.utl.pt>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Dec 1998 10:01:38 GMT
From: vitus@brass.fe.msk.ru (Victor B Wagner)
Subject: Re: Access a database on a other server
Message-Id: <74o662$chg$1@zware.space.ru>
Marco Vlemmings (marcov@ctrl-v.nl) wrote:
: Hi all
: I have a question.
: I want to make a perl script which will work on a webserver.This script
: will access a database,but the database is on an other server.How can i
: retrieve data from the database server to my webserver?
What is your problem?
Your database have no network-transparent library or your web-server
platform have no client libraries for your database?
In both cases you can run perl script dbiproxy on database host and
use DBD::Proxy to connect from Web server.
: Can anybody help me.
: With kind regards
: Marco Vlemmings
: email:marcov@ctrl-v.nl or vlemm@iaehv.nl
--
--------------------------------------------------
Victor Wagner vitus@ice.ru
Programmer Office:7-(095)-964-0380
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus
------------------------------
Date: Thu, 10 Dec 1998 00:01:41 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: ascii fixed file: revision help
Message-Id: <alecler-1012980001410001@dialup-649.hip.cam.org>
Re: fixed ascii file:merging,extracting,sorting
Re: extracting, merging, excluding from ascii file
Re: ascii file:extracting,sorting merging
Re: ascii fixed file: revision help
Please don't post the same thing four times under four different subject
lines. It's rather rude. >:-(
Andre
------------------------------
Date: Wed, 9 Dec 1998 21:27:20 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Assignment to same variable
Message-Id: <MPG.10d8fb9461fa0260989949@nntp.hpl.hp.com>
In article <74nfks$j8g$1@monet.op.net> on 9 Dec 1998 22:37:00 -0500,
Mark-Jason Dominus <mjd@op.net> says...
> In article <39emq9rp4o.fsf@ibnets.com>, Uri Guttman <uri@ibnets.com> wrote:
> >>>>>> "NT" == Niral Trivedi <niral@corporate.planet.net> writes:
> >in fact, join( $string, $value ) is a silly thing to write. maybe it
> >should be warned under -w.
>
> That would suck. I write
>
> join(':', @fields);
>
> all the time, and I don't want it issuing some bogus warning every
> time @fields happens to have only a single element.
Sure. But Uri meant
join SCALAR, SCALAR
which *is* silly, but hardly worth the trouble to special-case for a
warning, IMHO.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 10 Dec 1998 00:43:36 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Assignment to same variable
Message-Id: <x7g1aov9fb.fsf@sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Mark-Jason Dominus <mjd@op.net> says...
>> In article <39emq9rp4o.fsf@ibnets.com>, Uri Guttman <uri@ibnets.com> wrote:
>>
>> join(':', @fields);
>> all the time, and I don't want it issuing some bogus warning every
>> time @fields happens to have only a single element.
LR> Sure. But Uri meant
LR> join SCALAR, SCALAR
LR> which *is* silly, but hardly worth the trouble to special-case for a
LR> warning, IMHO.
what he said!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Thu, 10 Dec 1998 04:56:45 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: Better way to get values from a list?
Message-Id: <74nkad$grg$1@nnrp1.dejanews.com>
In article <366EB3EA.47846C10@hp.com>,
karl_jensen@hp.com wrote:
> Thanks to all for the help. You folks are great! I kept the "foreach"
> alternative because it's easier to read than the "map" alternative. I
> was thinking there might be some terse way to split the one array into
> two. It's good to know that the iteration is necessary.
>
> I can't use a hash in this situation. I want to preserve the list order.
You can use a hash and still preserve order, and that way link the
various "a=b" pairs together. In the example below, The @line_order array
maintains the order in which the various @AB arrays are fed into the system.
The @{ $value_order{$name} } array then holds the particular order of
key value pairs for each of these @AB arrays:
use strict "refs";
# load the data into a Hash of Hashes
while (<DATA>) {
@AB = split /\s+/;
my $name = shift @AB; # grab the first element
push @line_order, $name; # maintain the order fed in
foreach (@AB) {
my ($label, $field) = split('=');
$hsh{$name}{$label} = $field; # create our hash of hashes
push @{ $value_order{$name} }, $label; # maintain the "a=b" order
}
}
# the data structure is built ... now to print it (in order, of course :)
foreach $line (@line_order) {
foreach (@{ $value_order{$line} }) {
print "key of $_ and value of $hsh{$line}{$_}\n";
}
}
__DATA__
first a=one b=two c=three d=four
second e=five f=six g=seven h=eight
third i=nine j=ten k=eleven l=twelve
fourth m=thirteen n=fourteen o=fifteen p=sixteen
For this example, I'm assuming that the first element of each @AB array
(which gets shifted to $name) is unique. If this were not the case,
you could still use the basic structure above, just shift out the first
value (and discard) and use a counter to create a new $name for each line.
In this example, you would replace
my $name = shift @AB;
with
shift @AB; $name++;
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 10 Dec 1998 01:04:03 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Can someone tell me why ....
Message-Id: <1djspsl.16dx6yvyjzc1sN@bay1-56.quincy.ziplink.net>
Owen <info@kn1.com> wrote:
> I did not write the script. It is Freeware from the CGI resource.
>
> That said, I posted here hoping to get some help and maybe learn something
> form you guys.
>
> I wish I had not bothered.
>
> Arrogance is here in abundance.
You didn't even write the script, and yet you're offended by our
criticism and dismissive of our help? What exactly is your problem?
Maybe we should pay you for the privilege of rewriting this script for
you?
By the way, my cat just walked across my keyboard and created this Perl
script that doesn't quite work... Could you debug it for me?
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 10 Dec 1998 07:37:23 GMT
From: x2quest@yahoo.com (Rev. Waldo of Flatbush)
Subject: Creating super-simple DBM files
Message-Id: <74ntnj$o0q$1@nnrp1.dejanews.com>
Hi, a newbie here, and what I want to do sounds easy enough to me but
apparently isn't.
I want to create a simple flat database with a numeric index, and all the
lookups will be based on that index, much like this:
Index Name Pet Car
1 Bob Cat Ford <--(The real list is a lot bigger
2 Chad Dog Lexus than this - 1500+ records)
3 Kim Bird Pontiac
4 Susan Cat Honda
etc.
What's the easiest way to create a DBM file based on this? If I had a list
like this in a comma- or tab-delimited text file, is there a fast way to
convert it?
Also I'd be grateful for any pointers to resources explaining DBM files in
better detail.
Thanks!
Chris O.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 10 Dec 1998 05:17:33 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: Decent Editor
Message-Id: <74nlhc$hpb$1@nnrp1.dejanews.com>
In article <74mjie$r2g$1@bcarh8ab.ca.nortel.com>,
"Antony McNulty" <tony_mc@hotmail.com> wrote:
> OK people calm down, let's not get worked up here....
>
> I'm on a Windows platform, have access to a UNIX platfom, but prefer to use
> Windows.
>
> I noticed many editors mentioned were UNIX, any ideas for the PC then ??
[snip]
I like vim, and it *does* run on PC's ... look at http://www.vim.org
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 10 Dec 1998 01:10:34 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: extracting& sorting from ascii file
Message-Id: <366F65D9.258DA8F7@cthulhu.demon.nl>
Alan Melton wrote:
> I have written a file that extracts data from a fixed length
> ascii file:
Any particular reason for posting this 4 times with a different
subject?
Erik
------------------------------
Date: Thu, 10 Dec 1998 22:25:44 +1300
From: Grant McLean <sisl@ihug.co.nz>
Subject: Re: Hash from Two Array?
Message-Id: <366F9398.1C405739@ihug.co.nz>
Thanks Sean and brian
Grant McLean wrote:
>
> If I have an array of keys, eg:
...
> and an array of values, eg:
...
> can anyone suggest clever/simple/efficient/fast ways of combining
> them into a hash
I compared a slightly modified version of my original code with your
suggestions:
use Benchmark;
my @Keys = qw(date time user file size);
my @Values = qw(19981131 0930 bob test.pl 1024);
my %Hash;
timethese(20000, {
'1. Brute Force' => sub { foreach (0..$#Keys) {
$Hash{$Keys[$_]} = $Values[$_];
}
},
'2. Map' => sub { %Hash = map {
$Keys[$_], $Values[$_]
} 0 .. $#Keys;
},
'3. Array Slice' => sub { @Hash{@Keys} = @Values; },
});
And got:
Benchmark: timing 20000 iterations of 1. Brute Force, 2. Map, 3. Array
Slice...
1. Brute Force: 9 wallclock secs ( 9.17 usr + 0.00 sys = 9.17 CPU)
2. Map: 21 wallclock secs (20.27 usr + 0.00 sys = 20.27 CPU)
3. Array Slice: 6 wallclock secs ( 5.50 usr + 0.00 sys = 5.50 CPU)
A fairly clear winner there! On all the original criteria :-)
Thanks again.
Grant
------------------------------
Date: Wed, 09 Dec 1998 22:25:42 -0800
From: Allen Choy <achoy@us.oracle.com>
Subject: Header not printing (second time) in format
Message-Id: <366F6966.2B890B38@us.oracle.com>
Hi,
I have a subroutine which uses format to ouput to a file. The
subroutine
works fine the first time, but if I invoke it a second time, the header
will not
be displayed.
Anyone knows what could be wrong? I'm using 5.004
thanks in advance
--Allen
local $^;
local $~;
## Direct output to $outfile, else fall back to STDOUT
open(OUTPUT, ">$outfile") ||
warn "Unable to open($outfile): $!\n";
my $ofh = select(OUTPUT);
$^ = 'OUTPUT_TOP';
select($ofh);
format OUTPUT_TOP =
.
format OUTPUT =
.
...
write;
------------------------------
Date: 07 Dec 1998 15:38:33 +0000
From: Etienne Grossmann <etienne@anonimo.isr.ist.utl.pt>
Subject: Re: help, have to figure perl out in 4 days!!
Message-Id: <87hfv80xom.fsf@anonimo.isr.ist.utl.pt>
#!/usr/bin/perl -w
# ^^
# This option will give you some warnings. Very useful.
#
# > or atleast enough of the Perl language to make a program that takes a
# > scrambled word and compares it with a word list and prints them both.
#
# Takes one scrambled word? and then compares it with a word list?
#
# Ok what I understood is that you have a list of words, and that
# you want to find occurences of these words in the standard input.
#
# That's probably not what you meant, but whatever. The code works
# apparently correctly on Linux (perl5.005). You may have to change,
# some of it for win. For example, the first line.
#
# I hope this helps,
#
# Etienne
# List of words (see "man perlop" look for 'qw' operator)
@list = qw( find words for an os course which is given for win98 );
# See "man perlre". I'm making a "regular expression" from the list of
# words. This regexp will match any word in the list.
#
# '\b' matches word boundary
# '(' and then ')' means whatever matches will go into a variable $1
$regexp = '\b(' . join("|",@list) . ')\b' ;
# assume your scrambled words come from "tmp1.pl"
$file = "tmp1.pl" ;
open FILEHANDLE, "<$file" or die
"Sorry, can't open '$file' for reading\n" ;
while(<FILEHANDLE>){
# another form of 'while' loop. 'man perlvar' should tell you
# about "$.".
printf("found %10s on line $.\n",$1) while( /\G.*?$regexp/g ) ;
}
------------------------------
Date: Thu, 10 Dec 1998 11:10:16 +0100
From: Magnus Almgren <maa@zurich.ibm.com>
Subject: How to effectively match _many_ regular expressions at once?
Message-Id: <366F9E08.664296E4@zurich.ibm.com>
I am trying to match quite a few regexps at once, but I am receving an
error message from Perl. Can anyone tell me what I am doing wrong?
I need to match a string against several regexps in a program. The
regexps are not fixed at the start of the program but will be decided
during the run. If a user so desires, he can also choose to recompile a
new set of regexps during the run of the program.
I thought I had found a solution to my problem in perlfaq6, question:
"How do I efficiently match many regular expressions at once?"
Unfortunately, Perl gives me an error message when trying this option
with more than 100 regexps. At the end of this message, I have written a
small program demonstrating my problem. It does not do anything useful
except pointing out my problem.
When running the program with:
$numPatterns=100; (line 9)
I get the result:
bash$ example.pl
Number of patterns to try: 100
Match found!
When increasing the value of this variable with one:
$numPatterns=101; (line 9)
I get the result:
bash$ example.pl
Number of patterns to try: 101
Global symbol "regexp" requires explicit package name at (eval 1) line
1.
Use of uninitialized value at ././error.pl line 18.
Can't use string ("") as a subroutine ref while "strict refs" in use
at ././error.pl line 18.
If you remove strict and -w, you get other messages (obviously). What
concerns me the most is the first msg.
So, how do I match effectively against more regexps than 100? I can
create an array of an array, and letting each array I use to call
_bm_build() only contain 100 entries. Still, this seems like a cryptic
solution that I rather would avoid.
I would be very happy if anyone could point me to a document helping me,
or showing a nifty piece of code that solves everything ;)
As a parenthesis, I run perl5 (5.0 patchlevel 4 subversion 4) on aix.
(included perl program)
---------------------------------------------------------------------------------
#!/usr/bin/perl5 -w
use strict; # always good to use strict when building larger programs
use vars('$numPatterns', # Number of patterns to use
'@manyPatterns', # all patterns to match against
'$searchPatterns' # the returned sub ref
);
$numPatterns=100; #100 => ok, 101 => error
# read in patterns from a file, here I will only put together many
strings
@manyPatterns=split("\n","string\n" x$numPatterns);
print "Number of patterns to try: ".@manyPatterns."\n";
$searchPatterns=_bm_build('||',@manyPatterns); # build the pattern
matching sub
# input a string to match against
$_='test string';
print "Match found!\n" if (&$searchPatterns);
sub _bm_build {
# Taken from perlfaq6, inspired from a routine in Jeffrey Friedl's
book
my $condition = shift;
my @regexp = @_; # this MUST not be local(); need my()
my $expr = join $condition => map { "m/(\$regexp[$_])/o" }
(0..$#regexp);
my $match_func = eval "sub { $expr }";
die if $@; # propagate $@; this shouldn't happen!
return $match_func;
}
----------------------------------------------------------------------------------
--
Magnus Almgren
------------------------------
Date: Thu, 10 Dec 1998 01:04:11 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: How to read a binary file in Perl? How to install mod_perl?
Message-Id: <1djsq5t.12223s7cf2fxqN@bay1-56.quincy.ziplink.net>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> Perl can do practically anything (which is algorithmically possible).
> What you could do was to state your question unambitionally. I cannot
> make anything out of your question.
I can't make anything out of the word "unambitionally". What the heck
does that mean?
:-)
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 10 Dec 1998 00:42:56 -0800
From: Ryan <rich_guy@hotmail.com>
Subject: IS there a difference really? $var and ${var}? Example.
Message-Id: <366F8990.6365@hotmail.com>
Is there really a difference here, or much of?
For example..,
obviously $var won't work stated $vardgfdg, but it will as ${var}dgfdg
(in a printed string for example).
So, is there any other reason to use the ${var}, except when you can't
break up a string without bothering to do a concatenation? (not that i
matters), but for example, without whitespace or the end double quote
after the $var, etc.? And will anything else other then Alphanumeric
characters? As in is I say : print "hello $var, how are you?\n"; Or
print "Welcome to $var.... Have a nice time!\n";
More to the fact, to say:
print "<FORM METHOD=\"POST\" ACTION=\"${some_path}\">\n";
Or
print "<FORM METHOD=\"POST\" ACTION=\"$some_path\">\n";
??
Should I bother with the brace identifier in all areas of my script
such as this?? Or is it only to be really used rarely?
Another example:
open(FILE,"<file$var/somefile.dat") || &ErrorSub("Ack... can not open
file$var/somefile.dat", $!);
OR:
open(FILE,"<file${var}/somefile.dat") || &ErrorSub("Ack... can not open
file${var}/somefile.dat", $!);
It is always a good idea to use it? Or is it really a waste of time?
(other then when characters immediately follow it (well, aplha-numeric
one's anyway!)
And what about: print "this is [$rooms_names[$tmp]]"; would it be better
to say: print "this is [${rooms_names[$tmp]}]"; instead too? Or again,
is it only certain chars?
I have never seen this actually answered in any FAQ's or Perl books I
have (and they are many). Sorry for the unimportaint question, just a
curiosity. Is it really even worth bothering about?
Thanks. :-)
------------------------------
Date: Thu, 10 Dec 1998 04:18:54 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Need help on comparing a file to itself by array in PERL
Message-Id: <ebohlmanF3qEnJ.8zH@netcom.com>
cgi@higherlove.com wrote:
: Hi! I've got these two subroutines that just don't seem to want to
: work together and I can't fiugre out what I'm doing wrong.
: (The relevant subroutines are listed below my explanation)
: sub check {
:
: open(MAIN,"$file_dir/$write_file") || die $!;
: @main = <MAIN>;
: close(MAIN);
: open(MAIN,">$file_dir/$write_file") || die $!;
: foreach $main_line (@main) {
: if ($main_line =~ /<!--begin-->/) {
: print MAIN "<!--begin-->\n";
: }
Surely you want an "else" clause after this; your next line is going to
set $who to '<!--begin-->\n' and $where to undef. You probably aren't
running with -w enabled, since it would have told you about your use of
undefined values.
: ($who,$where) = split(/&&/,$main_line);
: if ($ENV{'REMOTE_HOST'} eq "$who" && $ENV{'HTTP_REFERER'} eq
: "$where"){
This test will succeed only if $ENV{'HTTP_REFERER'} has a trailing
newline, which it probably won't. You should have chomp()'d $main_line
at some point.
: print MAIN "Attempted login by $ENV{'REMOTE_HOST'}
from : $ENV{'HTTP_REFERER'}";
: print "Location:
: http://www.luvcircuit.com/time/test1.html\n\n"; #not recognized
: }
: else {
: print MAIN "$main_line";
: }
: close (MAIN);
OOPS! The above line is *inside* your foreach loop. You're closing the
output file after the first line, and subsequently trying to write to it.
: &post;
And so is the call to post(); you're calling it for each line in the input.
: }
: }
------------------------------
Date: Thu, 10 Dec 1998 10:13:59 +0000
From: Christoper Sean Hundtofte <sean@cbcu.cam.ac.uk>
Subject: new PDF-PL library/discussion site?
Message-Id: <366F9EE6.B5A15740@cbcu.cam.ac.uk>
I haven't found any web sites dedicated to PDF-PL apart from the
source one in Nottingham, so I was thinking this needs to be changed.
But do stop me if there is a site somewhere already handling script
contributions and Qs & As for PDF-PL.
And by the way, PDF-PL is a brilliant Perl library for handling PDF.
cheers,
Sean
------------------------------
Date: 07 Dec 1998 11:13:38 +0000
From: Etienne Grossmann <etienne@anonimo.isr.ist.utl.pt>
Subject: opening /dev/sequencer
Message-Id: <87iufo19y5.fsf@anonimo.isr.ist.utl.pt>
Hello, I have been trying to open /dev/sequencer for writing,
without success. I have tried such things as :
try1:
open(FD,">/dev/sequencer") or die "NOPE\n";
print FD "";
try2:
use IO::File;
$fh = new IO::File "/dev/sequencer", O_WRONLY;
print "NOPE\n" unless defined($fh);
try3:
use Fcntl;
sysopen(FD,"/dev/sequencer",O_WRONLY) ;
print FD "" ;
but none of them work. In C, I can do
fd = open("/dev/sequencer", O_WRONLY))
and then use the handle without problem.
Would anyone have an explanation to my troubles?
Etienne
------------------------------
Date: Wed, 9 Dec 1998 21:45:18 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: PELRSHOP - not recognising SSI
Message-Id: <e4gn47.3j8.ln@magna.metronet.com>
jira@my-dejanews.com wrote:
: I'm trying to set up SSI tags in my catalog pages for perlshop. However it
: seems perlshop doesn't seem recongise my SSI tags while processing the
: catalog pages for return to the browser. The SSI tag i am using is
: <!--#include file="filename.txt"--> the code i have isolated from perlshop
^^
^^
the regex below requires a space between those two characters.
: which is supposed to recognise the tag is below and set off the approruiate
: subroutine is below.
: if (
: /\<!\-\-\#(include|fsize|flastmod|config|echo|exec)\s+(file|virtual|errmsg|si
: zef mt|timefmt|var|cmd|cgi)\s*\=\s*\"(.*?)\" \-\-\>/i )
^
^ required space
That is pretty darn ugly.
Has ten unnecessary backslashes in it too.
I get worried using OPC (Other People's Code) when I see
that the programmer doesn't understand what needs escaping
and what doesn't.
Makes me wonder what other (perhaps more important) things
they don't understand...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 10 Dec 1998 09:43:11 GMT
From: simc@gmx.net
Subject: perl attachement x-beliebige datei
Message-Id: <74o53e$udl$1@nnrp1.dejanews.com>
hallo alle zusammen ...
zuerst: ich bin anfdnger in sachen perl, deshalb bitte ich euch mir beim
folgenden problem etwas zu helfen: ich brduchte 'ne lvsung mit der ich mit
einem perl-skript und sendmail 'ne x- beliebige datei versenden kann, ok ich
habe schon mal was von MIME:tools gehvrt, aber ich wei_ nicht wie ich das
einbinde und nicht wie ich das richtig ausn|tzen kvnnte.
kann mir jemand helfen??
danke
simc
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 10 Dec 1998 11:37:46 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: reading comma delimited data files
Message-Id: <831zm8705h.fsf@vcpc.univie.ac.at>
Re: reading comma delimited data files, Cybernetic
<cybear_x> said:
Cybernetic> I have a comma delimited text file that
Cybernetic> contains 3 columns of data which looks
Cybernetic> basically like this: name, date,
Cybernetic> number-value
perldoc DBD::CSV
or hand-rolled solution via
perldoc -f split
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Thu, 10 Dec 1998 01:04:18 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Regular Expression help
Message-Id: <1djsqdn.1k9hy1g1fo52otN@bay1-56.quincy.ziplink.net>
brian d foy <comdog@computerdog.com> wrote:
> "Gala Grant" <gala@sonic.net> posted:
>
> > Can anyone tell me why
> >
> > if ($line =~ /<a href="(.*)"?/i)
> >
> > isn't stopping at the first " it finds?
>
> because Perl regexen are greedy by default. you probably wanted
>
> /<a href="(.*?)"/
Actually, you might want the more efficient
/<a href="([^"]*)"/
Note that the original regex won't stop at any ", not even the last.
The closing quote is optional, so this regex will match from <a href="
to the end of the string (or the first newline).
In any case, this user should read up on regular expressions in the
perlre documentation.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 10 Dec 1998 06:42:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regular Expression help
Message-Id: <74nqha$609$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ronald J Kimball
<rjk@linguist.dartmouth.edu>],
who wrote in article <1djsqdn.1k9hy1g1fo52otN@bay1-56.quincy.ziplink.net>:
> > because Perl regexen are greedy by default. you probably wanted
> >
> > /<a href="(.*?)"/
>
> Actually, you might want the more efficient
>
> /<a href="([^"]*)"/
It is already several days today since the moment the first expression
is *much* quickier than the second one, as it should be (especially if
you through in //s).
Yet another victory of sanity over reason.
Ilya
------------------------------
Date: Thu, 10 Dec 1998 10:35:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Trouble getting started with DBM
Message-Id: <3671a349.11251551@news.skynet.be>
I haven't used DBM support in Perl so far. But I've come to a point
where it seems inavoidable, because the data is getting too big to be
kept in memory all at once. However, I'm having trouble getting even a
simple example to work.
#! perl
use SDBM_File;
tie %hash, 'SDBM_File', 'test.db', O_RDWR|O_CREAT, 0644;
print "Before:\n";
foreach $key (sort keys %hash) {
print " $key: $hash{$key}\n";
}
$hash{'one'} = 'un';
$hash{'two'} = 'deux';
$hash{'three'} = 'trois';
print "After:\n";
foreach $key (sort keys %hash) {
print " $key: $hash{$key}\n";
}
untie %hash;
Output:
Before:
After:
one: un
three: trois
two: deux
This code is *supposed* to create/reuse a SDBM file and permanently
store some data in it. I expected the data to appear under "Before:" as
well, the second time the script is run. However, the hash gets filled,
but the data is not saved: the DBM file is never created. What do I do
wrong?
Under -w, I get the following warning:
Argument "O_SVWST" isn't numeric in null at test.pl line 3.
Now where did that come from? I tried this line, with some remarkable
results. Somebody please explain.
print "O_RDWR|O_CREAT = ",O_RDWR|O_CREAT,"\n";
Result:
O_RDWR|O_CREAT = O_SVWST
BTW this is the DJGPP port for DOS. The OS/2 port doesn't even include
SDBM support (or even ANY DBM support)(?).
p.s. How am I supposed to use AnyDBM_File.pm? Do I need use
'AnyDBM_File' as the second parameter to tie?
Bart.
------------------------------
Date: Thu, 10 Dec 1998 09:24:33 +0100
From: Ernst Christensen <e.christensen@nertjob.dk>
Subject: Re: win32 messages
Message-Id: <366F8540.EC442E70@nertjob.dk>
Hi
You can use the Net::POP3 module.
Ernst
Navtej S Matharu wrote:
> Dear All,
>
> Can anyone tell me how to check for incoming SMTP messages through running a
> Perl script?? It has to run on Windows NT4.
>
> Thanks in advance.
>
> BIM
------------------------------
Date: 06 Dec 1998 20:23:56 +0000
From: Etienne Grossmann <etienne@anonimo.isr.ist.utl.pt>
Subject: writing to /dev/sequencer
Message-Id: <87lnkl10kj.fsf@anonimo.isr.ist.utl.pt>
Hello,
I would like to open "/dev/sequencer" , in perl. I have tried may
combinations of
open( FILEHANDLE , ">/dev/sequencer" ),
use Fcntl ; sysopen( FD, "/dev/sequencer", O_WRONLY )
use IO::File; $fh = new IO::File "/dev/sequencer", O_WRONLY;
without success. In C, doing fd = open( "/dev/sequencer", O_WRONLY)
works fine.
Cheers,
Etienne
------------------------------
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 4395
**************************************