[29378] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 622 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 6 14:30:21 2007

Date: Fri, 6 Jul 2007 11:30:01 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Jul 2007     Volume: 11 Number: 622

Today's topics:
    Re: Lists in scalar context <nospam-abuse@ilyaz.org>
    Re: Lists in scalar context anno4000@radom.zrz.tu-berlin.de
    Re: Lists in scalar context <nospam-abuse@ilyaz.org>
    Re: Lost about SOAP::Lite <algis.m@gmail.com>
        mail::webmail::gmail question <dupont2br.ftphh@gmail.com>
    Re: mail::webmail::gmail question <mritty@gmail.com>
        new CPAN modules on Fri Jul  6 2007 (Randal Schwartz)
        new CPAN modules on Thu Jul  5 2007 (Randal Schwartz)
        Online banking robot (automate the logon with LWP) <hawkmoon1972@hotmail.com>
    Re: Online banking robot (automate the logon with LWP) <remay.uk@googlemail.com>
    Re: Overriding a class method with an object method <m@rtij.nl.invlalid>
    Re: Overriding a class method with an object method <ch.l.ngre@online.de>
    Re: Overriding a class method with an object method anno4000@radom.zrz.tu-berlin.de
    Re: Overriding a class method with an object method <m@rtij.nl.invlalid>
    Re: Overriding a class method with an object method anno4000@radom.zrz.tu-berlin.de
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 4 Jul 2007 20:02:17 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Lists in scalar context
Message-Id: <f6guc9$pee$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Tad McClellan 
<tadmc@seesig.invalid>], who wrote in article <slrnf8n35p.rf7.tadmc@tadmc30.sbcglobal.net>:

> It is impossible to return a list from a scalar context, because
> There Is No Such Thing As A List In Scalar Context.

You are confused.  There is absolutely no problem in creating a list
in scalar context.  However, the behaviour in this case is
"undefined": very few people know what happens in this situation, and
those who know want it to be changed (the current behaviour is just an
oversight - no developer realized what was happened until people
started to depend on this broken behaviour...).

> From perlfunc.pod:
> 
>    You can't get a list
>    like C<(1,2,3)> into being in scalar context, because the compiler knows
>    the context at compile time.  It would generate the scalar comma operator
>    there, not the list construction version of the comma.  That means it
>    was never a list to start with.

Irrelevant.  This is about comma operators, not about lists.

Hope this helps,
Ilya

P.S.  Yesterday, I checked the C-based modules shipped with 5.8.8, and
      only 2 of them (HiRes and POSIX) try to do something intelligent
      with returning lists in scalar context.

      All the rest (of those returning lists from XSUBs) just ignore
      the context - thus trigger the mentioned above "undefined" behaviour.

      Of course, I investigated this "not just for fun" - one of MY
      modules was doing the same, so MY script using this module was
      not actually doing what I expected it do.


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

Date: 5 Jul 2007 09:21:52 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Lists in scalar context
Message-Id: <5f3rhgF39aua4U1@mid.dfncis.de>

Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote in comp.lang.perl.misc:

[...]

> P.S.  Yesterday, I checked the C-based modules shipped with 5.8.8, and
>       only 2 of them (HiRes and POSIX) try to do something intelligent
>       with returning lists in scalar context.
> 
>       All the rest (of those returning lists from XSUBs) just ignore
>       the context - thus trigger the mentioned above "undefined" behaviour.

Ah... good idea.  I'll make the round over Hash::Util::FieldHash.  At
least one internal function could use a revision in this light.

Anno


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

Date: Thu, 5 Jul 2007 20:37:09 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Lists in scalar context
Message-Id: <f6jkpl$1ii1$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to

<anno4000@radom.zrz.tu-berlin.de>], who wrote in article <5f3rhgF39aua4U1@mid.dfncis.de>:
> Ilya Zakharevich  <nospam-abuse@ilyaz.org> wrote in comp.lang.perl.misc:
> 
> [...]
> 
> > P.S.  Yesterday, I checked the C-based modules shipped with 5.8.8, and
> >       only 2 of them (HiRes and POSIX) try to do something intelligent
> >       with returning lists in scalar context.
> > 
> >       All the rest (of those returning lists from XSUBs) just ignore
> >       the context - thus trigger the mentioned above "undefined" behaviour.
> 
> Ah... good idea.  I'll make the round over Hash::Util::FieldHash.  At
> least one internal function could use a revision in this light.

Thanks.  (Just grep for GIMME in POSIX to see how to do things.)

A significant part of the mess may be my fault: when I coded OUTLIST
keyword for XS, I did not realize that output of an XS in scalar
context is not defined.  If I did, I would just generate the necessary
code to behave "sanely" in scalar context.

E.g., currently XS code

   int TimeF(double *frac) { *frac = time_fractions_sec(); return time(); }

   int
   TimeF(OUTLIST double frac)

behaves fine in

 ($sec,$frac) = TimeF;
 ($sec)	      = TimeF;

but returns a mess in

  $sec	      = TimeF;		# YYYY $sec contains fractional part?

The "sane" behaviour, AFAIU, is for $sec= to have the same result as
($sec)=.  But now, it is probably too late to change the code
generator for OUTLIST...

[I just do not know whether many extensions currently rely on this
"YYYY" part.]

Yours,
Ilya

P.S.  The solution to fix it all is just to change XSRETURN(2) to "DO
      THE RIGHT THING" (e.g., just exchange two elements of stack in
      scalar context).  However, it *would* break a lot of extensions.

P.P.S. I found a backward-compatible way to modify behaviour:

	 PROTOTYPES: DISABLE SCALARCONTEXT

       behaves with the current xs processor the same as

         PROTOTYPES: DISABLE

       (same, of course, for ENABLE).  So one could use such a
       statement to switch to a "better" XS generation - without
       breaking the extension on older Perls.  Any better idea how to
       instruct XS parser that the intent is to get "better behavior"?


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

Date: Fri, 06 Jul 2007 10:15:43 -0000
From:  "algis.m" <algis.m@gmail.com>
Subject: Re: Lost about SOAP::Lite
Message-Id: <1183716943.046928.266270@n2g2000hse.googlegroups.com>

On Jun 28, 9:08 am, "John" <john1...@yahoo.com> wrote:
> "algis.m" <algi...@gmail.com> wrote in message
>
> news:1182700150.784691.89390@g4g2000hsf.googlegroups.com...
>
>
>
> > Hello everyone,
> > I'mlostaboutSOAP::Lite.
>
> > When I create aSOAPservice via
>
> > my $service =SOAP::Lite -> service($wsdl_location);
>
> > sometimes I get SSL timeout error, so I think I need to increase
> > timeout.
> > But when I do create service via:
>
> > my $service =SOAP::Lite -> proxy( $wsdl_location, timeout =>
> > $many_seconds );
>
> > I get error from mySOAPserver: "POST method is not supported".
>
> > I need to somehow solve this. Does anyone have any ideas?
>
> > -A.
>
> What is the WSDL location?  Is is private code or is it a public WSDL
> service you are connecting to?  Otherwise the code is OK.
>
> John

WSDL is located at ASK beta test server.
I guess I need to find a way to increase connection timeout without
using SOAP::Lite -> proxy() method.

- A.



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

Date: Thu, 05 Jul 2007 17:13:20 -0000
From:  "dupont2br@gmail.com" <dupont2br.ftphh@gmail.com>
Subject: mail::webmail::gmail question
Message-Id: <1183655600.589768.99420@57g2000hsv.googlegroups.com>

I am trying to use mail::webmail::gmail to automatically download all
attachments sent to a gmail account. i get daily reports and i want to
save the ZIP files attached to a local directory. I cannot figure out
how to save the attachment to a local directory once I have identified
messages with an attachment.  Here is my code so far:

Thanks for your suggestions,
Eric
_______________________________________________________________________________

#!/usr/bin/perl

use Mail::Webmail::Gmail;
use Archive::Extract;

my $user = $ARGV[0];
my $pass = $ARGV[1];
my $folder = 'INBOX';

my $gmail = Mail::Webmail::Gmail->new(
        username => $user, password => $pass,
        );

my $messages = $gmail->get_messages(
        label => $Mail::Webmail::Gmail::FOLDERS{ $folder }
        );

foreach ( @{$messages}) {
        my $email = $gmail->get_indv_email( msg => $_ );

        if ( defined( $email->{ $_->{ 'id' } }->{ 'attachments' } ) )
{
            foreach ( @{ $email->{ $_->{ 'id' } }-
>{ 'attachments' } } ) {

            ### not sure if this is proper way of getting attachment
             my $attach =  $gmail->get_attachment( attachment => $_ );

              ### not sure what to do here to save to local directory
              }
}



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

Date: Thu, 05 Jul 2007 10:22:50 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: mail::webmail::gmail question
Message-Id: <1183656170.855648.118630@57g2000hsv.googlegroups.com>

On Jul 5, 1:13 pm, "dupont...@gmail.com" <dupont2br.ft...@gmail.com>
wrote:
> I am trying to use mail::webmail::gmail

No such module found.  I'm assuming you meant Mail::Webmail::Gmail.
Case matters in Perl.

> to automatically download all
> attachments sent to a gmail account. i get daily reports and i want to
> save the ZIP files attached to a local directory. I cannot figure out
> how to save the attachment to a local directory once I have identified
> messages with an attachment.  Here is my code so far:

<snip>

>      ### not sure if this is proper way of getting attachment
>       my $attach =  $gmail->get_attachment( attachment => $_ );
>          ### not sure what to do here to save to local directory

According to the docs, get_attachment returns a reference to the data
of the attachment.  (For example, if it's a text file, the actual text
in the file).  So just open a new file on your machine and print the
data to it.

open my $att_fh, '>', 'attach.txt' or die $!;
print $att_fh ${$attach};
close $att_fh;

Hope that helps,
Paul Lalli



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

Date: Fri, 6 Jul 2007 04:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Jul  6 2007
Message-Id: <JKqqED.7u4@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Apache2-Tail-0.01
http://search.cpan.org/~gozer/Apache2-Tail-0.01/
mod_perl handler to display the error_log 
----
Apache2-Tail-0.02
http://search.cpan.org/~gozer/Apache2-Tail-0.02/
mod_perl handler to display the error_log 
----
AutoCons-0.01_05
http://search.cpan.org/~riddle/AutoCons-0.01_05/
Write a Construct file. 
----
B-Generate-1.09
http://search.cpan.org/~jjore/B-Generate-1.09/
Create your own op trees. 
----
Bundle-Dependencies-Catalyst-0.08
http://search.cpan.org/~ski/Bundle-Dependencies-Catalyst-0.08/
installs non-Catalyst prereqs 
----
Catalyst-Plugin-Cache-0.03
http://search.cpan.org/~nuffin/Catalyst-Plugin-Cache-0.03/
Flexible caching support for Catalyst. 
----
Catalyst-Plugin-Cache-Store-FastMmap-0.02
http://search.cpan.org/~nuffin/Catalyst-Plugin-Cache-Store-FastMmap-0.02/
DEPRECATED - FastMmap cache store for Catalyst::Plugin::Cache. 
----
DBD-Multi-0.10
http://search.cpan.org/~dwright/DBD-Multi-0.10/
Manage Multiple Data Sources with Failover and Load Balancing 
----
Data-Tabulate-0.03
http://search.cpan.org/~reneeb/Data-Tabulate-0.03/
Table generation! 
----
Dir-Project-3.011
http://search.cpan.org/~wsnyder/Dir-Project-3.011/
Project Environment determination 
----
Geo-GeoNames-0.05
http://search.cpan.org/~perhenrik/Geo-GeoNames-0.05/
Perform geographical queries using GeoNames Web Services 
----
IPC-Locker-1.471
http://search.cpan.org/~wsnyder/IPC-Locker-1.471/
Distributed lock handler 
----
Lingua-Cyrillic-Translit-ICAO-1.03
http://search.cpan.org/~stro/Lingua-Cyrillic-Translit-ICAO-1.03/
Cyrillic characters transliteration into ICAO Doc 9303 
----
Lingua-Multinational-Translit-ICAO-1.02
http://search.cpan.org/~stro/Lingua-Multinational-Translit-ICAO-1.02/
Multinational characters transliteration into ICAO Doc 9303 
----
MooseX-Method-0.29
http://search.cpan.org/~berle/MooseX-Method-0.29/
Method declaration with type checking 
----
MooseX-Method-0.30
http://search.cpan.org/~berle/MooseX-Method-0.30/
Method declaration with type checking 
----
Net-SFTP-Foreign-1.26
http://search.cpan.org/~salva/Net-SFTP-Foreign-1.26/
Secure File Transfer Protocol client 
----
Net-XMPP2-0.01
http://search.cpan.org/~elmex/Net-XMPP2-0.01/
An implementation of the XMPP Protocol 
----
Plugins-0.41
http://search.cpan.org/~muir/Plugins-0.41/
Generic plugins framework 
----
Pod-Manual-0.01
http://search.cpan.org/~yanick/Pod-Manual-0.01/
Aggregates several PODs into a single manual 
----
RSH-Logging-0.3.0
http://search.cpan.org/~mluker/RSH-Logging-0.3.0/
Utility for instrumenting code using Log::Log4perl. 
----
Search-Xapian-1.0.2.0
http://search.cpan.org/~olly/Search-Xapian-1.0.2.0/
Perl XS frontend to the Xapian C++ search library. 
----
Spreadsheet-SimpleExcel-1.6
http://search.cpan.org/~reneeb/Spreadsheet-SimpleExcel-1.6/
Create Excel files with Perl 
----
Sub-Exporter-0.975
http://search.cpan.org/~rjbs/Sub-Exporter-0.975/
a sophisticated exporter for custom-built routines 
----
Sub-Uplevel-0.15_01
http://search.cpan.org/~dagolden/Sub-Uplevel-0.15_01/
apparently run a function in a higher stack frame 
----
Test-Config-System-0.22
http://search.cpan.org/~iank/Test-Config-System-0.22/
System configuration related unit tests 
----
Test-Config-System-0.23
http://search.cpan.org/~iank/Test-Config-System-0.23/
System configuration related unit tests 
----
Test-GreaterVersion-0.009
http://search.cpan.org/~ggoldbach/Test-GreaterVersion-0.009/
Test if you incremented VERSION 
----
Text-Report-1.002
http://search.cpan.org/~davidius/Text-Report-1.002/
Perl extension for generating mixed columnar formatted reports and report templates 
----
WWW-Bugzilla3-0.1
http://search.cpan.org/~swined/WWW-Bugzilla3-0.1/
perl bindings for Bugzilla 3.0 API 
----
WWW-Bugzilla3-0.1.1
http://search.cpan.org/~swined/WWW-Bugzilla3-0.1.1/
perl bindings for Bugzilla 3.0 API 
----
WWW-Bugzilla3-0.2
http://search.cpan.org/~swined/WWW-Bugzilla3-0.2/
perl bindings for Bugzilla 3.0 API 
----
WWW-Facebook-API-v0.3.7
http://search.cpan.org/~unobe/WWW-Facebook-API-v0.3.7/
Facebook API implementation 
----
XML-XPathScript-1.50.1
http://search.cpan.org/~yanick/XML-XPathScript-1.50.1/
a Perl framework for XML stylesheets 
----
XML-XPathScript-1.51
http://search.cpan.org/~yanick/XML-XPathScript-1.51/
a Perl framework for XML stylesheets 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 5 Jul 2007 04:42:12 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jul  5 2007
Message-Id: <JKovqC.1ro@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-24-0.01
http://search.cpan.org/~cosimo/Acme-24-0.01/
Your favourite TV-show Acme module 
----
Apache2-ASP-1.15
http://search.cpan.org/~johnd/Apache2-ASP-1.15/
Perl extension for ASP on mod_perl2. 
----
App-CamelPKI-0.02
http://search.cpan.org/~grm/App-CamelPKI-0.02/
A multi-purpose PKI. 
----
Bundle-Complete-Catalyst-0.03
http://search.cpan.org/~ski/Bundle-Complete-Catalyst-0.03/
installs all Catalyst modules 
----
Bundle-Dependencies-Catalyst-0.07
http://search.cpan.org/~ski/Bundle-Dependencies-Catalyst-0.07/
installs non-Catalyst prereqs 
----
CPAN-Mini-0.562
http://search.cpan.org/~rjbs/CPAN-Mini-0.562/
create a minimal mirror of CPAN 
----
Catalyst-Helper-Model-MozRepl-0.01
http://search.cpan.org/~zigorou/Catalyst-Helper-Model-MozRepl-0.01/
Helper class for Catalyst::Model::MozRepl 
----
Catalyst-Model-MozRepl-0.01
http://search.cpan.org/~zigorou/Catalyst-Model-MozRepl-0.01/
Catalyst model to access mozilla using by MozRepl 
----
Catalyst-Model-XMLRPC-0.04
http://search.cpan.org/~fmerges/Catalyst-Model-XMLRPC-0.04/
XMLRPC model class for Catalyst 
----
Catalyst-Plugin-Form-Processor-0.03
http://search.cpan.org/~hank/Catalyst-Plugin-Form-Processor-0.03/
methods for processing forms with Form::Processor 
----
ClearPress-12
http://search.cpan.org/~rpettett/ClearPress-12/
simple, fresh & fruity MVC framework 
----
DBIx-Class-FrozenColumns-0.02
http://search.cpan.org/~syber/DBIx-Class-FrozenColumns-0.02/
Store virtual columns inside another column. 
----
Data-OptList-0.102
http://search.cpan.org/~rjbs/Data-OptList-0.102/
parse and validate simple name/value option pairs 
----
Genezzo-0.71
http://search.cpan.org/~jcohen/Genezzo-0.71/
an extensible database with SQL and DBI 
----
Geo-IP-1.28
http://search.cpan.org/~tjmather/Geo-IP-1.28/
Look up country by IP Address 
----
Google-Data-JSON-0.0.7
http://search.cpan.org/~takeru/Google-Data-JSON-0.0.7/
General XML-JSON converter based on Google Data APIs 
----
HTML-Menu-TreeView-0.6.8
http://search.cpan.org/~lze/HTML-Menu-TreeView-0.6.8/
----
HTTP-Server-Brick-0.0.9
http://search.cpan.org/~aufflick/HTTP-Server-Brick-0.0.9/
Simple pure perl http server for prototyping "in the style of" Ruby's WEBrick 
----
IO-Socket-SIPC-0.04
http://search.cpan.org/~bloonix/IO-Socket-SIPC-0.04/
Serialize perl structures for inter process communication. 
----
JSAN-ServerSide-0.05
http://search.cpan.org/~drolsky/JSAN-ServerSide-0.05/
Manage JSAN dependencies server side instead of with XMLHttpRequest 
----
Lingua-Cyrillic-Translit-ICAO-1.02
http://search.cpan.org/~stro/Lingua-Cyrillic-Translit-ICAO-1.02/
Cyrillic characters transliteration into ICAO Doc 9303 
----
Lingua-Multinational-Translit-ICAO-1.01
http://search.cpan.org/~stro/Lingua-Multinational-Translit-ICAO-1.01/
Multinational characters transliteration into ICAO Doc 9303 
----
Log-Handler-0.37
http://search.cpan.org/~bloonix/Log-Handler-0.37/
A simple handler to log messages to log files. 
----
MozRepl-0.06
http://search.cpan.org/~zigorou/MozRepl-0.06/
Perl interface of MozRepl 
----
Net-Google-GData-0.01
http://search.cpan.org/~ayoung/Net-Google-GData-0.01/
Handle basic communication with Google services 
----
Net-SSH-Expect-0.06
http://search.cpan.org/~bnegrao/Net-SSH-Expect-0.06/
SSH wrapper to execute remote commands 
----
OpenGuides-0.61
http://search.cpan.org/~dom/OpenGuides-0.61/
A complete web application for managing a collaboratively-written guide to a city or town. 
----
PAB3-3.1.5
http://search.cpan.org/~chrmue/PAB3-3.1.5/
Perl Application Builder / Version 3 
----
PAB3-DB-Driver-Mysql-1.0.6
http://search.cpan.org/~chrmue/PAB3-DB-Driver-Mysql-1.0.6/
Perl5 wrapper to the mysql5+ client libary and driver for the PAB3::DB class 
----
PAB3-DB-Driver-Postgres-1.0.6
http://search.cpan.org/~chrmue/PAB3-DB-Driver-Postgres-1.0.6/
Perl5 wrapper to the pgsql libary and driver for the PAB3::DB class 
----
PAB3-DB-Driver-Sqlite3-1.0.6
http://search.cpan.org/~chrmue/PAB3-DB-Driver-Sqlite3-1.0.6/
Perl5 wrapper to the libsqlite3 and driver for the PAB3::DB class 
----
Proc-Simple-1.22
http://search.cpan.org/~mschilli/Proc-Simple-1.22/
launch and control background processes 
----
SOAP-WSDL-2.00_03
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00_03/
SOAP with WSDL support 
----
SOAP-WSDL-2.00_04
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00_04/
SOAP with WSDL support 
----
Sub-Current-0.02
http://search.cpan.org/~rgarcia/Sub-Current-0.02/
Get the current subroutine 
----
Tk-Wizard-2.011
http://search.cpan.org/~mthurn/Tk-Wizard-2.011/
GUI for step-by-step interactive logical process 
----
WWW-Myspace-Data-0.12
http://search.cpan.org/~oalders/WWW-Myspace-Data-0.12/
WWW::Myspace database interaction 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 04 Jul 2007 14:33:48 -0700
From:  Tony <hawkmoon1972@hotmail.com>
Subject: Online banking robot (automate the logon with LWP)
Message-Id: <1183584828.347608.50800@57g2000hsv.googlegroups.com>

Hi there, I need a script that logs into the Barclays online banking
website. I don't understand the form - so the script below isn't
working just yet.

If you can get to page 2 of the logon process, I'll be impressed!
(Note you can put anything into the form on page 1.)


use LWP::UserAgent;
my $browser = LWP::UserAgent->new;
$browser->agent("test");

my $req = HTTP::Request->new(POST => "https://ibank.barclays.co.uk/olb/
x/LoginMember.do");

$req->content("action=Submit%20Membership
%20Number&servlet=startlogin&screenName=logonMember1i&surname=TEST&membershipNo=1234567&Next=true");

if ($res->is_success && $res->content =~ /Step 2 of 2/) {
     print "Great! I'm on page two!\n";
} else {
     print "Hmmm, I don't think it worked\n";
}



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

Date: Thu, 05 Jul 2007 00:18:11 -0000
From:  RobMay <remay.uk@googlemail.com>
Subject: Re: Online banking robot (automate the logon with LWP)
Message-Id: <1183594691.182264.320440@57g2000hsv.googlegroups.com>

On Jul 4, 10:33 pm, Tony <hawkmoon1...@hotmail.com> wrote:
> Hi there, I need a script that logs into the Barclays online banking
> website. I don't understand the form - so the script below isn't
> working just yet.

I've no idea if it works, but there is a Finance::Bank::Barclays
module on CPAN that might do what you want, or at least give you some
pointers.

http://search.cpan.org/~dave/Finance-Bank-Barclays-0.12/Barclays.pm

Regards,
Rob.



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

Date: Wed, 4 Jul 2007 23:02:52 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Overriding a class method with an object method
Message-Id: <pan.2007.07.04.21.03.06@rtij.nl.invlalid>

On Tue, 03 Jul 2007 18:49:33 +0000, anno4000 wrote:

> <eminencja@gmail.com> wrote in comp.lang.perl.misc:
>> On Jul 2, 10:11 pm, anno4...@radom.zrz.tu-berlin.de wrote:
>> >
>> > So you want a method that behaves one way when called as an object
>> > method and another way if called as a class method?
>> 
>> No, I want to create object Obj based on class P that overrides a
>> method defined in the class.
> 
> Your terminology is off.  Objects don't override methods, methods (in a
> client class) override methods (in a base class).  Your use of "class
> method" and "object method" is also off kilter.  This makes it hard to
> understand what you really want to do.

The terminology is off in Perlish, but it makes perfect sense in a 
greater context.

What you can do is define a subclass with the other method, then rebless 
the object into this new class. I'm not sure this would work, but I think 
it does.

Starting from there, one can use subroutine references or tricks with 
eval to make it even more generic.

HTH,
M4


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

Date: Thu, 05 Jul 2007 00:03:02 +0200
From: Ch Lamprecht <ch.l.ngre@online.de>
Subject: Re: Overriding a class method with an object method
Message-Id: <f6h5el$fif$1@online.de>

Koszalek Opalek wrote:
> Hello,
> 
> A method in the base class can be overridden in the derived class.
> My question is: can an _object_ override a method in its base class?
No

> I came up with the following solution (this is a new implementation
> of method meth() in the class P):
> 
> sub meth
> {
>     my $self = shift;
>     if ($self->{meth}) {
>         &{$self->{meth}};
>     } else {
>         print "This is a class method.\n";
>     };
> 
> };
> 
> Is there a more elegant way?

Here is an example with an attribute that holds a coderef.
It's a matter of taste, but I think 'use Moose' makes it more elegant ;)

use warnings;
use strict;
package MyClass;
use Moose;

has  behaviour => (isa     => 'CodeRef',
                    is      => 'rw',
                    default => sub {sub{print "my standard behaviour\n"}},
                );

sub show_behaviour{
     my $self = shift;
     $self->behaviour->();
}

package main;

my $inst = MyClass->new;
$inst->show_behaviour;

$inst->behaviour(sub{print "my special behaviour\n"});
$inst->show_behaviour;


-- 
use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
$c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop


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

Date: 5 Jul 2007 07:21:03 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Overriding a class method with an object method
Message-Id: <5f3kevF3af7cgU1@mid.dfncis.de>

Martijn Lievaart  <m@rtij.nl.invlalid> wrote in comp.lang.perl.misc:
> On Tue, 03 Jul 2007 18:49:33 +0000, anno4000 wrote:
> 
> > <eminencja@gmail.com> wrote in comp.lang.perl.misc:
> >> On Jul 2, 10:11 pm, anno4...@radom.zrz.tu-berlin.de wrote:
> >> >
> >> > So you want a method that behaves one way when called as an object
> >> > method and another way if called as a class method?
> >> 
> >> No, I want to create object Obj based on class P that overrides a
> >> method defined in the class.
> > 
> > Your terminology is off.  Objects don't override methods, methods (in a
> > client class) override methods (in a base class).  Your use of "class
> > method" and "object method" is also off kilter.  This makes it hard to
> > understand what you really want to do.
> 
> The terminology is off in Perlish, but it makes perfect sense in a 
> greater context.

How can it?  An apple can't override an orange, an object can't override
a method.  It's a conceptual mismatch.

> What you can do is define a subclass with the other method, then rebless 
> the object into this new class. I'm not sure this would work, but I think 
> it does.

If you re-bless the object the subclass relation becomes irrelevant.
(Btw, few OO languages support re-blessing the way Perl does.)

What you can do is create a base class that defines the "normal"
behavior, and a subclass that overrides the normal behavior with
a special one.  I've given an example of that upthread.  But then
it's a *method* in the subclass that overrides the base method.

> Starting from there, one can use subroutine references or tricks with 
> eval to make it even more generic.

I don't know what that means.

Anno


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

Date: Thu, 5 Jul 2007 19:35:36 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Overriding a class method with an object method
Message-Id: <pan.2007.07.05.17.35.46@rtij.nl.invlalid>

On Thu, 05 Jul 2007 07:21:03 +0000, anno4000 wrote:

> Martijn Lievaart  <m@rtij.nl.invlalid> wrote in comp.lang.perl.misc:
>> On Tue, 03 Jul 2007 18:49:33 +0000, anno4000 wrote:
>> 
>> > <eminencja@gmail.com> wrote in comp.lang.perl.misc:
>> >> On Jul 2, 10:11 pm, anno4...@radom.zrz.tu-berlin.de wrote:
>> >> >
>> >> > So you want a method that behaves one way when called as an object
>> >> > method and another way if called as a class method?
>> >> 
>> >> No, I want to create object Obj based on class P that overrides a
>> >> method defined in the class.
>> > 
>> > Your terminology is off.  Objects don't override methods, methods (in
>> > a client class) override methods (in a base class).  Your use of
>> > "class method" and "object method" is also off kilter.  This makes it
>> > hard to understand what you really want to do.
>> 
>> The terminology is off in Perlish, but it makes perfect sense in a
>> greater context.
> 
> How can it?  An apple can't override an orange, an object can't override
> a method.  It's a conceptual mismatch.

A class is a blueprint for the object, so it makes perfect sense to let 
an object override the default provided by the class.

> 
>> What you can do is define a subclass with the other method, then
>> rebless the object into this new class. I'm not sure this would work,
>> but I think it does.
> 
> If you re-bless the object the subclass relation becomes irrelevant.
> (Btw, few OO languages support re-blessing the way Perl does.)
> 
> What you can do is create a base class that defines the "normal"
> behavior, and a subclass that overrides the normal behavior with a

That's what I meant.

> special one.  I've given an example of that upthread.  But then it's a
> *method* in the subclass that overrides the base method.

Effectively providing the functionality the OP is after.

> 
>> Starting from there, one can use subroutine references or tricks with
>> eval to make it even more generic.
> 
> I don't know what that means.

That you can even generate those subclasses on the fly.

M4


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

Date: 6 Jul 2007 08:59:38 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Overriding a class method with an object method
Message-Id: <5f6ejqF3c2sopU1@mid.dfncis.de>

Martijn Lievaart  <m@rtij.nl.invlalid> wrote in comp.lang.perl.misc:
> On Thu, 05 Jul 2007 07:21:03 +0000, anno4000 wrote:
> 
> > Martijn Lievaart  <m@rtij.nl.invlalid> wrote in comp.lang.perl.misc:
> >> On Tue, 03 Jul 2007 18:49:33 +0000, anno4000 wrote:
> >> 
> >> > <eminencja@gmail.com> wrote in comp.lang.perl.misc:
> >> >> On Jul 2, 10:11 pm, anno4...@radom.zrz.tu-berlin.de wrote:
> >> >> >
> >> >> > So you want a method that behaves one way when called as an object
> >> >> > method and another way if called as a class method?
> >> >> 
> >> >> No, I want to create object Obj based on class P that overrides a
> >> >> method defined in the class.
> >> > 
> >> > Your terminology is off.  Objects don't override methods, methods (in
> >> > a client class) override methods (in a base class).  Your use of
> >> > "class method" and "object method" is also off kilter.  This makes it
> >> > hard to understand what you really want to do.
> >> 
> >> The terminology is off in Perlish, but it makes perfect sense in a
> >> greater context.
> > 
> > How can it?  An apple can't override an orange, an object can't override
> > a method.  It's a conceptual mismatch.
> 
> A class is a blueprint for the object,

No, that makes no sense.  Some *method(s)* (the creator methods) belonging
to a class can be said to make up a blueprint.  The class itself can
not accurately be described as a blueprint.

> so it makes perfect sense to let 
> an object override the default provided by the class.

What are you saying?  The OP didn't want to override a "blueprint" in
any sense, he wanted objects that behave differently when the same
method is invoked.

> >> What you can do is define a subclass with the other method, then
> >> rebless the object into this new class. I'm not sure this would work,
> >> but I think it does.
> > 
> > If you re-bless the object the subclass relation becomes irrelevant.
> > (Btw, few OO languages support re-blessing the way Perl does.)
> > 
> > What you can do is create a base class that defines the "normal"
> > behavior, and a subclass that overrides the normal behavior with a
> 
> That's what I meant.

It's also what I gave an example for in my reply to the OP.

Anno


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 622
**************************************


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