[27971] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9335 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 21 18:06:10 2006

Date: Wed, 21 Jun 2006 15:05:06 -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           Wed, 21 Jun 2006     Volume: 10 Number: 9335

Today's topics:
    Re: Can not "signal_conect" using GTK2::GladeXML in win kpolston@gmail.com
    Re: extracting regular expressions kenslaterpa@hotmail.com
    Re: How to pronounce $ <hobosalesman@gmail.com>
    Re: How to pronounce $ <jgibson@mail.arc.nasa.gov>
    Re: How to pronounce $ <penryu@saiyix.ath.cx>
    Re: how to replace this like <img width=100 ...> with < krakle@visto.com
    Re: How to select subroutine <hoosier45678@hotmail.com>
        List context versus list context <blgl@stacken.kth.se>
    Re: List context versus list context <christoph.lamprecht.no.spam@web.de>
    Re: Looping through Class::Accessor accessors <dbasch@yahoo.com>
        multiple system calls running at the same time guser@packetstorm.org
    Re: question on printing to /dev/lp <"v.niekerk at hccnet.nl">
    Re: save image from url to file - how to? <bart.lateur@pandora.be>
    Re: use of uninitialized value (beginner) <mstep@t-online.de>
        What is a type error? <david.nospam.hopwood@blueyonder.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 21 Jun 2006 12:19:20 -0700
From: kpolston@gmail.com
Subject: Re: Can not "signal_conect" using GTK2::GladeXML in win32.
Message-Id: <1150917560.290595.83610@p79g2000cwp.googlegroups.com>

Hi
I too have this problem - did you ever find a fix?
Kevin
phus wrote:
> Hi all:
>    I write a perl script using gtk2-perl, i designed the GUI with
> Glade, so i add "using GTK2::GladeXML" in my script code.
>    everything goes well in Linux(perl-5.8.6), but i want the script can
> also run in win32. so i install activeperl-5.8.7 in win2000, install
> gtk-win32-2.8.18-rc1.exe, and install GTK2, GTK2::GladeXML   modules
> with ppm(a cpan clone in win32).
>    but when run the script, perl give me the error "Can't locate object
> method "signal_connect" via package "Gtk2::Window" at
> C:/Perl/site/lib/Gtk2/GladeXML.pm line 40."
>    i have no idea to deal with it.  
>    Thanks.



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

Date: 21 Jun 2006 11:30:15 -0700
From: kenslaterpa@hotmail.com
Subject: Re: extracting regular expressions
Message-Id: <1150914615.611540.258650@c74g2000cwc.googlegroups.com>


Dr.Ruud wrote:
> kenslaterpa@hotmail.com schreef:
>
> > use Warnings;
>
> YMM: use warnings ;
>
> --
> Affijn, Ruud
> 
> "Gewoon is een tijger."
Yes, thanks for the correction. Ken



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

Date: 21 Jun 2006 11:41:47 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: How to pronounce $
Message-Id: <1150915307.865206.174890@y41g2000cwy.googlegroups.com>

Ben Morrow wrote:
> Err... goto ?
>
> Now, GOSUB is a different matter... (/me cringes in recollection)

Goto is the same as gosub except it never returns.



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

Date: Wed, 21 Jun 2006 12:58:07 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: How to pronounce $
Message-Id: <210620061258074399%jgibson@mail.arc.nasa.gov>

In article <slrne9isrb.1h2f.penryu@ruri.saiyix>, Tim Hammerquist
<penryu@saiyix.ath.cx> wrote:

> Tim Hammerquist <penryu@saiyix.ath.cx> wrote:
> > AFAICT, the accepted standard, as mentioned elsewhere in this thread,
> > is "$tring" and "@rray".  Try that.
>       ^^^^^^
> >
> > And as for the lingering BASIC contamination, I know a great
> > therapist...
> 
> /me fires his therapist.

I think what you need is a little "deprogramming" :)

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Wed, 21 Jun 2006 21:22:33 GMT
From: Tim Hammerquist <penryu@saiyix.ath.cx>
Subject: Re: How to pronounce $
Message-Id: <slrne9je4p.1h2f.penryu@ruri.saiyix>

Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
> Tim Hammerquist <penryu@saiyix.ath.cx> wrote:
>> Tim Hammerquist <penryu@saiyix.ath.cx> wrote:
>> > AFAICT, the accepted standard, as mentioned elsewhere in this thread,
>> > is "$tring" and "@rray".  Try that.
>>       ^^^^^^
>> /me fires his therapist.
>
> I think what you need is a little "deprogramming" :)

NEW
OK
_

Tim Hammerquist


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

Date: 21 Jun 2006 13:07:33 -0700
From: krakle@visto.com
Subject: Re: how to replace this like <img width=100 ...> with <img width="100" ...>
Message-Id: <1150920453.158760.189310@m73g2000cwd.googlegroups.com>


Tad McClellan wrote:
> zhanye815@gmail.com <zhanye815@gmail.com> wrote:
> > i want to write a script to convert the html to xhtml,so i want to use
> > the regular expression to solve some problem like <img width=100
> > height=100...> converting into <img width="100" height="100"...>.how to
> > do it?
>
>
> I know how to do that.
>
> But it does not meet your requirement of using a regex so, never mind.
>

It isn't uncommon in the Computer Programming world to encounter people
who aren't good in social situations... Tad you are the prime example
of this... Very knowledgable guy but have no idea how to interact with
others in social conversations... It's not that you are rude... It's
just that you don't get out often so you are socially inexperienced..
There are others like you too... Geeks are geeks... They aren't exactly
known for their great social skills...

Let's go out and have a few beers buds! :)



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

Date: Wed, 21 Jun 2006 14:13:15 -0500
From: James <hoosier45678@hotmail.com>
Subject: Re: How to select subroutine
Message-Id: <pan.2006.06.21.19.13.09.775343@hotmail.com>

On Wed, 21 Jun 2006 16:20:45 +0000, Glenn Jackman wrote:

> At 2006-06-20 08:17PM, James <hoosier45678@hotmail.com> wrote:
>>  	my $output = handler{$function}->(@ARGUMENTS);
> missing $ -----------^

Good eye.  I didn't actually test it.



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

Date: Wed, 21 Jun 2006 22:18:36 +0200
From: Bo Lindbergh <blgl@stacken.kth.se>
Subject: List context versus list context
Message-Id: <e7c9it$i3l$1@news.su.se>

Consider this snippet:
{
    sub foo {
        print scalar(@_)," arguments\n";
    }

    foo((17)[2,1]);
    foo(my @foo=(17)[2,1]);
}

When run by my perl 5.8.8, it produces these two lines of output:
2 arguments
0 arguments

So there seems to be (at least) two kinds of list context,
one used for evaluating function arguments and another one used
for evaluating the rhs of an assignment.  I can't find any mention
of this in perldata.pod.  What's up?


/Bo Lindbergh


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

Date: Wed, 21 Jun 2006 23:28:17 +0200
From: Ch Lamprecht <christoph.lamprecht.no.spam@web.de>
Subject: Re: List context versus list context
Message-Id: <e7cdlh$ohc$1@online.de>

Bo Lindbergh schrieb:
> Consider this snippet:
> {
>     sub foo {
>         print scalar(@_)," arguments\n";
>     }
> 
>     foo((17)[2,1]);
this calls foo with two parameters

>     foo(my @foo=(17)[2,1]);

this assigns a slice containing an emty list to @foo and calls foo() with that.


try this, to see the difference:
      foo(my @foo=(17,3,6)[2,1]);

> }
> 
> When run by my perl 5.8.8, it produces these two lines of output:
> 2 arguments
> 0 arguments
> 
> So there seems to be (at least) two kinds of list context,
> one used for evaluating function arguments and another one used
> for evaluating the rhs of an assignment.  I can't find any mention
> of this in perldata.pod.  What's up?
> 
> 
> /Bo Lindbergh

Christoph
-- 

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"


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

Date: 21 Jun 2006 11:04:58 -0700
From: "Derek Basch" <dbasch@yahoo.com>
Subject: Re: Looping through Class::Accessor accessors
Message-Id: <1150913098.738267.220700@u72g2000cwu.googlegroups.com>

> However, the solution suddenly occured to me last night. I was
> declaring my accessors with the 'columns' function of the Class::DBI
> module. Therefore, there must be a hash or something somewhere to loop
> over. I found that Class::DBI objects have various column retrieval
> functions. I used the 'all_columns' function that returns the column
> names. Works great :).
>
>
> sub test {
>   my @gpsaccounts = Members::Gpsaccounts->search($user_id);
>   foreach my $row (@gpsaccounts) {
>     foreach my $column ($row->all_columns()) {
>       print $column . "\n";
>     }
>   }
>
> Derek Basch


Here's an improved version:

sub test {
  my @gpsaccounts = Members::Gpsaccounts->search($user_id);
  foreach my $row (@gpsaccounts) {
    foreach my $column ($row->columns()) {
      print $row->$column . "\n";
    }
  }



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

Date: 21 Jun 2006 14:13:33 -0700
From: guser@packetstorm.org
Subject: multiple system calls running at the same time
Message-Id: <1150924413.157164.146560@b68g2000cwa.googlegroups.com>

I have a program that acts as a scheduler and when items in the
database need to be updated it calls an external program.

Right now, it is slow as each call to the external program must finish
before control is returned to the scheduler program.

I read through ch 16 in the perl cookbook but I see nothing on running
multiple programs at once. The Advanced Perl programming book did not
seem to have anything on this either.

If this is possible, would someone post an example or direct me to
where I can read up on this?

thanks



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

Date: Wed, 21 Jun 2006 21:41:08 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: question on printing to /dev/lp
Message-Id: <4499a0d4$0$10186$e4fe514c@dreader16.news.xs4all.nl>

> 
> And now for something completely different... :-)
> 
> Have you had a look at the various CUPS modules on CPAN?
> 
> sherm--
> 

Now I have..thank you.


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

Date: Wed, 21 Jun 2006 19:12:12 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: save image from url to file - how to?
Message-Id: <of6j92h0ko7jq94ksdv3vdlm7u14gqmqif@4ax.com>

Oliver Bleckmann wrote:

>ich versuche einige png-Grafiken automatisch mit get ein eine Datei zu 
>schreiben,

Take a look at LWP::Simple. getstore() can save a file from a GET URL to
a local file.

-- 
	Bart.


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

Date: Wed, 21 Jun 2006 21:18:34 +0200
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: use of uninitialized value (beginner)
Message-Id: <C0BF682A.2619A%mstep@t-online.de>

On 21.06.2006 12:11, in article e7bd6f.14o.1@news.isolution.nl, "Dr.Ruud"
<rvtol+news@isolution.nl> wrote:

> ...

Thank you also to David! With your remarks it is working. I put indeed one
"my" declaration too much in front of the $wochentag, so this variable were
private ... 

I will have a look to the module you suggested Regexp::Common ... No I idea
what it will do, but I am always keen to learn my Perl.

My script is now like follows, if you have suggestions on style, or say
better basics, - I am unfortunately not yet there, what you call "style" -
please go ahead :-)

One remark for David as comment in the script ...

marek



#! /usr/bin/perl

use warnings;
use strict;

use Date::Calc qw(:all);


my $start_day = "01";
my $start_month = "06";
my $year = "2006";
my $day = $start_day;
my $month = $start_month;
my ($date, $wochentag);

my @lines;

while (<DATA>)
{
    s/,/./g;
    push @lines, $_ if (/^[\d.\t\s]+$/ || /^$/);
    

}

foreach my $line (@lines)
{
    if ($line =~ /^$/) # David: I am not sure how to avoid the check here,
because I have to calculate things, if the lines are *not* empty! But you
see as a good pupil I inserted a last else, as you suggested it :-)
    {
        add_one_day($year, $month, $day);
        print "$wochentag, $date: hurray, there is an empty line, but one
day more!\n";
    }
    elsif ($line=~ /[\d.\t]+/)
    {
        add_one_day($year, $month, $day);
        print "$wochentag, $date: hurray, there is some stuff to
calculate!\n\t$line\n";
    }
    else 
    {
        print "there is something wrong ...";
    }
}

sub add_one_day
{

    my $day_plus = 1;
    my ($year2, $month2, $day2) = Add_Delta_Days($year, $month, $day,
$day_plus);
    my $dow = Day_of_Week($year2,$month2,$day2);
    Language(Decode_Language("Deutsch"));
    my $lang = Language_to_Text(Language());
    $wochentag = Day_of_Week_Abbreviation($dow);
    $month2 = sprintf("%02d", $month2);
    $day2 = sprintf("%02d", $day2);
    $date = "$day2.$month2.$year2";
    ($day, $month, $year) = ($day2, $month2, $year2);
#    print "here for test reasons: $wochentag, $date, $year, $month,
$day\n\n";
    return ($wochentag, $date, $year, $month, $day);

}

__DATA__

27192,1    10882,6    591    16    6138,5
27476,3    10990,7    596    16    6298,8
27737,9    11146,8    301    16    6523,1
27775,2    11158,5    604    16    6553,4


28179,1    11362,1    611    16    6863,3
28489,7    11524,2    619    16    7116,7
28752,1    11683,2    624    16    7849,6
29191,3    11882,2    618    16    7622,8
29290,8    11961,2    633    16    7746,7

29549,4    12109,9    638    16    7964,0
29778,4    12180,8    640    16    8063,2
30172,2    12364,1    644    16    8321,0
30282,0    12416,7    647    16    8401,1
30483,5    12506,1    652    16    8541,2
30769,3    12668,7    660    16    8788,6
30992,9    12725,4    662    16    8873,2



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

Date: Wed, 21 Jun 2006 19:02:19 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: What is a type error?
Message-Id: <%Igmg.464974$xt.353729@fe3.news.blueyonder.co.uk>

Chris Uppal wrote:
> David Hopwood wrote:
> 
>> When people talk about "types" being associated with values in a "latently typed"
>> or "dynamically typed" language, they really mean *tag*, not type.
> 
> I don't think that's true.  Maybe /some/ people do confuse the two, but I am
> certainly a counter-example ;-)
> 
> The tag (if any) is part of the runtime machinery (or, if not, then I don't
> understand what you mean by the word), and while that is certainly a reasonably
> approximation to the type of the object/value, it is only an approximation,
> and -- what's more -- is only an approximation to the type as yielded by one
> specific (albeit abstract, maybe even hypothetical) type system.

Yes. I should perhaps have mentioned that people sometimes mean "protocol"
rather than "tag" or "type" (a protocol being the set of messages that an object
can respond to, roughly speaking).

> If I send #someMessage to a proxy object which has not had its referent set
> (and assuming the default value, presumably some variant of nil, does not
> understand #someMessage), then that's just as much a type error as sending
> #someMessage to a variable holding a nil value.

It's an error, certainly. People usually call it a type error. But does that
terminology actually make sense?

Typical programming languages have many kinds of semantic error that can occur
at run-time: null references, array index out of bounds, assertion failures,
failed casts, "message not understood", ArrayStoreExceptions in Java,
arithmetic overflow, divide by zero, etc.

Conventionally, some of these errors are called "type errors" and some are
not. But there seems to be little rhyme or reason to this categorization, as
far as I can see. If in a particular language, both array index bounds errors
and "message not understood" can occur at run-time, then there's no objective
reason to call one a type error and the other not. Both *could* potentially
be caught by a type-based analysis in some cases, and both *are not* caught
by such an analysis in that language.

A more consistent terminology would reserve "type error" for errors that
occur when a typechecking/inference algorithm fails, or when an explicit
type coercion or typecheck fails.

According to this view, the only instances where a run-time error should be
called a "type error" are:

 - a failed cast, or no match for any branch of a 'typecase' construct.
   Here the construct that fails is a coercion of a value to a specific type,
   or a check that it conforms to that type, and so the term "type error"
   makes sense.

 - cases where a typechecking/inference algorithm fails at run-time (e.g.
   in a language with staged compilation, or dynamic loading with link-time
   typechecking).

In other cases, just say "run-time error".

> If I then assign the referent
> of the proxy to some object which does understand #someMessage, then it is not
> a type error to send #someMessage to the proxy.  So the type has changed, but
> nothing in the tag system of the language implementation has changed.

In the terminology I'm suggesting, the object has no type in this language
(assuming we're talking about a Smalltalk-like language without any type system
extensions). So there is no type error, and no inconsistency.

Objects in this language do have protocols, so this situation can be described
as a change to the object's protocol, which changes whether a given message
causes a protocol error.

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


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

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


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