[31544] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2803 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 5 00:09:23 2010

Date: Thu, 4 Feb 2010 21:09: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           Thu, 4 Feb 2010     Volume: 11 Number: 2803

Today's topics:
        activestate perlex: is it real? <fergus@twig.demon.co.uk>
    Re: activestate perlex: is it real? <rkb@i.frys.com>
    Re: activestate perlex: is it real? (Fergus McMenemie)
    Re: activestate perlex: is it real? <john@castleamber.com>
    Re: activestate perlex: is it real? <ben@morrow.me.uk>
    Re: function within qq{} sln@netherlands.com
    Re: function within qq{} sln@netherlands.com
    Re: function within qq{} <tzz@lifelogs.com>
    Re: function within qq{} sln@netherlands.com
        SpeedyCGI, clearing certain variables <jwcarlton@gmail.com>
        Website login <nickli2000@gmail.com>
    Re: Website login <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 4 Feb 2010 06:10:29 -0800 (PST)
From: fergus <fergus@twig.demon.co.uk>
Subject: activestate perlex: is it real?
Message-Id: <eaf14853-d18b-464e-a126-b1b548bf03cc@b10g2000yqa.googlegroups.com>

Hi,

I am attempting to develop code at a site using perlex. Having lots of
bother with meaningless messages in c:\Perl\bin\PerlEx-Err-002.log and
I figured I would
try and print some message to the log myself. But I could find no doc
or info on
how to write to the log files. Writing to STDERR has no effect.

But, surfing about I did find one or two postings to the effect that
perlex has been
discontinued.

Is this true? What is its status?

I am running perl v5.6.1 on vista sp 2




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

Date: Thu, 4 Feb 2010 06:53:51 -0800 (PST)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: activestate perlex: is it real?
Message-Id: <e8a147cc-160c-422c-b2e8-107ede7989fc@m24g2000prn.googlegroups.com>

On Feb 4, 6:10=A0am, fergus <fer...@twig.demon.co.uk> wrote:
> Hi,
>
> I am attempting to develop code at a site using perlex. Having lots of
> bother with meaningless messages in c:\Perl\bin\PerlEx-Err-002.log and
> I figured I would
> try and print some message to the log myself. But I could find no doc
> or info on
> how to write to the log files. Writing to STDERR has no effect.
>
> But, surfing about I did find one or two postings to the effect that
> perlex has been
> discontinued.
>
> Is this true? What is its status?
>
I have not used perlex, but if the official mailing list is any
indication, it would appear to be dead.  The last posting to the
mailing list was mid 2007.

http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perlex


> I am running perl v5.6.1 on vista sp 2

IMO, that's a bigger problem.

You should upgrade to at the very least 5.8 or preferably 5.10.


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

Date: Thu, 4 Feb 2010 21:51:27 +0000
From: fergus@twig-me-uk.not.here (Fergus McMenemie)
Subject: Re: activestate perlex: is it real?
Message-Id: <1jderrk.1ld7v4a1ebpt34N%fergus@twig-me-uk.not.here>

Ron Bergin <rkb@i.frys.com> wrote:

> > discontinued.
> >
> > Is this true? What is its status?
> >
> I have not used perlex, but if the official mailing list is any
> indication, it would appear to be dead.  The last posting to the
> mailing list was mid 2007.
> 
> http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perlex

Thanks for that. But there is definetly some FUD at work. After all
I came across this today:-

 http://docs.activestate.com/activeperl/5.10/PerlEx/Welcome.html

which has a copyright in the footer of 2009! Now 5.10 only arrived
in late 2007.

> 
> > I am running perl v5.6.1 on vista sp 2
> 
> IMO, that's a bigger problem.
> 
> You should upgrade to at the very least 5.8 or preferably 5.10.

If only it were my choice!


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

Date: Thu, 04 Feb 2010 16:32:15 -0600
From: John Bokma <john@castleamber.com>
Subject: Re: activestate perlex: is it real?
Message-Id: <873a1gaaz4.fsf@castleamber.com>

fergus@twig-me-uk.not.here (Fergus McMenemie) writes:

> Thanks for that. But there is definetly some FUD at work. After all
> I came across this today:-
>
>  http://docs.activestate.com/activeperl/5.10/PerlEx/Welcome.html
>
> which has a copyright in the footer of 2009! Now 5.10 only arrived
> in late 2007.

This is most likely an automatically added footer. Don't be surprised if
it says 2010 in a month or 2.

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development


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

Date: Thu, 4 Feb 2010 22:26:02 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: activestate perlex: is it real?
Message-Id: <q4ur37-c351.ln1@osiris.mauzo.dyndns.org>


Quoth fergus@twig-me-uk.not.here (Fergus McMenemie):
> Ron Bergin <rkb@i.frys.com> wrote:
> 
> > > discontinued.
> > >
> > > Is this true? What is its status?
> > >
> > I have not used perlex, but if the official mailing list is any
> > indication, it would appear to be dead.  The last posting to the
> > mailing list was mid 2007.
> > 
> > http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perlex
> 
> Thanks for that. But there is definetly some FUD at work. After all
> I came across this today:-
> 
>  http://docs.activestate.com/activeperl/5.10/PerlEx/Welcome.html
> 
> which has a copyright in the footer of 2009! Now 5.10 only arrived
> in late 2007.

Almost certainly the docs were all regenerated, and the copyright year
updated, when ActiveState rolled their release of 5.10.1 (which was
itself released in August 2009). 

> > > I am running perl v5.6.1 on vista sp 2
> > 
> > IMO, that's a bigger problem.
> > 
> > You should upgrade to at the very least 5.8 or preferably 5.10.
> 
> If only it were my choice!

You should point out to whoever makes that choice that both 5.6 and 5.8
are considered end-of-life and completely unsupported by p5p, and that
most CPAN authors are moving to a minimum supported perl version of
5.8.1. Any security holes in 5.6 or the modules you have for 5.6 will
likely never be fixed, and if there are any issues with Vista (and I
wouldn't be surprised if there were) they will also never be fixed.

Ben



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

Date: Wed, 03 Feb 2010 12:00:47 -0800
From: sln@netherlands.com
Subject: Re: function within qq{}
Message-Id: <8dkjm518tq5qes9m9kofb1ff11i2l8946s@4ax.com>

On Tue, 2 Feb 2010 08:01:14 -0800 (PST), cate <catebekensail@yahoo.com> wrote:

>I know you can do this, I just can't find it.
>How do you call a sub within a qq{} construct
>
>qq{The common term for H2O is chem("H2O").}
>
>Thank you
>
>(As soon is this post is complete... I'll find it) :-)

Its a little like the tail wagging the dog.
->  "The common term for %s is %s."
This doesen't change, so a sprintf is all you need.
Sometimes its a problem if you need to print the same thing
at different places in the program.

Taking your theme of qq(), you can split a message format string
from the data and consistently call a message formatter that puts
it all together.

This is just for example purposes. Should you need a full
blown formatter, there are probably dozens of safe ones on
Cpan.

-sln

---------------
use strict;
use warnings;


my $common_msg = qq{"The common term for '%s' is '%s'."};
my $chem_msg   = qq{"'%s' is the common term for '%s'."};
my %chemterms  = (
   'H20'  => 'water',
   'C02'  => 'carbon dioxide',
   '02'   => 'oxygen',
   'NaCL' => 'sodium chloride',
);
my %commonterms = reverse %chemterms;

##
for (sort keys %chemterms) {
	print getMsg($common_msg, $_, chem($_)), "\n";
}
for (sort keys %commonterms) {
	print getMsg($chem_msg, '\u'.$_, chem(-$_)), "\n";
}
exit 0;
##

sub chem {
	my ($key) = @_;
	return $commonterms{$key} || 'undefined' if $key =~ s/^-//;
	return $chemterms{$key} || 'undefined'
}
sub getMsg {
	my ($msg, @data) = @_;
	my $retval = '';
	my $evstr  = "\$retval = sprintf ($msg, ". "@{[map {qq(\"$_\",)} @data]}" .");";
	eval $evstr;
	return $retval;
}
__END__

The common term for '02' is 'oxygen'.
The common term for 'C02' is 'carbon dioxide'.
The common term for 'H20' is 'water'.
The common term for 'NaCL' is 'sodium chloride'.
'Carbon dioxide' is the common term for 'C02'.
'Oxygen' is the common term for '02'.
'Sodium chloride' is the common term for 'NaCL'.
'Water' is the common term for 'H20'.



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

Date: Wed, 03 Feb 2010 12:48:01 -0800
From: sln@netherlands.com
Subject: Re: function within qq{}
Message-Id: <tinjm5lfnqjoschsofumf6gj3g6r579oaa@4ax.com>

On Wed, 03 Feb 2010 12:00:47 -0800, sln@netherlands.com wrote:

>This is just for example purposes. Should you need a full
>blown formatter, there are probably dozens of safe ones on
>Cpan.
>
>	my $evstr  = "\$retval = sprintf ($msg, ". "@{[map {qq(\"$_\",)} @data]}" .");";

Shorter:
	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq(\"$_\",)} @data]} );";
or
	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq('$_',)} @data]} );";

if you don't want to interpolate @data's elements during eval.

-sln


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

Date: Thu, 04 Feb 2010 09:33:24 -0600
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: function within qq{}
Message-Id: <878wb9f22j.fsf@lifelogs.com>

On Wed, 03 Feb 2010 12:48:01 -0800 sln@netherlands.com wrote: 

s> On Wed, 03 Feb 2010 12:00:47 -0800, sln@netherlands.com wrote:
>> This is just for example purposes. Should you need a full
>> blown formatter, there are probably dozens of safe ones on
>> Cpan.
>> 
>> my $evstr  = "\$retval = sprintf ($msg, ". "@{[map {qq(\"$_\",)} @data]}" .");";

s> Shorter:
s> 	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq(\"$_\",)} @data]} );";
s> or
s> 	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq('$_',)} @data]} );";

s> if you don't want to interpolate @data's elements during eval.

That's like putting a band-aid on someone who's being electrocuted.
Yeah, it might help with the skin burns, but...

Ted


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

Date: Thu, 04 Feb 2010 07:51:45 -0800
From: sln@netherlands.com
Subject: Re: function within qq{}
Message-Id: <k1rlm51plfmhsfdd50opaifbig8b88t10t@4ax.com>

On Thu, 04 Feb 2010 09:33:24 -0600, Ted Zlatanov <tzz@lifelogs.com> wrote:

>On Wed, 03 Feb 2010 12:48:01 -0800 sln@netherlands.com wrote: 
>
>s> On Wed, 03 Feb 2010 12:00:47 -0800, sln@netherlands.com wrote:
>>> This is just for example purposes. Should you need a full
>>> blown formatter, there are probably dozens of safe ones on
>>> Cpan.
>>> 
>>> my $evstr  = "\$retval = sprintf ($msg, ". "@{[map {qq(\"$_\",)} @data]}" .");";
>
>s> Shorter:
>s> 	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq(\"$_\",)} @data]} );";
>s> or
>s> 	my $evstr  = "\$retval = sprintf ($msg, @{[map {qq('$_',)} @data]} );";
>
>s> if you don't want to interpolate @data's elements during eval.
>
>That's like putting a band-aid on someone who's being electrocuted.
>Yeah, it might help with the skin burns, but...
>
>Ted

You lost me. Something wrong with this?
Whats a better way?

-sln


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

Date: Thu, 4 Feb 2010 20:55:10 -0800 (PST)
From: Jason Carlton <jwcarlton@gmail.com>
Subject: SpeedyCGI, clearing certain variables
Message-Id: <9a938bf4-c4e4-4de8-881d-72d54c2d9e97@f15g2000yqe.googlegroups.com>

I have a rather lengthy CGI script that I wrote about 5 years ago, but
it's still functional. At the very beginning, though, it connects to a
database, then loads several variables. It would be nice if these
could stay persistent.

Rather than rewriting the whole thing, I'm thinking that it might be
simpler to use SpeedyCGI to just keep a connection open to these
static variables.

Is there a way for me to empty certain variables on each run?
Specifically, I'd like to undefine params and cookies. I thought that
this would work, but it didn't:

# Parse params into @contents
undef @params;
undef @contents;
@params = param;
@contents{@params} = map param($_) => @params;

# Fetch cookies, $id = $cookies{'ID'}->value;
undef %cookies;
%cookies = fetch CGI::Cookie;
foreach $key (keys %cookies) { $cookies{$key} = $cookies{$key}-
>value; }

TIA,

Jason


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

Date: Thu, 4 Feb 2010 11:01:59 -0800 (PST)
From: Ninja Li <nickli2000@gmail.com>
Subject: Website login
Message-Id: <6aa5666f-91a8-4b68-b8a8-979b4fd28297@t21g2000vbo.googlegroups.com>

Hi,

   I need to login to a website by entering username and password in
the Login fields.  Please advise on the best way to enter login
information using a perl script and perl package I should use.

   Thanks in advance.

   Nick Li


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

Date: Thu, 04 Feb 2010 13:06:35 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Website login
Message-Id: <slrnhmm6f6.nt7.tadmc@tadbox.sbcglobal.net>

Ninja Li <nickli2000@gmail.com> wrote:


> Please advise on the best way to enter login
> information using a perl script and perl package I should use.


http://search.cpan.org/~petdance/WWW-Mechanize-1.60/lib/WWW/Mechanize.pm#$mech-%3Ecredentials%28_$username,_$password_%29



-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2803
***************************************


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