[22224] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4445 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 22 03:05:50 2003

Date: Wed, 22 Jan 2003 00:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 22 Jan 2003     Volume: 10 Number: 4445

Today's topics:
    Re: ActivePerl 5.8 / MySQL / Apache Problem <randy@theoryx5.uwinnipeg.ca>
    Re: C++ for GUI and Perl for functionality? <bwalton@rochester.rr.com>
    Re: compare variable with next variable in a loop: now  (FMAS)
    Re: execute b.pl script from within a.pl script and b.p (Tad McClellan)
    Re: How are named unary operators that take $_ created? <nospam-abuse@ilyaz.org>
    Re: identifying web host platform? gofer@where-am-i.com
    Re: Newbie: How to remove some characters from a string <eighner@io.com>
        Perl 5.8.0 source on FreeBSD 4.7-STABLE <tjudd.01@hotmail.com>
        Please help decoding this perl code. (Jane Austine)
    Re: Problem in 'split' function (Vibhav Agarwal)
        Regex problem <darthludi@gmx.net>
    Re: Regex to find all words containing a single vowel? (Martin)
    Re: Regex: optional word boundary (Jay Tilton)
    Re: Regex: optional word boundary <amittai@amittai.com>
    Re: Regex: optional word boundary <spam@thecouch.homeip.net>
    Re: Regex: optional word boundary (Jay Tilton)
    Re: Send a file w/ CGI <remccart@uiuc.edu>
    Re: Send a file w/ CGI (Tad McClellan)
    Re: server and client on the same port (Markus Rachbauer)
    Re: split with pattern matching question (Paul Jensen)
    Re: Writing gaming "macro" programs <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 21 Jan 2003 21:49:41 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: ActivePerl 5.8 / MySQL / Apache Problem
Message-Id: <wxoX9.27744$7_.110729@news1.mts.net>

"Alex Banks" <alex@alexbanks.com> wrote in
    message news:3e2ddc00$0$241$cc9e4d1f@news.dial.pipex.com...
> "Lou Moran" <lou.moran@gellerandwind.com> wrote in message
> news:ah9r2v4r4eq2o3kf2g8okf69e141okgchl@4ax.com...
> > On Tue, 21 Jan 2003 12:04:29 -0000, "Alex Banks" <alex@alexbanks.com>
> > wrote:
> > >
> > >I used to run ActivePerl 5.6 with Apache on my Windows XP box just
fine -
> > >but since I installed ActivePerl 5.8 my old database scripts don't
work.
> > >They come back with this error:
> > >
> > >[Tue Jan 21 11:51:24 2003] [error] [client 192.168.1.15]
> > >install_driver(mysql) failed: Can't load
> > >'C:/Perl/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql:
> > >load_file:The specified module could not be found at
> > >C:/Perl/lib/DynaLoader.pm line 229.
> > >[Tue Jan 21 11:51:24 2003] [error] [client 192.168.1.15] Perhaps a
> > >required shared library or dll isn't installed where expected
> > SNIP
> > The big problem is that 5.8 and 5.6 are not binary compatible.  You
> > need to go get new modules.  One such module is DBD::mysql.

> Thanks Lou - sounds like that's it.

The DBD-mysql package from
   http://theoryx5.uwinnipeg.ca/ppms/
(which is what the ppm script is configured for in the
perl-5.8 distribution from our site) was compiled
with perl-5.8, so assuming this was the package that
was obtained, you should be OK in this regard.

best regards,
randy kobes





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

Date: Wed, 22 Jan 2003 03:43:12 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: C++ for GUI and Perl for functionality?
Message-Id: <3E2E1317.8010303@rochester.rr.com>

Andreas Schmidt wrote:

 ...


> I wanna program a cross-platform application with a fast, accurate GUI. It should look like a professional "standard" application, but use Perl behind the scenes.
 ...


> And are there installers that take care of the user's installation, e.g. installs the Perl interpreter automatically if necessary? Or can I compile everything just into executables?
 ...


> Andi
> 

Have you considered the Tk module?  It should do what you want.  It is 
possible, for example, to run Perl and Tk from CDROM without installing 
a thing on the user's computer (and to have the CDROM autorun).  Or copy 
the exact same directory hierarchy to a hard drive and have the whole 
thing work there, no installation (other than copying a folder and its 
contents) needed.  And a full uninstall occurs when the hierarchy is 
deleted.  Far better than most "professional standard applications".

-- 
Bob Walton



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

Date: 21 Jan 2003 23:16:05 -0800
From: massion@gmx.de (FMAS)
Subject: Re: compare variable with next variable in a loop: now it works
Message-Id: <f0b3f4c9.0301212316.7f2bf3f@posting.google.com>

Hi Tina,

now it works. I had to put the name of the file handle between the brakets 
While (<NAME>) {...

Thanks a lot for your efforts.

Francois

> > Tina proposal on German group:
> > -------------------------------
> > my $last="";
> > while (<>) {
> >  chomp;
> >  next if ($last && m/^${last}e?n?m?s?$/i);
> >  $last = $_;
> >  print "$_\n"
> > }
>  
> > Result:
> > Loop doesn't end + empty file
> 
> o'really...
> must be a bug in your perl version.
> for me it outputs:
> Abbau
> Abbild
> Abbildung
> abbindenden
> Abfüllvorgang
> Abgabe
> abgabestation
> abgebrochen
> abgebrochener
> 
> is that, what you want?
> 
> > Tina' proposed changes to Ingo (Closest result so far):
> > -------------------------------------------------------
> 
> you forgot to mention that i said that this solution has
> a problem,  e.h. with "product" and "production".
> 
> > chomp $wort;
> > grep { $_ eq substr($wort,0,length($_)) } @stammwort;
>  
> > Result list:
> > Abbau
> > abbauen
> 
> so if you say this is the closest so far, you want the
> result to be case-sensitive? you didn't
> tell that in your original post, did you?
> drop the /i from my version.
> 
> > As you see it is not as easy as it seems. I guess the problem is to
> > get 2 variables, one with the basic word which should occur first and
> > another with as many variation of the first variable.
> 
> soory, i don't get the problem. you just have to remember the
> word from the last loop iteration. if it matches the
> current word, keep it, if not, set it to the new word.
> and i still don't understand why you are getting an endless
> loop with my version.
> 
> regards, tina


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

Date: Tue, 21 Jan 2003 21:29:26 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: execute b.pl script from within a.pl script and b.pl vars remain
Message-Id: <slrnb2s40m.596.tadmc@magna.augustmail.com>

Kevin T <NOSPAMintx@yahoo.com> wrote:

> the '| sed | sed' (sed -e 'stuff' -e 'morestuff' -e 
> 'evenmorepiddlystuff') is meant to indicate additional munging before it 
> is usable in the form needed.
> 
> and i am sure that a better long term solution would to put the munging 
> in the perl script as well.  the real meat of the script is in a.pl and 
> more important at this time.
> 
> not to  mention perl is still an unnative language to me, although i am 
> trying to change that.


Then convert your sed programs into Perl programs using the "s2p"
program that is part of the perl distribution.


It won't be idiomatic Perl, but at least it'll be all in the same process.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 22 Jan 2003 02:53:16 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: How are named unary operators that take $_ created?
Message-Id: <b0l12s$31e0$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Peter J. Acklam
<pjacklam@online.no>], who wrote in article <of6diaev.fsf@online.no>:
> jl_post@hotmail.com (J. Romano) wrote:
> 
> >    How do you create named unary operators that operate on $_ by
> > default? [...]
> 
> I think you must use a prototype, like this:
> 
>     sub ceil (;$) {

Due to a long-standing bug in the parser, the prototype (;$) is not
supported.  It is treated the same as (@) by the parser; note that the
prototype ($) is fully supported, so you *can* replace those
overridable builtins which have prototype ($).

I reported it many times; apparently, nobody else cares.

Ilya


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

Date: Wed, 22 Jan 2003 06:52:43 GMT
From: gofer@where-am-i.com
Subject: Re: identifying web host platform?
Message-Id: <5rfs2v4evlk394gl924mrb0803u5s4mdq9@4ax.com>

Go here;  download IDSERVE;  its  free


http://grc.com/id/idserve.htm

Welcome

gofer

On Wed, 22 Jan 2003 02:04:41 GMT, "I'm Dan"
<dg1261@cs-REMOVE_THIS-.com> wrote:

>Some time ago (within the last year or two) I recall tinkering with a way to
>reveal the host platform and server of a website (ie., NT vs linux, IIS v
>Apache, etc).  However, I can no longer recall how it was done.  I don't
>remember whether it was a URL of some diagnostic site, or whether it was a
>perl CGI script, or whether it was some exe file to run.  I don't even
>remember whether I learned about it from a magazine (PC Magazine, maybe?) or
>from a newsgroup.  Does this ring a bell with anyone?
>
>



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

Date: Tue, 21 Jan 2003 21:10:03 -0600
From: Lars Eighner <eighner@io.com>
Subject: Re: Newbie: How to remove some characters from a string
Message-Id: <slrnb2s2uf.25u.eighner@dumpster.io.com>

In our last episode, 
<a7085a6.0301211443.20d249c1@posting.google.com>, 
the lovely and talented Frank San Juan 
broadcast on comp.lang.perl.misc:

> Hello.

> I'm trying to remove these characters from my string: "," and ".".

> I've been playing with Regular Expressions, but I'm green:
> $text =~ s/([\,\.])/\d/g;

> I write '\d' in order to _D_elete the character, 

         Where in the world did you get that?  How about \r in order
         to _R_emove the character or \e in order to _E_rase the
         character or \n to _N_uke the character?  You can't just
         make up a symbol and expect perl to read your mind.

         \d stands for a _digit_ when used on the left side of a
         substitution.  On the right side it only means "d".

         First, you don't need to escape , or . in [].  Second, you
         have no need for the parentheses.  This will do what you are
         triying to do:

         $text =~ s/[,.]//g;

         (Yes, you could, and probably should, us tr instead of s,
         but that is a nicety that can wait until you understand
         regexs.

> but I get a 'd' character.

         That's exactly what you should get from you wrote.

> John,Paul,Mary ---> JohndPauldMary
> (and I want: JohnPaulMary)

> Any experience? Thank you.
-- 
Lars Eighner -finger for geek code-  eighner@io.com http://www.io.com/~eighner/
    Nine out of ten doctors agree that one out of ten doctors is an idiot.


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

Date: Tue, 21 Jan 2003 21:17:44 -0900
From: "Tim Judd" <tjudd.01@hotmail.com>
Subject: Perl 5.8.0 source on FreeBSD 4.7-STABLE
Message-Id: <v2sdfeodqm4698@corp.supernews.com>

Greetings.

I cannot get perl 5.8.0 from source to successfully pass compilation for
mod_perl.

I remove "config.sh" and "Policy.sh" from the directory,
I configure with "-des -Dusethreads"
make completes succesfully
make test fails at    POSIX, test #11

I'm sorry to resort to newsgroups about mod_perl, however, the message I
sent to mod_perl mailing list was never replied.

My E-Mail is spam blocked.  Reply to the NG please.




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

Date: 21 Jan 2003 19:53:11 -0800
From: janeaustine50@hotmail.com (Jane Austine)
Subject: Please help decoding this perl code.
Message-Id: <ba1e306f.0301211953.790b1b4@posting.google.com>

I am reading Object-Oriented Reengineering Patterns. I really enjoy
this book. On p.177, however, there is a perl code, which is all Greek
to me. Can anyone here translate it into a pseudo-code or a python/Java 
code(literal translation might do)?

Thank you so much.

Jane.

#! /usr/bin/env perl -w
#duplocForCPP.pl - detect duplicated lines of code (algorithm only)
# Synopsis: duplocForCPP.pl filename ...
# Takes code (or other) files and collects all line numbers of lines
# equal to each other within these files. The algorithm is linear(in
# space and time) to the number of lines in input.

$equivalenceClassMinimalSize =1;
$slidingWindowSize=5;
$removeKeywords=0;
@keywords=qw(if
	then
	else
	for
	{
	}
);

$keywordsRegExp=hoin '|',@keywords;

@unwantedlines=qw( else
	return
	return;
	return result;
	}else{
		#else
		#endif
		{
		}
		;
	};
);
push @unwantedLines, @keyswords;

@unwantedlines{@unwantedlines}=(1) x @unwantedLines;

$totalLines=0;
$emptyLines=0;
$codeLines=0;
@currentLines=();
@currentLineNos=();
%eqLines=();
$inComment=0;

$start=(times)[0];

while(<>) {
	chomp;
	$totalLines++;

	# remove comments of type /* */ 
	my $codeOnly='';
	while (($inComment && m|\*/|) || (!$inComment && m|/\*|)) {
		unless($inComment) { $codeOnly .=$` }
		$inComment=!$inComment;
		$_=$';
	}
	$codeOnly .= $_ unless $inComment;
	$_=$codeOnly;
	
	s|//.*$||;
	s/\s+//g;
	s/$keywordsRegExp//og if $removeKeywords;

	#remove empty and unwanted lines
	if (((!$_ && $emptyLines++)
		|| (defined $unwantedLInes{$_} && $codeLines++)) { next }

	$codeLines++;
	push @currentLines, $_;
	push @currentLineNos, $.;
	if ($slidingWIndowSize < @currentLines) {
		shift @currentLines;
		shift @currentLineNos;
	}

	# print STDERR "Line $totalLInes >$_<\n";

	my $lineToBeCompared = join '', @currentLines;
	my $lineNumbersCompared="<$ARGV>"; 
	$lineNumbersCompared .=join '/', @currentLineNos;
	# print STDERR "$lineNumbersCompared\n";
	if ($bucketRef = $eqLines{$lineToBeCompared}) {
		push @$bucketRef, $lineNumbersCompared;
	} else {
		$eqLines{$lineToBeCompared}= [ $lineNumbersCompared ];
	}

	if (eof) { close ARGV } #Reset linenumber-count for next file
}

$end=(times)[0];
$processingTime=$end-$start;

#print the equivalence classes

$numOfMarkedEquivClasses=0;
$numOfMakredElements=0;
foreach $line (sort { length $a <=> length $b } keys %eqLines) {
	if (scalar @{$eqLines{$line}} > $equivalenceClassMinimalSize) {
		$numOfMarkedEquivClaases++;
		$numOfMarkedElements += scalar @{$eqLines{$line}};
		print "Lines: $line\n";
		print "Locations: @{$eqLines{$line}}\n\n";
	}
}

print "\n\n\n";
 ...(a few more lines of print)


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

Date: 21 Jan 2003 18:48:42 -0800
From: vibhav@gdit.iiit.net (Vibhav Agarwal)
Subject: Re: Problem in 'split' function
Message-Id: <e61c9f4e.0301211848.4aace358@posting.google.com>

mauzo@ux-ma160-6.csv.warwick.ac.uk (Ben Morrow) wrote in message news:<b0jn6p$bk0$1@wisteria.csv.warwick.ac.uk>...
> vibhav@gdit.iiit.net (Vibhav Agarwal) wrote:
> >Hi all,
> >     I have a problem.
> >
> >I have written a perl program, which is running well on Red Hat Linux
> >7.2
> >But when i am running that program on Red Hat Linux 8.0, i am having
> >errors in 'split' function.
> >
> >In my program split function has been written as:
> >
> >@arr = split(/"/,$in); #$in is a string which contains '"'
> >
> >It is executing well on Linux 7.2
> 
> I believe the current version of linux is 2.5.something. Please be more careful
> about what you mean. Also, in this case, a far more important question is what 
> the versions of perl involved are.
> 
> >But when i am running it on Linux 8.0, it is giving this error-
> >Split loop at "file_name"
> 
> And how are we supposed to help if we don't know what $in contains? A quick
> test with $in='a"b' works fine for me with perl5.8.
> 
> However, perldoc perldiag (do you know about that? You should) says that 
> 'Split loop' is an internal error you should never see...
> 
> Again, which version of Perl are you using and where did it come from?
> 
> >Now i wrote split function as 
> >
> >($a, $b) = split(/"/,$in);
> 
> Yes, this (I would guess) is likely to fix the problem as then split is only
> trying to produce three strings. However, the real problem is more fundamental
> than that.
> 
> >Now it is working well.
> >
> >Please tell me what is the problem in first 'split' function?
> 
> Nothing, as far as I can see. Can you post a full (SHORT) program which
> demonstrates the problem, together with the full output and the perl version?
> 
> >All advices and sugegstions are welcome.
> >
> >Thank you in advance.
> >
> >Please reply soon.
> 
> Don't ever say this. Usenet is not a helpdesk. People will reply in their own 
> time or not at all, and this make the latter rather more likely.
> 
> Ben



Hi all,
   I got the error. 
It was not problem because of any Perl verison (I think so).

Try this code on ur machine--

#!/usr/bin/perl
open (T,"fi") || die "cannot open file 'fi' : $!\n";

my $in;
my @sp;
my @arr;
while($in=<T>)
{
        @sp = split(/"/,$in);
        print "@sp\n";
        @arr = split(/\W|_/,$sp[1]);
        print "@arr\n";
}
close T;

where fi contains this line :

"razor-blade","N","1.xADZI_banAne_ke_kAma_Ane_vAlA_bleda"

It is executing well.

Now please try this code :


#!/usr/bin/perl
open (T,"fi") || die "cannot open file 'fi' : $!\n";

my $in;
my @sp;
while($in=<T>)
{
        @sp = split(/"/,$in);
        print "@sp\n";
        @arr = split(/\W|_/,$sp[1]);
        print "@arr\n";
}
close T;

Now it is giving error in second split function. It is just because of
i have not declare array '@arr'.


-- Vibhav


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

Date: Wed, 22 Jan 2003 07:57:20 GMT
From: 195.202.157.110 [Peter Ludikovsky <darthludi@gmx.net>]
Subject: Regex problem
Message-Id: <A9sX9.35932$536.2004778@news2.telusplanet.net>


The following line causes me some problems:
    $input=~s/°10°(\d+?)°(\d+?)°(.+?)°/<img width="$1" height="$2" src="..\/~peter\/$3" \/>/;
$input is something like "something°10°600°80°header_all.jpg°something else".

In short I'd like to change everything between the first and the last ° to a picture. The first number is the ID for picture, the second is the width and the third is the height. All thats left is the filename.

My main problem: at home it works, at work it doesn't.
Home Box: SuSE Linux 7.2, PERL 5.8.0
Work Box: SuSE Linux 7.3, PERL 5.6.1

Any help is appreciated (esp. since I need to present this script in about 2 hours).
/peter

==================================
Poster's IP address: 195.202.157.110
Posted via http://nodevice.com
Linux Programmer's Site


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

Date: 21 Jan 2003 19:39:40 -0800
From: mrennix@totalise.co.uk (Martin)
Subject: Re: Regex to find all words containing a single vowel?
Message-Id: <cb57fb72.0301211939.6e36c0c7@posting.google.com>

"Janek Schleicher" <bigj@kamelfreund.de> wrote in message news:<pan.2003.01.21.12.54.47.794815@kamelfreund.de>...
> I just used the x modifier only to increase the readability. I only
> inserted some spaces to seperate the different part of the regexp. The x
> modifier has the effect that spaces are ignored by the regexp.


Increase readability, what an interesting concept! I must try that
myself. Thanks again!

--
Martin Rennix


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

Date: Wed, 22 Jan 2003 02:20:56 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Regex: optional word boundary
Message-Id: <3e2dfb96.412478835@news.erols.com>

"Amittai Aviram" <amittai@amittai.com> wrote:

: For instance, the rule should match
: fan
: fanmail
: fanbase
: 
: -- but not
: fantastic
: 
: or any other compound other than, say, in this case, compounds with "mail"
: and "base."  In other words, the rule is to say that there is either a word
: boundary at the end of "fan" _or_ "fan" is followed by one of the two other
: possibilities.  

Write it like you said it.

    m/
        \bfan                 # fan
            (?:
                \b            # followed by word boundary
                |
                (?:mail|base) # or a permitted suffix
            )
    /x;

But I've got a feeling you want to enforce a word boundary at the end
whether a suffix is present or not.  Otherwise it would match
something like 'fanbaseball'.

See if this is more what you want.

    m/\bfan(?:mail|base)?\b/;

: I realize that this question really is entirely about regular expressions,
: not specifically about Perl.  If I should not be posting the question to
: this NG, I'd appreciate specific advice about where else to post such
: questions.

Depends on the implementation.  If the program is in Perl, you got it.
If it's in, say, Javascript, post to a Javascript newsgroup.



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

Date: Tue, 21 Jan 2003 22:45:02 -0500
From: "Amittai Aviram" <amittai@amittai.com>
Subject: Re: Regex: optional word boundary
Message-Id: <b0l444$quobt$1@ID-124651.news.dfncis.de>

[Posted.  Copy e-mailed.]

"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3e2dfb96.412478835@news.erols.com...
> "Amittai Aviram" <amittai@amittai.com> wrote:
>

> See if this is more what you want.
>
>     m/\bfan(?:mail|base)?\b/;

Yes, that's exactly right!  I wasn't quite sure whether I wanted the
required word boundary at the end, but I can see from some experimentation
that that gives me much better results.

> : I realize that this question really is entirely about regular
expressions,
> : not specifically about Perl.  If I should not be posting the question to
> : this NG, I'd appreciate specific advice about where else to post such
> : questions.
>
> Depends on the implementation.  If the program is in Perl, you got it.
> If it's in, say, Javascript, post to a Javascript newsgroup.

Well, <sigh /> actually, it's about the C++ Boost Library's boost::regex
algorithms, but they are supposed to handle regular expressions by default
in a way similar to Perl.  The Boost Library also has its own mailing list,
and I have already posted a query to it, but traffic there is slow, and I am
grateful in the meantime for your help.  I couldn't think of exactly how to
do this in Perl, either -- I didn't know that the ?: conditional syntax
worked in Perl -- so this is great to know for the future.

Amittai





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

Date: Tue, 21 Jan 2003 22:52:02 -0500
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Regex: optional word boundary
Message-Id: <3E2E1562.6070708@thecouch.homeip.net>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1



Amittai Aviram wrote:
| Hi!  I am trying to create a single regular expression rule that will
match
| _either_ a certain independent word _or_ certain specified compounds in
| which that word is the first element, but not other compounds in which the
| word is a specified element.  For instance, the rule should match
| fan
| fanmail
| fanbase
|
| -- but not
| fantastic
|
| or any other compound other than, say, in this case, compounds with "mail"
| and "base."  In other words, the rule is to say that there is either a
word
| boundary at the end of "fan" _or_ "fan" is followed by one of the two
other
| possibilities.  This will not work:
|
| \bfan(mail | base)?
|
| -- because it will match "fantastic."

Unless I mis-understood your question, all you need is another \b at the
end of that regex !

\bfan(mail|base)?\b


-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+LhVieS99pGMif6wRAorNAKCuinugqwmoJWzD+0UAwEBi2ovwFQCg2pOi
znlftytDfV2u/+/lqcAsT6Q=
=njP4
-----END PGP SIGNATURE-----



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

Date: Wed, 22 Jan 2003 04:32:03 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Regex: optional word boundary
Message-Id: <3e2e1864.419854151@news.erols.com>

"Amittai Aviram" <amittai@amittai.com> wrote:

: "Jay Tilton" <tiltonj@erols.com> wrote in message
: news:3e2dfb96.412478835@news.erols.com...
: >
: > Depends on the implementation.  If the program is in Perl, you got it.
: > If it's in, say, Javascript, post to a Javascript newsgroup.
:
: Well, <sigh /> actually, it's about the C++ Boost Library's boost::regex
: algorithms, but they are supposed to handle regular expressions by default
: in a way similar to Perl.  The Boost Library also has its own mailing list,
: and I have already posted a query to it, but traffic there is slow, and I am
: grateful in the meantime for your help.  

If you can take a Perl regex and make it work in [Language X], nobody
has to know.  Understand, though, that readers of that list may simply
not know the answer, and they would appreciate an exploration of regex
syntax.  If you get something working, contribute to the community by
sharing the solution with them.

Chances are that it will drop right into place, but not always.
Readers only tend to get grumpy when they build a spiffy Perl regex
for somebody, then that person comes back with "That doesn't work in
[Language X].  Fix it!"  :)

: I didn't know that the ?: conditional syntax worked in Perl

There may be some confusion there.  The (?:pattern) thing is not the
same as the ternary ?: operator.  (?:pattern) is the same as (pattern)
except it does not capture a substring--it's for grouping
subexpressions when capturing is unnecessary or undesirable.



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

Date: Tue, 21 Jan 2003 21:08:42 -0600
From: Ryan <remccart@uiuc.edu>
Subject: Re: Send a file w/ CGI
Message-Id: <ATnX9.13587$Vf3.145431@vixen.cso.uiuc.edu>

Harald H.-J. Bongartz wrote:
> "doesn't work" is not a valid error description.  Please be more
> specific.  Your code Works For Me[tm] with Mozilla, Netscape 4.x, and
> Konqueror.

Yeah... I deserved that.  I shpould clarify that I got it to work with 
IE but in Mozilla wants to append the extention '.cgi'.  Even if i 
remove it, the file does not download properly.  It comes out as a 1kb 
empty file.

> I really hope that those %FORM variables don't come directly from form
> entries, or you opened a huge security hole on the server.  Just

They are virtually all checked... I omitted the error checking for 
simplicity.

Basically, is there a better way to do this?

Thanks!





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

Date: Tue, 21 Jan 2003 21:26:13 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Send a file w/ CGI
Message-Id: <slrnb2s3ql.596.tadmc@magna.augustmail.com>

Ryan <remccart@uiuc.edu> wrote:
> Harald H.-J. Bongartz wrote:

> It comes out as a 1kb 
> empty file.


If it has a 1kb file size then it is not empty.

An empty file would have a zero byte file size.


>> I really hope that those %FORM variables don't come directly from form
>> entries, or you opened a huge security hole on the server.  Just
> 
> They are virtually all checked... I omitted the error checking for 
> simplicity.


Harald was not talking about error checking there.

He was talking about taint checking.

Are you using taint checking (-T) in your CGI program?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 21 Jan 2003 23:43:53 -0800
From: markus.rachbauer@chello.at (Markus Rachbauer)
Subject: Re: server and client on the same port
Message-Id: <51afb9de.0301212343.75f61dd2@posting.google.com>

news@roaima.freeserve.co.uk wrote in message news:<cmuj0b.r6m.ln@moldev.cmagroup.co.uk>...
> Markus Rachbauer <markus.rachbauer@chello.at> wrote:
> > sorry, if i described my problem not exactly enough.
> 
> You have described it well.
> 
> 1. As Lao said, it's not a Perl problem
> 
> 2. As Benjamin said, you can't do that.
> 
> TCP/IP identifies a connection uniquely by the tuple (source host,
> source port, destination host, destination port). You *cannot* have
> two separate but simultaneous TCP/IP conversations with the same four
> values. Period.
> 
> You will need to revisit your communication protocol as you *cannot*
> implement this as described.
> 
> > is there any workaround to send a message through the same
> > port where a server is already listening?
> 
> Yes, you use the same socket endpoints that you used to initiate the
> conversation in the first place.

> 
> Chris
that is the problem. if i start a listening socket on port 9000, and i
try to open a second socket with the same port on my local machine, i
got an error message (port already in use). how can i create a second
socket in perl without any error? let me mention, that the answer is
sent back from different ports, so no connection has the same tupel
(source ip and port, dest ip and port). the worst case scenario is a
connection from machine a port 9000 to machine b 12000 and a second
connection from port 13000 from machine b back to machines a port 9000
simultaneously.
if this is really not a perl problem (for me it is, as i need it done
in perl), please tell me who to ask else.
below the (perl) code i have used.

thanks,
markus

my $daemon_socket = new IO::Socket::INET (
			LocalHost => 'ariadne',
			LocalPort => 9000,
			Listen => 5,
			Proto => 'tcp',
			Reuse => 1,
			);


my $relay_socket = new IO::Socket::INET (
			LocalHost => 'ariadne',
			LocalPort => 9000,
			PeerAddr => 'kassiopeia',
			PeerPort => 12000,
			Proto => 'tcp'
				);


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

Date: 21 Jan 2003 19:15:11 -0800
From: jensensoftware@yahoo.com (Paul Jensen)
Subject: Re: split with pattern matching question
Message-Id: <26cc423.0301211915.49a9a4c8@posting.google.com>

Placing the following statement before you split $_ should remove all
the whitespace before and after the text.  It would also make your
split function less complicated.

s/\|\s*|\s*\|/\|/g;

Let me know if it works.

Paul


Alexander Stremitzer <stremitz@consultant.com> wrote in message news:<3E2DD87F.4080104@consultant.com>...
> $_ contains a line with items delimited with "|" which looks something like:
> |TEXT1    |TEXT2     |     TEXT3|    TEXT4   |
> 
> The following program line works fine to remove all trailing white space 
> in each field.
> my $line = join '|', split /\s*(?:\||$)/;
> 
> However, I can't figure out how to remove the leading white space also. 
> Pattern matching is already hard to understand, but pattern matching as 
> argument to split ...
> 
> Any help is appreciated.
> 
> Thanks,
> Alex


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

Date: Wed, 22 Jan 2003 03:48:13 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Writing gaming "macro" programs
Message-Id: <3E2E1444.8040001@rochester.rr.com>

Robert Parks wrote:

> Hi would like write a macro program to play a windows game.  I will
> need to be able to do the following:
> - enter key strokes
> - move mouse
> - click
> - check pixels
>  
> Anyone know of a perl module that would facilitate these activities?
 ...


> Rob
> 

The Tk module could be used, possibly in conjunction with GD for image 
and pixel stuff.

-- 
Bob Walton



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

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

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 V10 Issue 4445
***************************************


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