[22215] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4436 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 21 00:05:39 2003

Date: Mon, 20 Jan 2003 21: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           Mon, 20 Jan 2003     Volume: 10 Number: 4436

Today's topics:
    Re: Ayone used Perl2Exe with modules accessing non-auto <bart.lateur@pandora.be>
    Re: Confused - Fork - Thread - Ithread - Ahhhh... <goldbb2@earthlink.net>
        Couple of Perl CGI problems (UmanS)
    Re: Couple of Perl CGI problems <mbudash@sonic.net>
    Re: Directly handling file descriptor <sun_tong@users.sourceforge.net>
        File::Copy under NT appears to fail. (Fergus McMenemie)
    Re: How can a SMTP mail be deleted from a Unix mailbox  <akupries@shaw.ca>
    Re: I still don't get locking.  I just want to incremen <GPatnude@adelphia.net>
    Re: I still don't get locking.  I just want to incremen <me@privacy.net>
    Re: Quick HTML/CGI/Perl Question <jurgenex@hotmail.com>
    Re: Regex to find all words containing a single vowel? <bigj@kamelfreund.de>
    Re: removing duplicate values from array not working... <eric.ehlers@btopenworld.com.nospam>
        Reverse Inheritance? <mark@don't spam me you fn' bastards.com>
    Re: Reverse Inheritance? (Ben Morrow)
        simple perl cgi server <kumpf@mit.edu>
    Re: simple perl cgi server <wsegrave@mindspring.com>
    Re: simple perl cgi server <istink@real.bad.com>
    Re: simple perl cgi server <rogersc@mindspring.com>
    Re: Taint check problem (again) <goldbb2@earthlink.net>
    Re: Text manipulation <mgjv@tradingpost.com.au>
    Re: Text::Autoformat doesn't format <usenet@dwall.fastmail.fm>
    Re: why does not this work <bart.lateur@pandora.be>
        YAPC::Canada - May 15 and 16, 2003 in Ottawa - http://w (Peter Scott)
    Re: YAPC::Canada - May 15 and 16, 2003 in Ottawa - http <krahnj@acm.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 20 Jan 2003 23:46:03 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Ayone used Perl2Exe with modules accessing non-autoloadable dll`s?
Message-Id: <pc2p2v8vflsietnf0adg4repgq3hjkf2cu@4ax.com>

Daby wrote:

>I can`t seem to get a few dll`s included in an exe. WHen I use a module that
>uses Win32APP::ODBC (odbc.dll)(auto loaded) and then run perl2exe with the
>option -tiny it tells me what files I need  and actually copies the files to
>the directory of my program. WHen I use a  module that uses non-autoloadable
>dlls perl2exe just doesn`t seem to want anything to do with the dll file.

perl2exe's scanning algorithm is a bit dumb. For some cases, you must
aid it a little by putting extra require statements for those modules it
misses in the script. They don't hurt. If you were to tuck "if 0" at the
end, they wouldn't even do a thing at runtime.

	require Win32::APP::ODBC if 0;

I'm not sure which modules that need this extra kick, you can find out
yourself easily. Likely it's one of the modules used by a module you use
explicitely.

-- 
	Bart.


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

Date: Mon, 20 Jan 2003 19:51:17 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Confused - Fork - Thread - Ithread - Ahhhh...
Message-Id: <3E2C9985.B2FDB022@earthlink.net>

Lao Tzu wrote:
[snip]
> - It uses Net::DNS to see if a MX record exists for $domain.
[snip]
> My question is, where should I look so that I can write the script so
> it can do multiple MX lookups at once ?

Do
   perldoc Net::DNS

And scroll down to the stuff about doing a "background query".

No threads or forks are needed.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: 20 Jan 2003 19:11:59 -0800
From: kedaran0504@yahoo.com.au (UmanS)
Subject: Couple of Perl CGI problems
Message-Id: <751924de.0301201911.5a7c6f42@posting.google.com>

Hi,

First problem.
I am submitting a field contains name and email address separated by
"|" (Selected from a drop down list in a form)
ex: Surname.Firstname|user@mydomain.com
In the cgi script I assign this to a field and splitting this field
into an array.
$var1 =query->param('formfield1');
@myarray = split ("|",$var1);
@myname = $myarray[0];
@myaddr = $myarray[1];

When I print $var1 it prints ok, but how can I print @myname or
@myaddr. If say
print $myname[0] it will print only the first letter.

Second Problem.
I am sumitting a Text type field through a web form that may contains
(' single quot character) and when my perl cgi script submit this to
the oracle database oracle interprets it as a terminator. SO I am
coverting the single quots to double quots. But the problem is I am
using
$string = ~/\'/\"/; but this changes only the first occurance only. 
Please help me.

Thanks


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

Date: Tue, 21 Jan 2003 03:50:21 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Couple of Perl CGI problems
Message-Id: <mbudash-901CB5.19501920012003@typhoon.sonic.net>

In article <751924de.0301201911.5a7c6f42@posting.google.com>,
 kedaran0504@yahoo.com.au (UmanS) wrote:

> Hi,
> 
> First problem.
> I am submitting a field contains name and email address separated by
> "|" (Selected from a drop down list in a form)
> ex: Surname.Firstname|user@mydomain.com
> In the cgi script I assign this to a field and splitting this field
> into an array.
> $var1 =query->param('formfield1');
> @myarray = split ("|",$var1);
> @myname = $myarray[0];
> @myaddr = $myarray[1];
> 
> When I print $var1 it prints ok, but how can I print @myname or
> @myaddr. If say
> print $myname[0] it will print only the first letter.
> 
> Second Problem.
> I am sumitting a Text type field through a web form that may contains
> (' single quot character) and when my perl cgi script submit this to
> the oracle database oracle interprets it as a terminator. SO I am
> coverting the single quots to double quots. But the problem is I am
> using
> $string = ~/\'/\"/;

i doubt it - you prolly mean:

$string =~ s/\'/\"/;

> but this changes only the first occurance only. 
> Please help me.
> 
> Thanks

you need to read the docs on both the split function and regular 
expressions. at the command line:

perldoc -f split
perldoc perlrequick

come on back if you still have problems...

hth


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

Date: 20 Jan 2003 19:41:03 -0500
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Re: Directly handling file descriptor
Message-Id: <sa81y37bahs.fsf@suntong.personal.users.sourceforge.net>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>     perl -e 'open(FH,">&3") or die $!; print FH "test\n"' 3 > /dev/ttyp2
> 
> gives me a "Bad file descriptor...", which seems to indicate that my
> shell doesn't provide fd3 in this way.  I don't know what yours does,
> but this is a shell problem, not a Perl problem.

Thanks Anno, try again, remove the blank between 3 & <

  perl -e 'open(FH,">&3") or die $!; print FH "test\n"' 3> /dev/tty

Thanks Brian also, you know what, still took me several second to
figure out what was wrong. :-)

-- 
Tong (remove underscore(s) to reply)
  *niX Power Tools Project: http://xpt.sourceforge.net/
  - All free contribution & collection


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

Date: Mon, 20 Jan 2003 23:34:11 +0000
From: fergus@twig.demon.co.uk (Fergus McMenemie)
Subject: File::Copy under NT appears to fail.
Message-Id: <1fp3ypj.oi6qix91484aN%fergus@twig.demon.co.uk>




I have used File::Copy to copy 600000 files from one disk to another.
The copy returned 0 now and again for no apparent reason. The output
file was there and seemed OK in almost all cases. Its size and contents
are identical to the original file. About 300 files produced a 0 return
status. About 50 or so files did fail to copy, there size and or
checksum was different.

Anybody else seen this or have any ideas? Im using Perl 5.005 from
Active State. It is running on MIcrosoft Windows NT 4.0 with SP6. 

Copy was performed using a File::Find call back:-
   File::Copy($File::Find::name,"N:/docs/$year/$mon/$day/$_");

-- 
Fergus McMenemie               Email:fergus@twig.demon.co.uk.
Technical Basis                Phone:(UK) 07721 376021

Unix/Mac/Intranets             Analyst Programmer


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

Date: Tue, 21 Jan 2003 02:58:55 GMT
From: Andreas Kupries <akupries@shaw.ca>
Subject: Re: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <87y95f6xd5.fsf@bluepeak.home>

"Donal K. Fellows" <donal.k.fellows@man.ac.uk> writes:

> lvirden@yahoo.com wrote:
> > According to Markus Elfring <Markus.Elfring@web.de>:
> >: This request's subject is the deletion of messages in the file "mbox".
> > The second problem is even worse, in my opinion.  That is the factor of file
> > locking.  Each mail program is free to (and appears to) make use of what
> > its author(s) deem as most useful file locking.  Of course, if one's
> > mail files are on NFS, then some file locking schemes are less successful
> > than others.  But if an additional utility to, say, delete messages, were
> > to be written, the author needs to account for the locking styles of ANY
> > program which might update that box, so as not to lose messages.
> 
> Indeed, this is sufficiently nasty that I'd suggest doing everything using POP
> or IMAP if the mailbox is accessible via that route!  At least then you could

If someone has tcl code handling the IMAP protocol please consider
contributing this to tcllib.

-- 
Sincerely,
	Andreas Kupries <akupries@shaw.ca>
	Developer @	<http://www.activestate.com/>
	Private		<http://www.purl.org/NET/akupries/>
-------------------------------------------------------------------------------
}


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

Date: Mon, 20 Jan 2003 23:20:57 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: Re: I still don't get locking.  I just want to increment the number in the file.  How can I do this?
Message-Id: <tv%W9.87331$VA5.14641757@news1.news.adelphia.net>


"PerlFAQ Server" <comdog@panix.com> wrote in message
news:b0hv3i$h8o$1@reader1.panix.com...
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with Perl.
>
> --------------------------------------------------------------------
>
> 5.20: I still don't get locking.  I just want to increment the number in
the file.  How can I do this?
>
>
>     Didn't anyone ever tell you web-page hit counters were useless? They
>     don't count number of hits, they're a waste of time, and they serve
only
>     to stroke the writer's vanity. It's better to pick a random number;
>     they're more realistic.
>
>     Anyway, this is what you can do if you can't help yourself.
>
>         use Fcntl qw(:DEFAULT :flock);
>         sysopen(FH, "numfile", O_RDWR|O_CREAT)       or die "can't open
numfile: $!";
>         flock(FH, LOCK_EX)                           or die "can't flock
numfile: $!";
>         $num = <FH> || 0;
>         seek(FH, 0, 0)                               or die "can't rewind
numfile: $!";
>         truncate(FH, 0)                              or die "can't
truncate numfile: $!";
>         (print FH $num+1, "\n")                      or die "can't write
numfile: $!";
>         close FH                                     or die "can't close
numfile: $!";
>
>     Here's a much better web-page hit counter:
>
>         $hits = int( (time() - 850_000_000) / rand(1_000) );
>
>     If the count doesn't impress your friends, then the code might. :-)
>
>
>
> --------------------------------------------------------------------
>
> Documents such as this have been called "Answers to Frequently
> Asked Questions" or FAQ for short.  They represent an important
> part of the Usenet tradition.  They serve to reduce the volume of
> redundant traffic on a news group by providing quality answers to
> questions that keep coming up.
>
> If you are some how irritated by seeing these postings you are free
> to ignore them or add the sender to your killfile.  If you find
> errors or other problems with these postings please send corrections
> or comments to the posting email address or to the maintainers as
> directed in the perlfaq manual page.
>
> Note that the FAQ text posted by this server may have been modified
> from that distributed in the stable Perl release.  It may have been
> edited to reflect the additions, changes and corrections provided
> by respondents, reviewers, and critics to previous postings of
> these FAQ. Complete text of these FAQ are available on request.
>
> The perlfaq manual page contains the following copyright notice.
>
>   AUTHOR AND COPYRIGHT
>
>     Copyright (c) 1997-2002 Tom Christiansen and Nathan
>     Torkington, and other contributors as noted. All rights
>     reserved.
>
> This posting is provided in the hope that it will be useful but
> does not represent a commitment or contract of any kind on the part
> of the contributers, authors or their agents.

Better off yet -- Track the number of hits from unique IP addresses -- at
least it's somewhat meaningful and somewhat realistic....

sub appendDataFile() {

 # MODIFIED BY G. Patnude 10-01-2002 FOR KEYCOMM...
 $CURRENT_DATETIME = time();
 $DATAFILE = dataFILE();

 if (open(SECTION, ">>$datadir/$DATAFILE")) {

  print SECTION "$ENV{'REMOTE_ADDR'}|$section|$CURRENT_DATETIME\n";
  # print "$ENV{'REMOTE_ADDR'}|$section|$CURRENT_DATETIME\n";
  close (SECTION);

 } else {

  die "Could not open the data file ($datadir/$DATAFILE) for
appending...<BR>";


 }

 print "Entry added to the section tracking file
($datadir/$DATAFILE)...<BR>\n";
return TRUE;

}






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

Date: Tue, 21 Jan 2003 14:34:07 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: I still don't get locking.  I just want to increment the number in the file.  How can I do this?
Message-Id: <b0ifel$pcb3a$1@ID-172104.news.dfncis.de>


"codeWarrior" <GPatnude@adelphia.net> wrote in message
news:tv%W9.87331$VA5.14641757@news1.news.adelphia.net...

[ codeWarrior is trying very hard to prove they are a troll]

>
> "PerlFAQ Server" <comdog@panix.com> wrote in message
> news:b0hv3i$h8o$1@reader1.panix.com...
> > 5.20: I still don't get locking.  I just want to increment the number in
> > the file.  How can I do this?
> >
> >     Here's a much better web-page hit counter:
> >
> >         $hits = int( (time() - 850_000_000) / rand(1_000) );
> >
[snip full quoted sig]

> Better off yet -- Track the number of hits from unique IP addresses -- at
> least it's somewhat meaningful and somewhat realistic....

Ever heard of a webserver log?  Anyway, the code below doesn't track hits
from unique IP addresses, it simply records them.


> sub appendDataFile() {
>
>  # MODIFIED BY G. Patnude 10-01-2002 FOR KEYCOMM...

Hopefully KEYCOMM.... don't mind their IP being propagated into the public
domain.  Are you G Patnude?


[snipped rest of ugly C style code with no locking or parameter parsing]




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

Date: Mon, 20 Jan 2003 15:31:48 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Quick HTML/CGI/Perl Question
Message-Id: <3e2c86e4$1@news.microsoft.com>

[Da du deine Frage in einer deutschsprachigen NG gepostet hast gibt es die
Antwort auch auf Deutsch]
Kamal wrote:
> I have a quick HTML/

Versuch's mal in einer NG die sich HTML befasst

> CGI

Versuch's mal mit einer NG die sich mit CGI befasst

> /Perl question

Das waere in einer Perl NG on-topic, aber deine Frage hat mit Perl nix zu
tun.

> and I hope you can help me.

Kaum. Wie schon gesagt, versuch's mal in einer NG die sich mit HTML und/oder
CGI befasst.

jue




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

Date: Mon, 20 Jan 2003 23:12:01 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
To: mrennix@totalise.co.uk (Martin)
Subject: Re: Regex to find all words containing a single vowel?
Message-Id: <pan.2003.01.20.22.09.55.52492@kamelfreund.de>

On Sun, 19 Jan 2003 18:35:13 +0000, Martin wrote:

> I need to find all words in a file containing only a single vowel.
> 
> For example:
> 
> $regex = ????????
> $string = "The quick brown fox jumped over the lazy dog";
> $string =~ /$regex/g;
> 
> should match:
> 
> The
> brown
> fox
> the
> lazy
> dog
> 
> This sounds simple but I can't work out the regex! Any ideas?

As TMTWTDI, here's another solution:

print join "\n",
   ($string =~ /(\b [^aeiou\s]* [aeiou] [^aeiou\s]* \b)/gix);


Greetings,
Janek


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

Date: Tue, 21 Jan 2003 00:14:23 +0000 (UTC)
From: "eric" <eric.ehlers@btopenworld.com.nospam>
Subject: Re: removing duplicate values from array not working...
Message-Id: <b0i3cv$1o3$1@sparta.btinternet.com>

"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3E20D855.6FDB4144@earthlink.net...
> eric wrote:
> [snip]
> >   push @tmp,[split/;/];
> > }
> >
> > push @tmpTwo,$_->[4] for @tmp;
>
> That's silly.  Why grab all of it, if you're only going to use one
> element?

it's not entirely clear but from the OPs comments it seems that he wants all
the data in @tmp, with unique values of column 4 in @tmpTwo, i gather he's
going to go back and do other stuff with @tmp.

my code is essentially identical in structure to the OPs except with the
dereferencing error corrected.

-eric




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

Date: 20 Jan 2003 19:53:07 -0600
From: Mark Gannon <mark@don't spam me you fn' bastards.com>
Subject: Reverse Inheritance?
Message-Id: <3e2ca785$0$53879$45beb828@newscene.com>

Hello,

I'm hoping someone can help me understand whether the following is 
possible, or there is a better way to accomplish the same thing.  I've read 
Conway's "Object Oriented Perl", but I'm new to programming and I apologize 
if this is a basic question.

I'm trying to write a set of modules to manage a network device via its web 
interface.  There are several different interfaces to be supported 
(depending on what generation of software).  My hope is to manage these 
differences in the module code so that code that uses the modules doesn't 
have to be aware of the different interfaces.  What I'd like to do is 
something like:

Foo
Foo::Bar
Foo::Onyou

The idea is that code would only call Foo, and Foo would manage whether 
Foo::Bar was needed or Foo::Onyou.  That way, when I add the inevitable 
Foo::Onme, any code using Foo would be oblivious to the change and just 
work.

I tried to implement something like  (I'll try and leave out the irrelevant 
bits):


Package Foo
use Foo::Bar;
use Foo::Onyou;

new() {
        if ($thingie->isafoobar) {
           return Foo::Bar->new();
        }
        else {
           return Foo::Onyou->new();
        }
}

Perl thoughtfully tells me that "Subroutine new redefined at ...", so 
clearly this is a boneheaded thing to do.  

Can any one suggest a better way to accomplish this?  I've noticed that 
File::Copy, for example, manages to hide the client ickiness, but it does 
so completely within Copy.pm.


Thanks in advance,

Mark Gannon
mark at don't spam me you fn' bastards truenorth dot nu
(Remove that parts that don't apply to you and translate the punctutation)


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

Date: Tue, 21 Jan 2003 03:21:35 +0000 (UTC)
From: mauzo@mimosa.csv.warwick.ac.uk (Ben Morrow)
Subject: Re: Reverse Inheritance?
Message-Id: <b0iebv$n4p$1@wisteria.csv.warwick.ac.uk>

mark@don't spam me you fn' bastards.com wrote:
>Hello,
>
>I'm hoping someone can help me understand whether the following is 
>possible, or there is a better way to accomplish the same thing.  I've read 
>Conway's "Object Oriented Perl", but I'm new to programming and I apologize 
>if this is a basic question.
>
>I'm trying to write a set of modules to manage a network device via its web 
>interface.  There are several different interfaces to be supported 
>(depending on what generation of software).  My hope is to manage these 
>differences in the module code so that code that uses the modules doesn't 
>have to be aware of the different interfaces.  What I'd like to do is 
>something like:
>
>Foo
>Foo::Bar
>Foo::Onyou

What's this? A package hierarchy?

>The idea is that code would only call Foo,

By which I presume you mean use Foo;? (always talk Perl rather than English).

> and Foo would manage whether 
>Foo::Bar was needed or Foo::Onyou. 

Based on what? OS? Other stuff? Programmer choice?

> That way, when I add the inevitable 
>Foo::Onme, any code using Foo would be oblivious to the change and just 
>work.

This sounds to me as though you mean something like the DBI/DBD model, where
you have an 'interface' class and a whole lot of 'backend' classes.

>I tried to implement something like  (I'll try and leave out the irrelevant 
>bits):
>
>
>Package Foo
>use Foo::Bar;
>use Foo::Onyou;
>
>new() {
>        if ($thingie->isafoobar) {
>           return Foo::Bar->new();
>        }
>        else {
>           return Foo::Onyou->new();
>        }
>}
>
>Perl thoughtfully tells me that "Subroutine new redefined at ...", so 
>clearly this is a boneheaded thing to do.  

I think you've left out too much... :) Which line does the error refer to? And
where is the previous defn of Foo::new coming from?

>Can any one suggest a better way to accomplish this?  I've noticed that 
>File::Copy, for example, manages to hide the client ickiness, but it does 
>so completely within Copy.pm.

I think I would do something like this. Define a Foo base class:

package Foo;

my $backend;

sub import {
    shift;
    $backend = "Foo::Unix";
    $^O =~ /Win32/ and $backend = "Foo::Win32";
    $^O =~ /macos/ and $backend = "Foo::MacOS";

    # or whatever you want to base the decision on.
    
    eval "require $backend";
    $@ and die $@;
}

sub new {
    shift;
    my $new = {};
    bless $ref, $backend;
    $ref->init(@_);
    return $ref;
}

sub init {
    # whatever
}

sub bar {
    # whatever
}

1;

Then define Foo::Unix etc. like this:

package Foo::Unix;

use base 'Foo';

sub init {
    # unix-specific init stuff
}

sub bar {
    # override default behaviour if you need to.
}

1;

Oi rackon that should wurk...

Note that the subclasses don't have a 'new' method: they use Foo::new. If you
don't want to do this (say each subclass needed a different type of ref) you
could instead have:

package Foo;

sub new {
    shift;
    return $backend->new(@_);
}

and then give every subclass a new method.

Ben


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

Date: Mon, 20 Jan 2003 18:32:51 -0500
From: "Adam Kumpf" <kumpf@mit.edu>
Subject: simple perl cgi server
Message-Id: <3e2c8637$0$3930$b45e6eb0@senator-bedfellow.mit.edu>

I am looking for a simple application that allows me to host CGI scripts on
my windows machine.  I have a pretty quick connection and would like to host
a little image serving script I made.  I'm just looking for something small
and simple that works.  Any feedback is greatly appreciated.

Thank you very much for your time.

Best Regards,
    Adam Kumpf
kumpf@mit.edu
http://web.mit.edu/kumpf/www/index.html




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

Date: Mon, 20 Jan 2003 18:03:42 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: simple perl cgi server
Message-Id: <b0i2ub$7v9$1@slb2.atl.mindspring.net>

"Adam Kumpf" <kumpf@mit.edu> wrote in message
news:3e2c8637$0$3930$b45e6eb0@senator-bedfellow.mit.edu...
> I am looking for a simple application that allows me to host CGI scripts
on
> my windows machine.  I have a pretty quick connection and would like to
host
> a little image serving script I made.  I'm just looking for something
small
> and simple that works.  Any feedback is greatly appreciated.

You could start with IndigoPerl, available free from www.indigostar.com.

Good luck!

Bill Segraves




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

Date: Mon, 20 Jan 2003 21:33:38 -0500
From: istink <istink@real.bad.com>
Subject: Re: simple perl cgi server
Message-Id: <3E2CB182.A2E1DEFA@real.bad.com>

try:
"tinyweb" with CGI support.


http://www.ritlabs.com/tinyweb/features.html
http://www.ritlabs.com/tinyweb/

tiny: 135Kb!

Adam Kumpf wrote:
> 
> I am looking for a simple application that allows me to host CGI scripts on
> my windows machine.  I have a pretty quick connection and would like to host
> a little image serving script I made.  I'm just looking for something small
> and simple that works.  Any feedback is greatly appreciated.
>


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

Date: Tue, 21 Jan 2003 03:50:49 GMT
From: "Roger Schlafly" <rogersc@mindspring.com>
Subject: Re: simple perl cgi server
Message-Id: <Ps3X9.541$4u7.242382894@twister1.starband.net>

"Adam Kumpf" <kumpf@mit.edu> wrote in message
news:3e2c8637$0$3930$b45e6eb0@senator-bedfellow.mit.edu...
> I am looking for a simple application that allows me to host CGI scripts
on
> my windows machine.  I have a pretty quick connection and would like to
host
> a little image serving script I made.  I'm just looking for something
small
> and simple that works.  Any feedback is greatly appreciated.

Besides the other suggest, you could try Savant.
http://savant.sourceforge.net/

It is nice and simple and free and open source. It runs Perl ok.
Unfortunately, I don't think that anyone is actively maintaining it anymore.




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

Date: Mon, 20 Jan 2003 19:47:09 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Taint check problem (again)
Message-Id: <3E2C988D.D6F249D9@earthlink.net>

Helgi Briem wrote:
[snip]
> >The following line generates the message "Insecure $ENV{PATH} when
> >running with -T ...":
> 
> undef $ENV{PATH};

Given that $ENV{PATH} is tied, this is equivilant to:

   $ENV{PATH} = undef;

Which, since %ENV can only contain strings, results in undef()
stringifying and producing a warning (if you've warnings enabled).

I would suggest one of:

   delete $ENV{PATH}

Or:

   $ENV{PATH} = "";

Or:

   $ENV{PATH} = "/bin:/usr/bin";

(Probably the last)

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Tue, 21 Jan 2003 12:31:04 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Text manipulation
Message-Id: <slrnb2p8mo.7m2.mgjv@martien.heliotrope.home>

On Mon, 20 Jan 2003 17:58:08 -0500,
        Lou Moran <lou.moran@gellerandwind.com> wrote:
> I have three things to accomplish in a .csv file.
> 
> 1 -- I need to replace all " with '
> I have a pretty good handle on that

Are you sure you have that right? Your example data doesn't have double
quotes, but single ones. Is this by any chance a real CSV file? If so,
why don't you use DBD::CSV or DBD::AnyData? Or AnyData directly?

Since your data contains names, have you taken into account that some
names have apostrophes in them? And that they are (or need to be)
escaped in some way in the single-quoted version of your data?

> 2 -- I need to remove all duplicates but leave one

That sounds like a hash to me. How do you define "duplicate"? The whole
field? If so, keep a hash with those things as keys, and only do work if
you haven't seen it yet.o

perldoc -q duplicate

You should know by now how to search the FAQ, right?

> 3 -- I need to add a "Column" only when one doesn't exist
> 
> Here is an example of the data:
> 
> 'Ron Albta','127 Diamond Street','#1','San Francisco, CA 94131'
> 'Ron Albta','127 Diamond Street','#1','San Francisco, CA 94131'
> 'Ron Albta','127 Diamond Street','#1','San Francisco, CA 94131'
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 'Julia Ascheson','P.O.Box 767','Redmond, WA  98073-2767',''
> 
> As you can see Ron has an apartment number, or second address line but
> Julia does not.  So I need to add an empty set of ' when the second
> address line does not exist.

That is too vague. Both of them have 4 fields. Is the presence of an
empty last field enough to trigger this knowledge? How are we supposed
to figure out whether or not there is a second address line without
knowing how this thing got populated in the first place?

> The problems are two fold for me:
> 
> I don't know how to search this question (b/c I am phrasing it all
> wrong), and I can't find anything similar in the Perl Cookbook.
> 
> I have no idea how to approach the "add a column" problem.

Neither do I. With the very limited set of data there, I'd say trigger
on an empty last field. There simply isn't any other difference between
the two examples.

Maybe something like (without any modules):

#!/usr/local/bin/perl -w
use strict;

open DATA, "stuff.csv" or die $!;

my %seen;

while (<DATA>)
{
    chomp;
    next if $seen{$_};
    $seen{$_}++;
    my @f;

    # See the FAQ for this example:
    push @f, $+ while m#
        '([^'\\]*(?:\\.[^'\\]*)*)',?
        | ([^,]+),?
        | ,
    #gx;
    push @f, undef if substr($_, -1, 1) eq ',';

    if ($f[3])
    {
        print "$_\n";
    }
    else
    {
        splice @f, 2, 0, splice @f, 3, 1;
        print join ',', map {"'$_'" } @f;
        print "\n";
    }
}

AnyData might be easier to work with

Martien
-- 
                        | 
Martien Verbruggen      | My friend has a baby. I'm writing down all
                        | the noises the baby makes so later I can ask
                        | him what he meant - Steven Wright


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

Date: Tue, 21 Jan 2003 01:05:14 GMT
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Text::Autoformat doesn't format
Message-Id: <Xns9309CC552ED9Edkwwashere@63.240.76.16>

"Harald H.-J. Bongartz" <bongie@gmx.net> wrote:

> David K. Wall wrote:
> 
>> I'm trying to use Text::Autoformat, but it only seems to format the
>> first line, or sometimes the first few lines.
> [...]
>> my $fixed = autoformat <DATA>, { left=>0, right=>50 };
> 
>   my $fixed = autoformat <DATA>, { left=>0, right=>50, all=>1 };
> 
> Yes, it's well buried in the docs:   :-)
> 
> "Normally, "autoformat" only reformats the first paragraph it
> encounters, and leaves the remainder of the text unaltered. This
> behaviour is useful because it allows a one-liner invoking the
> subroutine to be mapped onto a con­venient keystroke in a text editor,
> to provide one-paragraph-at-a-time reformatting: [...] To enable
> "autoformat" to rearrange the entire input text at once, the "all"
> argument is used:[...]"

Well, duh.  I *do* feel stupid.  How did I miss that?  *smacks self*
Maybe the embarrassment will help me remember it better.  

-- 
David Wall - me@dwall.fastmail.fm
"Oook."


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

Date: Mon, 20 Jan 2003 23:42:34 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: why does not this work
Message-Id: <v82p2v0fqmsb65a3gbafur8ouirr1t60p4@4ax.com>

classical music wrote:

>%a=%$b->{a}
>
>does not work.
>
>$a=$b->{a};
>%a=%$a
>
>works
>
>Is it expected?

Yes.

>Why?

Precedence. The "%$" binds tighter than the "->". You must enclose hte
reference you wish to dereference in block, to get the precedence you
want:

	%a=%{$b->{a}};

-- 
	Bart.


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

Date: Tue, 21 Jan 2003 00:42:25 GMT
From: peter@PSDT.com (Peter Scott)
Subject: YAPC::Canada - May 15 and 16, 2003 in Ottawa - http://www.yapc.ca/
Message-Id: <RH0X9.80210$H7.3656805@news2.calgary.shaw.ca>

YAPC::Canada (Yet Another Perl Conference) is a low-cost  
1 1/2 day conference with its roots in the Perl Mongers groups. 
YAPC::Canada features two speaker streams and an optional day of 
pre-conference training.

The Ottawa Tulip Festival ( http://tulipfestival.ca/ ) will be in 
full swing at this time. Great for spouses while you're at 
YAPC::Canada!

Accomodations will be available at Carleton University residences.

Pre-register at http://www.yapc.ca/ with no obligation and tell us:
    - courses that interest you
    - if you would like to sponsor us
    - if you would like to present
    - any special needs
    - your ideas

Location: Carleton University, Ottawa, Ontario

Cost: CAD 75.00 (roughly USD 48.75)
    Dinner on Thursday and Friday, and lunch on Friday included.

Keynote: TBA

Times: Thursday May 15, 2003 - 1:00pm to 5:30pm
       Friday May 16, 2003 - 9:00am to 5:30pm

Training: Wednesday May 14, 2003 - all day
          Training is optional and is an extra fee

If you encounter any problems with the site or would like to contact 
us directly then please write to help@yapc.ca . 

-- 
Peter Scott



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

Date: Tue, 21 Jan 2003 01:19:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: YAPC::Canada - May 15 and 16, 2003 in Ottawa - http://www.yapc.ca/
Message-Id: <3E2C9FBF.BB0A1732@acm.org>

Peter Scott wrote:
> 
> [snip]
> 
> Location: Carleton University, Ottawa, Ontario
> 
> [snip]
> 
> If you encounter any problems with the site or would like to contact
> us directly then please write to help@yapc.ca .

Yes, it's too far east!  Could you move it to U.B.C.?  :-)


John
-- 
use Perl;
program
fulfillment


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

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


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