[23787] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5991 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 30 00:05:37 2003

Date: Mon, 29 Dec 2003 21:05:06 -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, 29 Dec 2003     Volume: 10 Number: 5991

Today's topics:
    Re: Building Perl for Win32 as a static library <tmohr@s.netic.de>
    Re: Calling a scalar from another script using "require <noreply@gunnar.cc>
    Re: Calling a scalar from another script using "require <noreply@gunnar.cc>
    Re: Encrypting executable or embedding in C <tom@nosleep.net>
    Re: Finding out a DBI connection is broken? <dmcbride@naboo.to.org.no.spam.for.me>
    Re: Install Perl module on Windows <kevin@vaildc.net>
    Re: LWP::Simple and Cookies not working (Charles DeRykus)
        Need advice on spell-checking for city names <dragnet@internalysis.com>
    Re: Need advice on spell-checking for city names <abigail@abigail.nl>
        Question on SET PATH (Dan)
    Re: Question on SET PATH <arthur0421@163.com>
    Re: Question on SET PATH <matthew.garrish@sympatico.ca>
    Re: Question on SET PATH <kalinaubears@iinet.net.au>
        Re[1]: Calling a scalar from another script using "requ <arthur0421@163.com>
        Re[1]: Calling a scalar from another script using "requ <arthur0421@163.com>
        Re[1]: Calling a scalar from another script using "requ <arthur0421@163.com>
    Re: Regexp *-operator and multiple elements <tinus@tinus.ath.cx>
    Re: Regexp *-operator and multiple elements <gnari@simnet.is>
    Re: retrieve webpage with POST <noreply@gunnar.cc>
    Re: Use a Perl_Interpreter and NOT call it my_perl?  Us <tmohr@s.netic.de>
    Re: What is the Best Content Management System? <Bazajt@NOSPAMMAGEbtopenworld.com>
    Re: What is the Best Content Management System? <SpamBlocked@tbdata.com>
    Re: writting an 'in' keyword for perl <lv@aol.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 30 Dec 2003 01:22:58 +0100
From: Torsten Mohr <tmohr@s.netic.de>
Subject: Re: Building Perl for Win32 as a static library
Message-Id: <bsqgh2$4of$1@schleim.qwe.de>

Hi,

>> Has anybody got a hint on how to build perl as a static library
>> on Windows 2000?

> Several hints :-)
> 
> Use Goggle (this has been asked and answered before).
> perldoc -q 'compile'
> perldoc -q 'embed'
> Check out SWIG (http://www.swig.org)
> perldoc perlembed

thanks for helping, but i can't find any information in there
related to this problem.  Maybe i did not describe it properly
what i want.  I'll try again:

I want to compile own C programs.  In these C programs i want
to use something like this:

#include <EXTERN.h>
#include <embed.h>
#include <perl.h>

static Perl_Interpreter* my_perl;

then in main():

 ...
  my_perl = perl_alloc();
  perl_construct(my_perl);

I then want to let the Perl_Interpreter evaluate commands.
This works fine, except that i have to install the program
AND "libperl.dll" on systems where the program should run.

So i'd like to link my program not against the DYNAMIC perl
library, but against a STATIC library.  On Unix systems i know
how to do this, but on Windows i'm a bit lost, even with
creating the static perl library.

Can anybody give me a hint on how to create a static Perl
library on Windows?


Thanks for any hints,
Torsten.


P.S.: I just asked something similar in comp.lang.tcl,
there it is possible quite easily to create static libraries
just by giving "OPTS=static" when building perl.




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

Date: Tue, 30 Dec 2003 01:58:53 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Calling a scalar from another script using "require"
Message-Id: <bsqj5m$dt93$1@ID-184292.news.uni-berlin.de>

Regent wrote:
> Gunnar Hjalmarsson wrote:
>>These are two ways to do what you want:
>>
>>    our $root;             # declares $root as a package global
> 
>   You mean in common.pl?

No, I mean in script.pl. Both my suggestions were intended for 
script.pl, while keeping common.pl as it is.

>>    require "common.pl";
>>    print $main::root;     # explicit package name
> 
>    This worked! Thanks indeed, but what does $main here mean?

$main::root means the global variable $root in package main.

> "::" means the use of modules to me.

When something begins with a '$' character, it's most likely a 
variable. You'd better do some reading:

     http://www.perldoc.com/perl5.8.0/pod/perlmod.html

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Tue, 30 Dec 2003 02:40:07 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Calling a scalar from another script using "require"
Message-Id: <bsqlj8$feju$1@ID-184292.news.uni-berlin.de>

Regent wrote:
> Gunnar Hjalmarsson wrote:
>> Regent wrote:
>>> Gunnar Hjalmarsson wrote:
>>>> 
>>>>     our $root;           # declares $root as a package global
>>> 
>>> You mean in common.pl?
>> 
>> No, I mean in script.pl. Both my suggestions were intended for 
>> script.pl, while keeping common.pl as it is.
> 
> Okay, I see. If I use this method, I must declare all scalars in
> script.pl like this, right?

Only those scalars you require from other files that way. Other
variables should preferrably be declared with my().

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Mon, 29 Dec 2003 16:09:58 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: Encrypting executable or embedding in C
Message-Id: <3ff0cdf9$1@nntp0.pdx.net>


"Tom" <tom@nosleep.net> wrote in message news:3ff0aa69@nntp0.pdx.net...
> Hi
>
> Can someone point me to information regarding either encrypting a perl
file
> so it can still execute (if this is possible), or embedding a 10,000+ line
> script completely into a C/C++ program.
>
> It also needs to encapsulate all included libraries, etc.
>
> Thanks,
> Tom
>

The goal is for the program to still be executable, while protecting the
source.
The program is running on Linux, but I may need it ported to some other
flavor than Redhat.
I want to be able to run it remotely on a server, while keeping it safe from
being stolen and viewed or modified.

Thanks,
Tom
>




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

Date: Tue, 30 Dec 2003 03:20:04 GMT
From: Darin McBride <dmcbride@naboo.to.org.no.spam.for.me>
Subject: Re: Finding out a DBI connection is broken?
Message-Id: <E96Ib.871472$9l5.767241@pd7tw2no>

Thomas Reat wrote:

> I'm using postgresql with DBI, I do a "listen foo" and every minute or
> so I do a func('pg_notifies'). If I restart the database server, the
> perl script needs to know to reconnect. What is the right way to
> determine this? I get the message below when it's restarted, so
> obviously something knows about it.
> 
> WARNING:  Message from PostgreSQL backend:
>         The Postmaster has informed me that some other backend
>         died abnormally and possibly corrupted shared memory.
>         I have rolled back the current transaction and am
>         going to terminate your database system connection and exit.
>         Please reconnect to the database system and repeat your query.

Here's my code from DB2::db - this portion should not, I hope, be
DBD-specific, but be general enough for any DBI.

sub connection
{
    my $self = shift;
    unless ($self->{dbh} and $self->{dbh}{Active})
    {
        $self->{dbh} = DBI->connect($self->_data_source,
                                    $self->user_name,
                                    $self->user_pw,
                                    $self->connect_attr);
    }
    $self->{dbh}
}

You can probably guess what the params are - there's nothing special
here (I have AutoCommit turned off, but that shouldn't be anything
special).

As you can see, the only "special" part is the Active flag.  I hope
this gets you what you need.



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

Date: Mon, 29 Dec 2003 21:16:06 -0500
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: Install Perl module on Windows
Message-Id: <kevin-D67B15.21160629122003@news101.his.com>

In article <uq90vvk8b39ki8qo4ct2basg0vcn0j0j3f@4ax.com>,
 Helgi Briem <HelgiBriem_1@hotmail.com> wrote:

> You don't need a C compiler.
> 
> Use PPM (Perl Package Manager) which comes with the Activeperl 
> distribution.
> 
> The syntax is 
> 
> C:\>ppm install MODULE
> 
> If that doesn't work, you probably need to configure
> a proxy. Set the environment variable HTTP_PROXY
> to something like 
> http://proxy.yourdomain:portnumber
> 
> If you need packages that are not in the Activestate
> repository, read 
> 
> C:\>ppm help repository 
> 
> on how to set others.

If you need a file from CPAN that isn't in ActiveState's repository, you 
can also email them and ask them (nicely) to compile it.  They've been 
pretty reponsive to me the couple of times I've needed that.
-- 
Found Poetry (_Science News_, 14-Jun-2003): oldest _homo sapiens_ find
+-----------------------------------------+ ocean eddies' far-flung effects;
|  Kevin Michael Vail <kevin@vaildc.net>  | superior threads spun
+-----------------------------------------+ the pox from prairie dogs.


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

Date: Tue, 30 Dec 2003 04:45:07 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: LWP::Simple and Cookies not working
Message-Id: <HqoyJ7.8Eq@news.boeing.com>

In article <Pv3Gb.120414$8y1.373415@attbi_s52>,
Dan  <webmaster@heavyharmonies.com> wrote:
>...
>
>use LWP::Simple qw ($ua get);
>use HTTP::Cookies;
>
>$ua->cookie_jar(HTTP::Cookies->new);
>
># Modify the following as needed.
>
>$Login = "login";
>$Password = "password";
>
>$URL="http://signin.ebay.com/aw-cgi/eBayISAPI.dll?MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&pp=&pa1=&pa2=&pa3=&il=-1&pageType=1637&userid=" 
>. $Login . "&pass=" . $Password . 
>"&keepMeSignInOption=1&ru=http://search-completed.ebay.com:80/search/search.dll?GetResult&amp;catref=C3&amp;category1=1049&amp;sr=0&amp;query=craaft&amp;lotr=1&amp;completedonly=1&amp;from=R2";
>
>$content = get $URL;
>
>open (TMPOUT, ">ebaytest.out");
>
>print TMPOUT $content;
>
>close TMPOUT;
>

Sorry, I've never gone near Ebay..

May not help but have you done any sleuthing with debug settings: 

  use LWP::Debug qw(+);

Another longshot but you can peek into the cookie jar too:

  my $jar = HTTP::Cookies->new(...);
  ...
  print $jar->as_string if $DEBUG;
 
--
Charles DeRykus


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

Date: Tue, 30 Dec 2003 00:16:13 GMT
From: Marc Bissonnette <dragnet@internalysis.com>
Subject: Need advice on spell-checking for city names
Message-Id: <Xns9460C40C08161dragnetinternalysisc@207.35.177.135>

Hi all;

I'm hoping someone can point me in the direction of an FAQ or other 
appropriate reading material in order to learn how to solve my problem. 

I have users submitting multiple city names in a perl application and this 
often results in multiple spellings, depending either on their local 
dialect, mis-spellings, or copy-and-pasting from a micro$oft app. 

For example, the city of Montréal has appeared as

Montréal
Montreal
MontrÈal

Or I'll get close-but-not-correct spellings, like 

Ottawa (correct)
Otawa
Ottawaa
Autawa

etc. 

How can I go about reducing the numbers of these incidences ? Providing 
menus of all possible cities is not feasible, since there are multiple 
areas within each province that each need a city list...

Many thanks in advance for insights.

-- 
Marc Bissonnette
CGI / Database / Web Management Tools: http://www.internalysis.com
Something To Sell? Looking To Buy? http://www.whitewaterclassifieds.ca
Looking for a new ISP? http://www.canadianisp.com


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

Date: 30 Dec 2003 00:56:29 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Need advice on spell-checking for city names
Message-Id: <slrnbv1j9t.cd.abigail@alexandra.abigail.nl>

Marc Bissonnette (dragnet@internalysis.com) wrote on MMMDCCLXXIII
September MCMXCIII in <URL:news:Xns9460C40C08161dragnetinternalysisc@207.35.177.135>:
[]  Hi all;
[]  
[]  I'm hoping someone can point me in the direction of an FAQ or other 
[]  appropriate reading material in order to learn how to solve my problem. 
[]  
[]  I have users submitting multiple city names in a perl application and this 
[]  often results in multiple spellings, depending either on their local 
[]  dialect, mis-spellings, or copy-and-pasting from a micro$oft app. 
[]  
[]  For example, the city of Montréal has appeared as
[]  
[]  Montréal
[]  Montreal
[]  MontrÈal
[]  
[]  Or I'll get close-but-not-correct spellings, like 
[]  
[]  Ottawa (correct)
[]  Otawa
[]  Ottawaa
[]  Autawa
[]  
[]  etc. 
[]  
[]  How can I go about reducing the numbers of these incidences ? Providing 
[]  menus of all possible cities is not feasible, since there are multiple 
[]  areas within each province that each need a city list...


You might want to take a look at the Text::Soundex or the String::Approx
module. Or you could ask for a zip code instead of a city name.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'


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

Date: 29 Dec 2003 17:40:48 -0800
From: danmat347@hotmail.com (Dan)
Subject: Question on SET PATH
Message-Id: <1142a0be.0312291740.c464c53@posting.google.com>

I'm new to Perl and trying to figure out how to execute straight from
the C:\ prompt of the DOS window.  Currently i have to be in the
C:\Perl\Bin directory to run a script.  How can i use the SET PATH
command to run the scripts straight from the C prompt.  Thanks !!


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

Date: Tue, 30 Dec 2003 10:05:59 +0800
From: "Regent" <arthur0421@163.com>
Subject: Re: Question on SET PATH
Message-Id: <bsqmk5$7e2$1@mail.cn99.com>

I assume you installed Perl for Win32. During the installation you should have been told to add Perl to path, so that the system path contains "C:\Perl\Bin", so from any prompt you can run a script directly. I guess your problem is you didn't "add Perl to path". In that case you can manually add "C:\Perl\Bin;" to system path.

------------------------
  29 Dec 2003 17:40:48 -0800  £¬Dan wrote:
>I'm new to Perl and trying to figure out how to execute straight from
>the C:\ prompt of the DOS window.  Currently i have to be in the
>C:\Perl\Bin directory to run a script.  How can i use the SET PATH
>command to run the scripts straight from the C prompt.  Thanks !!

------------------------
             Regent
             arthur0421@163.com



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

Date: Mon, 29 Dec 2003 21:20:41 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Question on SET PATH
Message-Id: <0i5Ib.4095$Vl6.1050182@news20.bellglobal.com>


"Dan" <danmat347@hotmail.com> wrote in message
news:1142a0be.0312291740.c464c53@posting.google.com...
> I'm new to Perl and trying to figure out how to execute straight from
> the C:\ prompt of the DOS window.  Currently i have to be in the
> C:\Perl\Bin directory to run a script.  How can i use the SET PATH
> command to run the scripts straight from the C prompt.  Thanks !!

If you're running Win9x/Me, add the path to your autoexec.bat file. If
you're running one of the NT variants, go to the System settings in the
control panel, find your environment variables and add the path there.

Note also that unless you are on Win2k or XP (not sure about NT anymore),
you will always have to invoke your scripts by typing "perl myscript.pl". If
you are running Win2k or XP, and have files with a .pl extension registered
to be run by perl, you should be able to execute your script using only the
script's name (i.e., "myscript.pl").

Matt




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

Date: Tue, 30 Dec 2003 13:36:28 +1100
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Question on SET PATH
Message-Id: <3ff0e588$0$1727$5a62ac22@freenews.iinet.net.au>

Dan wrote:
> I'm new to Perl and trying to figure out how to execute straight from
> the C:\ prompt of the DOS window.  Currently i have to be in the
> C:\Perl\Bin directory to run a script.  How can i use the SET PATH
> command to run the scripts straight from the C prompt.  Thanks !!

set path=C:\Perl\bin;%path%

Cheers,
Rob


-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Tue, 30 Dec 2003 08:30:25 +0800
From: "Regent" <arthur0421@163.com>
Subject: Re[1]: Calling a scalar from another script using "require"
Message-Id: <bsqh0o$4a3$1@mail.cn99.com>


---------------------
  Mon, 29 Dec 2003 03:58:37 +0100  £¬Gunnar Hjalmarsson wrote:
>Those cannot have been Perl books... ;-)

 Well, those were books ABOUT Perl. The Perl books (to which I believe you refer) seem to discuss principles rather than specific problems, but I'm not much more than a newbie :((

>These are two ways to do what you want:
>
>     our $root;             # declares $root as a package global

  You mean in common.pl? I put this line in common.pl, but it seemed I had also to declare $root in script.pl, otherwise I still got a "Global symbol "$root" requires explicit package name" error. Then I tried "my $root;" in script.pl, but got a "Use of uninitialized value", though I had already expected this error msg. The problem seems to be how do declare $root AGAIN in script.pl, which sounds weird to me :(

>     require "common.pl";
>     print $root;
>
>or
>
>     require "common.pl";
>     print $main::root;     # explicit package name

   This worked! Thanks indeed, but what does $main here mean? "::" means the use of modules to me. BTW, $main::root appears to be a somewhat clumsy ;)

>
>(There is no need to quote the variable in the print statement.)
>
>--
>Gunnar Hjalmarsson
>Email: http://www.gunnar.cc/cgi-bin/contact.pl
>

             Regent
             arthur0421@163.com



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

Date: Tue, 30 Dec 2003 09:33:52 +0800
From: "Regent" <arthur0421@163.com>
Subject: Re[1]: Calling a scalar from another script using "require"
Message-Id: <bsqknq$6e8$1@mail.cn99.com>


------------------------
  Tue, 30 Dec 2003 01:58:53 +0100  £¬Gunnar Hjalmarsson wrote:
>Regent wrote:
>> Gunnar Hjalmarsson wrote:
>>>These are two ways to do what you want:
>>>
>>>    our $root;             # declares $root as a package global
>>
>>   You mean in common.pl?
>
>No, I mean in script.pl. Both my suggestions were intended for
>script.pl, while keeping common.pl as it is.

Okay, I see. If I use this method, I must declare all scalars in script.pl like this, right?

>>>    require "common.pl";
>>>    print $main::root;     # explicit package name
>>
>>    This worked! Thanks indeed, but what does $main here mean?
>
>$main::root means the global variable $root in package main.
>
>> "::" means the use of modules to me.
>
>When something begins with a '$' character, it's most likely a
>variable. You'd better do some reading:

Yup, I know the '$' well, but never used "::" in this way :p

>     http://www.perldoc.com/perl5.8.0/pod/perlmod.html
>
>-- 
>Gunnar Hjalmarsson
>Email: http://www.gunnar.cc/cgi-bin/contact.pl
>

------------------------
             Regent
             arthur0421@163.com



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

Date: Tue, 30 Dec 2003 09:48:30 +0800
From: "Regent" <arthur0421@163.com>
Subject: Re[1]: Calling a scalar from another script using "require"
Message-Id: <bsqli7$6sh$1@mail.cn99.com>


------------------------
  Mon, 29 Dec 2003 03:53:17 +0000 (UTC)  £¬David Efflandt wrote:
>If I just used -w switch (and put a newline in print "$root\n";),
>I got:
>
>Name "main::root" used only once: possible typo at ./mytest line 3.
>/root
>
>Inserting a use vars line got rid of the warning:
>
>use vars ('$root');
>require "common.pl";
>print "$root\n"
>
>If I used -wT, "." (current dir) was apparently excluded from @INC, so I
>had to use a full path to common.pl (same output).

Yeah, this is a problem. If common.pl isn't in one of the paths already indicated in @INC, I must specify its full path in every script, right?

>Tested in perl v5.6.1 built for i586-linux and v5.8.0 built for
>i586-linux-thread-multi
>
>-- 
>David Efflandt - All spam ignored  http://www.de-srv.com/
>PS: All mail referencing [1-9]63\.(com|net) is automatically dropped due
>to excessive uncontrolled spam.

------------------------
             Regent
             arthur0421@163.com



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

Date: Mon, 29 Dec 2003 23:44:33 GMT
From: Martijn Houtman <tinus@tinus.ath.cx>
Subject: Re: Regexp *-operator and multiple elements
Message-Id: <B%2Ib.80619$Jh.43454@amsnews03.chello.com>

Ragnar Hafstað wrote:

> "Ragnar Hafstað" <gnari@simnet.is> wrote in message
> news:bspvvd$45c$1@news.simnet.is...
>> @foobar =  ("foobarbarbarfoo" =~
>> /(foo(?=(?:bar)*foo)|\Gbar(?=(?:bar)*foo)|(?<=foo(?:bar))\Gfoo)/g;
> 
> ooops, the cut-and-paste failed to include the closing parens
> @foobar =  ("foobarbarbarfoo" =~
> /(foo(?=(?:bar)*foo)|\Gbar(?=(?:bar)*foo)|(?<=foo(?:bar))\Gfoo)/g);

Thanks, Gnari and Gunnar, for your suggestions. I fail to see what exactly
happens in the above example, though. I wished the answer would have been a
bit more trivial.

The problem is, the above might work for the above example, but my "real
life" situation is a bit more complex. Take a look at this url, if you're
interested: http://tinus.ath.cx/temp/form.txt. It's the code I currently
have. 

It's meant to be a .java-file parser. The idea of this uni assignment is to
have the script count a few certain keywords, like 'private', 'class',
'new' etc. in the .java-file. Now, @imports is supposed to catch the bits
surrounded by '( )' in the regexps. It does, but where the
multiplier-operator * is used, it just counts the last, as explained in my
previous, smaller example.

I know there might be a better way to count the keywords, but I would still
like to finish the parser as it is. Suggestions are very welcome.

Thanks again. Kind regards,
-- 
tinus.


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

Date: Tue, 30 Dec 2003 00:03:49 -0000
From: "Ragnar Hafstað" <gnari@simnet.is>
Subject: Re: Regexp *-operator and multiple elements
Message-Id: <bsqfdu$524$1@news.simnet.is>

"Martijn Houtman" <tinus@tinus.ath.cx> wrote in message
news:B%2Ib.80619$Jh.43454@amsnews03.chello.com...

> The problem is, the above might work for the above example, but my "real
> life" situation is a bit more complex. Take a look at this url, if you're
> interested: http://tinus.ath.cx/temp/form.txt. It's the code I currently
> have.
>
> It's meant to be a .java-file parser. The idea of this uni assignment is
to
> have the script count a few certain keywords, like 'private', 'class',
> 'new' etc. in the .java-file. Now, @imports is supposed to catch the bits
> surrounded by '( )' in the regexps. It does, but where the
> multiplier-operator * is used, it just counts the last, as explained in my
> previous, smaller example.
>
> I know there might be a better way to count the keywords, but I would
still
> like to finish the parser as it is. Suggestions are very welcome.

you might want to look at constructs like

$string=~s/somepattern_with_capture/func($1)/ge;

where func() is a sub that does your counting and optionally more
operations.
for example:
sub func {
    my  ($item)=@_;
    $counters{$item}++ if $countable{$item};
    return '' if deletable{$item};
    $item;
}

hashes like %countable and %deletable would be preset to
control what action to take.

gnari





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

Date: Tue, 30 Dec 2003 03:06:52 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: retrieve webpage with POST
Message-Id: <bsqn5g$eog5$1@ID-184292.news.uni-berlin.de>

Peter Scott wrote:
> Gunnar Hjalmarsson writes:
>> 
>>     my $req=HTTP::Request->new(POST=>$url);
>>     $req->content_type('application/x-www-form-urlencoded');
>>     $req->content('field=1&valid=yes');
> 
> This is unnecessarily fraught with danger.

Danger? In that case, the POD for LWP.pm is dangerous, because its
first example includes just those lines.

> It will fail the first time anyone tries to use values that ought
> to be URL escaped.

Yep, i.e. if you don't escape them first. I had already posted that
warning.

> And can you be certain without checking the source whether the
> Content-length header will be set correctly ?

Which source? I don't think it is set. Does it need to be? Again, see
LWP.pm.

I have at least noticed that the the remote server sets the
content-length environment variable.

> There is a clearly better alternative:
> 
> use HTTP::Request::Common;
> my $req = POST $url, [ field=>'1', valid=>'yes' ];

Yes, it seems to be a more convenient way that I wasn't aware of
before Tad mentioned it.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Tue, 30 Dec 2003 01:07:02 +0100
From: Torsten Mohr <tmohr@s.netic.de>
Subject: Re: Use a Perl_Interpreter and NOT call it my_perl?  Use TWO interpreters?
Message-Id: <bsqfj6$3ll$1@schleim.qwe.de>

Hi,

>> there are examples available
> Where? If we can't see code we can't comment

ok, you're right here.  Maybe it is a bit misleading what
i describe.  I'll try again:

In a self-written C program (not a script) i can do something like:

#include <EXTERN.h>
#include <embed.h>
#include <perl.h>

static Perl_Interpreter* my_perl;

in main() i can then do:

  my_perl = perl_alloc();
  perl_construct(my_perl);

A full example is "miniperlmain.c" in the official Perl
source tree.

There, a "Perl_Interpreter" is allocated and used.
Several macros are also used.  When i now try to
do the same in an own program and i call the
"Perl_Interpreter" NOT "my_perl", the program
simply does not compile.  I wonder if there's a
reason for this.

Also, i wonder if it is somehow still possible to
use TWO instances of "Perl_Interpreter".

I don't want to fork a subprocess or use threads in
the perl script itself, i'd like to use TWO instances
of Perl_Interpreter.

I hope this description makes it a bit clearer.


Thanks for any hints,
Torsten.



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

Date: Tue, 30 Dec 2003 02:56:08 +0000 (UTC)
From: "Bazajt" <Bazajt@NOSPAMMAGEbtopenworld.com>
Subject: Re: What is the Best Content Management System?
Message-Id: <bsqpg8$33t$1@sparta.btinternet.com>

I use PostNuke at www.xboxaddicts.co.uk since it has a good ongoing
community.
PHPNuke has slightly more modules but requires you to keep their copyright
details on your site.

Some others are:

http://www.e107.org
http://www.xoops.org


"Gu. Schmidt" <GSM@hotmail.com> wrote in message
news:3fd78b7c_2@news.bluewin.ch...
> Liberal schrieb:
> > There are a few in Perl and PHP, with MySQL or without and either in
> > Mod_Perl or not in.
> >
> > I have heard mason, but it does not have any demo site, but claims,
AMAZON
> > is using it.
> >
> > I also like PostNuke, but then there is a sister product caled PHPNuke
> >
> > I am looking for something simple but with a lot of plug-ins. I will not
use
> > many features, but like to have BBS/Forum and Classified Ads. I want it
> > simple, because I need to rewrite a lot of codes to include my current
Perl
> > program.
> >
> > What is my best choice?
> >
> >
> I prefer http://www.contenido.de/
>
> This CMS has been developed by professionals and the company later
> decided that it might be a good idea to give away this product for free.
>
>




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

Date: Tue, 30 Dec 2003 03:03:22 -0000
From: "William Tasso" <SpamBlocked@tbdata.com>
Subject: Re: What is the Best Content Management System?
Message-Id: <bsqpnm$fm0n$1@ID-139074.news.uni-berlin.de>

Bazajt wrote:
> I use PostNuke at www.xboxaddicts.co.uk ...

heads-up:  a rival for our notorious friend ;o)

-- 
William Tasso - http://WilliamTasso.com




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

Date: Mon, 29 Dec 2003 18:02:22 -0600
From: l v <lv@aol.com>
Subject: Re: writting an 'in' keyword for perl
Message-Id: <5g3Ib.4692$5M.99152@dfw-read.news.verio.net>

David K. Wall wrote:
> l v <lv@aol.com> wrote:
> 
> 
>>This would work:
> 
> 
> It didn't when I copied, pasted, and ran it.
> 
> 
>>@vals = (2 .. 10);
>>
>># change $val to 1 or 11 or 20 for testing method
>>$val = '10';
>>print "@vals\n$val\n\n";
>>
>>if ("@vals" =~ m/^$val$/) {
> 
> 
> This will never match unless @vals has only one element and that element is 
> the number we want.
> 
> To get it to work properly the regex should be /\b$val\b/.
> 
> 
> 
>>     print $&;
>>}
>>else {
>>     print "$val not in \@vals\n";
>>}
> 
> 
> 

Sorry about that -- good catch, David.  I was doing some testing and 
forgot to take out the anchors in the regexp before posting.

Greediness might muck it up so OP might needs to experiment with white 
space as you suggest with /\b$val\b/

As the OP did not post same code with what could be in @vals, so we are 
guessing at a solution.

Len



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

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


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