[27947] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9311 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 18 03:05:54 2006

Date: Sun, 18 Jun 2006 00:05:05 -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           Sun, 18 Jun 2006     Volume: 10 Number: 9311

Today's topics:
    Re: Activeperl and 3DES encryption - probably simple <tlviewerSHRUB@yahooCHENEY.com>
    Re: ANNOUNCE: WWW::YouTube krakle@visto.com
    Re: ANNOUNCE: WWW::YouTube <ermeyers@adelphia.net>
    Re: automate command line script using perl <hoosier45678@hotmail.com>
    Re: balanced paren regex's <xicheng@gmail.com>
    Re: balanced paren regex's <xicheng@gmail.com>
    Re: balanced paren regex's <xicheng@gmail.com>
    Re: balanced paren regex's <xicheng@gmail.com>
    Re: File::Find - passing argument to &wanted <hobosalesman@gmail.com>
    Re: File::Find - passing argument to &wanted <john@castleamber.com>
    Re: File::Find - passing argument to &wanted <Juha.Laiho@iki.fi>
        How to use threads? veg_all@yahoo.com
        new CPAN modules on Sun Jun 18 2006 (Randal Schwartz)
        question on "if () " <"v.niekerk at hccnet.nl">
    Re: question on "if () " <xicheng@gmail.com>
    Re: question on "if () " <corff@zedat.fu-berlin.de>
    Re: question on "if () " <john@castleamber.com>
    Re: reference to object method <sherm@Sherm-Pendleys-Computer.local>
    Re: reference to object method <hobosalesman@gmail.com>
    Re: windows mozilla perl helper app scripts <rvtol+news@isolution.nl>
    Re: YAPC::NA is approaching fast! <nobull67@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 18 Jun 2006 03:53:29 GMT
From: "tlviewer" <tlviewerSHRUB@yahooCHENEY.com>
Subject: Re: Activeperl and 3DES encryption - probably simple
Message-Id: <Z64lg.2690$MF6.2396@tornado.socal.rr.com>


"thomas" <tom@tom.com> wrote in message
news:HDrkg.55951$4L1.29666@newssvr11.news.prodigy.com...
> Hello everybody,
>
> I have to admit; I am not a perl programmer but I need to test that file
> encrypted by my program can be decrypted in unix environment using perl
> script.
> As far as I know Activeperl comes with libraries supporting 3DES
encryption.
>
> How would a script encrypting a file look like? It needs to take four
> parameters: input file, output file, encryption key and initialization
> vector - last two base 64 encoded.
>

thomas,

To Bart's comments let me add that in the Perl library (CPAN)
    3DES => Crypt::DES_EDE3
    AES =>    Crypt::Rijndael

To prepare for Unix interops, you can tryout the OpenSSH commandline utility
on Windows.
Download the latest version here
    www.openssl.org

a sample cmdline call might look like this
openssl des3 -p -a -iv 0000000000000000 -nosalt -kfile MyKey.key -in %f

hth,
tlviewer





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

Date: 17 Jun 2006 16:24:15 -0700
From: krakle@visto.com
Subject: Re: ANNOUNCE: WWW::YouTube
Message-Id: <1150586655.476444.104490@h76g2000cwa.googlegroups.com>


Dave wrote:
>I don't think YouTube is as widely known
> as you may believe. (I had never heard of it and am assuming it is some kind
> of video download site from what you are saying.)


YouTube is very widely known... Webshots to pictures is as known as
Videos to YouTube...



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

Date: Sat, 17 Jun 2006 20:02:39 -0400
From: "Eric R. Meyers" <ermeyers@adelphia.net>
Subject: Re: ANNOUNCE: WWW::YouTube
Message-Id: <FvidnQAhMuC_BQnZnZ2dnUVZ_v-dnZ2d@adelphia.com>

Dave wrote:

> As sincere as your efforts seem to be, there are a couple of problems with
> this posting:
> 
> 1) It is off topic for this group, which is a technical discussion group
> (see the posting guidelines)
> 

I apologize for the misposting. Any one who needs to attack me, please go to
modules instead, because that is where I'm currently being attacked. : )



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

Date: Sun, 18 Jun 2006 00:26:27 -0500
From: James <hoosier45678@hotmail.com>
Subject: Re: automate command line script using perl
Message-Id: <pan.2006.06.18.05.26.21.752649@hotmail.com>

On Fri, 16 Jun 2006 08:38:27 -0700, perlperl wrote:

> i installed expect-5.43 and tcl8.5a4 and saved both in C: if i try to run
> autoexpect, i get autoexpect is not recognized internal or external
> command

c:?  Didn't realize you were using cygwin:

http://www.cygwin.com/ml/cygwin/2004-06/msg00175.html

ah well.  it was OT anyway.  the other 5 methods mentioned would work just
as well.


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

Date: 17 Jun 2006 12:34:15 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: balanced paren regex's
Message-Id: <1150572855.274233.139080@f6g2000cwb.googlegroups.com>

ivowel@gmail.com wrote:
[snip]
> and I want to call a subroutine getnextsub() that first will return
>    "sub a {\n       if (1==1) { print \"true\"; } # if string or
> comment could contain unbalanced paren, even better\n   }"
> and on the next call will return
>    "sub b {\n       if (0) { print \"false\" }\n    }";
>
> this must be a fairly common problem (e.g., extracting tex macro
> arguments, etc.), but short of mimicking C in writing very low-level
> paren counter subroutines on individual characters, I cannot see how to
> solve this.  I do understand the issue of how to treat nested subs, but
> this right now is only a secondary concern.

Here is one way you may use(the iterator way from the book HOP):
#########################
use strict;
use warnings;

my $text= <<'END_TEST';
  { text }
   expressions
   sub a {
       if (1==1) { print "true"; } # if string or comment could contain
unbalanced paren, even better
   }
    more expressions
    sub b {
       if (0) { print "false" }
    }
    safdsf
END_TEST

local our $n;
# pattern to track embedded braces
my $pattern = qr/
    (?>  (?{$n = 0})
    (?:
        [^{}]
          |
        \{ (?{$n++})
          |
        \} (?(?{$n != 0}) (?{$n--}) | (?!) )
    )*
    )(?(?{$n != 0})(?!))
/x;

# set the iterator
my $it = getnextsub($text);
my $count = 0;

# loop through the text and print out all functions
while (my $next_sub =  $it->()) {
    print "Subroutine-", ++$count, " is:\n${next_sub}\n\n";
}

# subroutine to set the iteratior
sub getnextsub {
    my $text = shift;
    return sub {
        my $sub_def;
        if ($text =~ s/(sub\s*\S+\s*{$pattern})//) {
            $sub_def =  $1;
        }
        $sub_def;
    }
}
####################################



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

Date: 17 Jun 2006 16:52:02 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: balanced paren regex's
Message-Id: <1150588322.211754.226590@h76g2000cwa.googlegroups.com>

Xicheng Jia wrote:
> ivowel@gmail.com wrote:
> [snip]
> > and I want to call a subroutine getnextsub() that first will return
> >    "sub a {\n       if (1==1) { print \"true\"; } # if string or
> > comment could contain unbalanced paren, even better\n   }"
> > and on the next call will return
> >    "sub b {\n       if (0) { print \"false\" }\n    }";
> >
> > this must be a fairly common problem (e.g., extracting tex macro
> > arguments, etc.), but short of mimicking C in writing very low-level
> > paren counter subroutines on individual characters, I cannot see how to
> > solve this.  I do understand the issue of how to treat nested subs, but
> > this right now is only a secondary concern.
>
> Here is one way you may use(the iterator way from the book HOP):
> #########################
> use strict;
> use warnings;
>
> my $text= <<'END_TEST';
>   { text }
>    expressions
>    sub a {
>        if (1==1) { print "true"; } # if string or comment could contain
> unbalanced paren, even better
>    }
>     more expressions
>     sub b {
>        if (0) { print "false" }
>     }
>     safdsf
> END_TEST
>
> local our $n;
> # pattern to track embedded braces
> my $pattern = qr/
>     (?>  (?{$n = 0})
>     (?:
>         [^{}]
>           |
>         \{ (?{$n++})
>           |
>         \} (?(?{$n != 0}) (?{$n--}) | (?!) )
>     )*
>     )(?(?{$n != 0})(?!))
> /x;
>
> # set the iterator
> my $it = getnextsub($text);
> my $count = 0;
>
> # loop through the text and print out all functions
> while (my $next_sub =  $it->()) {
>     print "Subroutine-", ++$count, " is:\n${next_sub}\n\n";
> }
>
> # subroutine to set the iteratior
> sub getnextsub {
>     my $text = shift;
>     return sub {
>         my $sub_def;
>         if ($text =~ s/(sub\s*\S+\s*{$pattern})//) {
>             $sub_def =  $1;
>         }
>         $sub_def;
>     }
> }
> ####################################

BTW. you can make the subroutine "getnextsub" to skip any number of
function definitions.
#################
sub getnextsub {
    my $text = shift;
    return sub {
        my $num_subs = shift || 1;
        my ($sub_def, $cnt);
        while ($text =~ s/(sub\s*\S+\s*{$pattern})//) {
            if (++$cnt == $num_subs) {
                $sub_def = $1;
                last;
            }
        }
        return $sub_def || "undefined\n";
    }
}
################
# if you have subroutine definitions a, b, c, d, e, f
# and in that order, then

$it = getnextsub($text); # set the iterator
$next_sub =  $it->(); #get sub a {...}
$next_sub =  $it->(3); #get sub d {...}
$next_sub =  $it->(); #get sub e {...}
$next_sub =  $it->(2); #return "undefined"
$it = getnextsub($text); # reset the iterator

Xicheng :-)



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

Date: 17 Jun 2006 17:11:03 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: balanced paren regex's
Message-Id: <1150589463.046675.121890@g10g2000cwb.googlegroups.com>

Xicheng Jia wrote:
> Xicheng Jia wrote:
> > ivowel@gmail.com wrote:
> > [snip]
> > > and I want to call a subroutine getnextsub() that first will return
> > >    "sub a {\n       if (1==1) { print \"true\"; } # if string or
> > > comment could contain unbalanced paren, even better\n   }"
> > > and on the next call will return
> > >    "sub b {\n       if (0) { print \"false\" }\n    }";
> > >
> > > this must be a fairly common problem (e.g., extracting tex macro
> > > arguments, etc.), but short of mimicking C in writing very low-level
> > > paren counter subroutines on individual characters, I cannot see how to
> > > solve this.  I do understand the issue of how to treat nested subs, but
> > > this right now is only a secondary concern.
> >
> > Here is one way you may use(the iterator way from the book HOP):
> > #########################
> > use strict;
> > use warnings;
> >
> > my $text= <<'END_TEST';
> >   { text }
> >    expressions
> >    sub a {
> >        if (1==1) { print "true"; } # if string or comment could contain
> > unbalanced paren, even better
> >    }
> >     more expressions
> >     sub b {
> >        if (0) { print "false" }
> >     }
> >     safdsf
> > END_TEST
> >
> > local our $n;
> > # pattern to track embedded braces
> > my $pattern = qr/
> >     (?>  (?{$n = 0})
> >     (?:
> >         [^{}]
> >           |
> >         \{ (?{$n++})
> >           |
> >         \} (?(?{$n != 0}) (?{$n--}) | (?!) )
> >     )*
> >     )(?(?{$n != 0})(?!))
> > /x;
> >
> > # set the iterator
> > my $it = getnextsub($text);
> > my $count = 0;
> >
> > # loop through the text and print out all functions
> > while (my $next_sub =  $it->()) {
> >     print "Subroutine-", ++$count, " is:\n${next_sub}\n\n";
> > }
> >
> > # subroutine to set the iteratior
> > sub getnextsub {
> >     my $text = shift;
> >     return sub {
> >         my $sub_def;

=> >         if ($text =~ s/(sub\s*\S+\s*{$pattern})//) {

should change from  \s*  to  \s+, and \w+ is enough to replace \S+

         if ($text =~ s/(sub\s+\w+\s*{$pattern})//) {

Xicheng



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

Date: 17 Jun 2006 22:19:55 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: balanced paren regex's
Message-Id: <1150607995.728443.179750@i40g2000cwc.googlegroups.com>

Xicheng Jia wrote:
> Xicheng Jia wrote:
[snip]
> => >         if ($text =~ s/(sub\s*\S+\s*{$pattern})//) {
>
> should change from  \s*  to  \s+, and \w+ is enough to replace \S+
>
>          if ($text =~ s/(sub\s+\w+\s*{$pattern})//) {
>
one more modification:

    if ($text =~ s/.*?(sub\s+\w+\s*{$pattern})//) {

Xicheng



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

Date: 17 Jun 2006 13:21:11 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: File::Find - passing argument to &wanted
Message-Id: <1150575670.934856.25820@f6g2000cwb.googlegroups.com>

John Bokma wrote:
> Try to avoid camel case, since it will make your programs harder to read
> for quite some Perl programmers.

s/[a-z0-9]([A-Z0-9][a-z0-9]*)/'_'.lc($1)/ge;

That's my best attempt at a regex to convert my code. I don't think
there's anything this pattern would match that wasn't something I've
named or put in comments? I only use alphanumerics in names.



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

Date: 17 Jun 2006 20:56:20 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: File::Find - passing argument to &wanted
Message-Id: <Xns97E5A2224976Acastleamber@130.133.1.4>

"Hobo Salesman" <hobosalesman@gmail.com> wrote:

> John Bokma wrote:
>> Try to avoid camel case, since it will make your programs harder to
>> read for quite some Perl programmers.
> 
> s/[a-z0-9]([A-Z0-9][a-z0-9]*)/'_'.lc($1)/ge;
> 
> That's my best attempt at a regex to convert my code. I don't think
> there's anything this pattern would match that wasn't something I've
> named or put in comments? I only use alphanumerics in names.

There are refactoring modules at CPAN, haven't used any, so can't comment 
on how useful:

http://search.cpan.org/search?query=refactor&mode=all

The Devel one looks interesting though.

-- 
John Bokma          Freelance software developer
                                &
                    Experienced Perl programmer: http://castleamber.com/


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

Date: Sun, 18 Jun 2006 06:45:48 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: File::Find - passing argument to &wanted
Message-Id: <e72sqs$irq$2@ichaos2.ichaos-int>

"Hobo Salesman" <hobosalesman@gmail.com> said:
>Perl is my favourite language... but I'm actually a web designer/artist
>more than a programmer, so I find PHPs ease of use, integration with
>HTML, and mountain of available scripts/classes really attractive.

If by 'integration with HTML' you mean the ability to write mixed
HTML and PHP in a single file, then see HTML::EmbPerl on perl side.

For the second point, I think you're correct - in perl world there's
not nearly as many PHPNuke clones available as on the PHP side.
"Elementary" modules (doing for whatever "small" thing), however, I think
are more abundant in Perl (f.ex. how often would you like to be able
to generate PostScript (not just text but with graphics primitives) from
a web application).
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
-- 



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

Date: 17 Jun 2006 17:48:56 -0700
From: veg_all@yahoo.com
Subject: How to use threads?
Message-Id: <1150591735.968229.22370@u72g2000cwu.googlegroups.com>

Once a day my perl cgi script tars and zips up the customer data and
ftps it to a backup server. The script takes around 10 seconds to do
this but normally runs in less than a second. Is there a way I can use
threads to do the tarring and ftping parallel with the main script
execution?

I read perlthrtut but my perl installation does not seem to support the
functionality in it. Is there any workaround besides upgrading the perl
installation?



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

Date: Sun, 18 Jun 2006 04:42:05 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jun 18 2006
Message-Id: <J11H26.1uCq@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.

CGI-Auth-Basic-1.10
http://search.cpan.org/~burak/CGI-Auth-Basic-1.10/
Basic CGI authentication interface.
----
Class-Superclasses-0.02
http://search.cpan.org/~reneeb/Class-Superclasses-0.02/
Find all superclasses of a class
----
Event-ExecFlow-0.62
http://search.cpan.org/~jred/Event-ExecFlow-0.62/
High level API for event-based execution flow control
----
Finance-Bank-NetBranch-0.04
http://search.cpan.org/~kulp/Finance-Bank-NetBranch-0.04/
Manage your NetBranch accounts with Perl
----
Gtk2-Ex-FormFactory-0.64
http://search.cpan.org/~jred/Gtk2-Ex-FormFactory-0.64/
Makes building complex GUI's easy
----
HTML-GoogleMaps-5
http://search.cpan.org/~nmueller/HTML-GoogleMaps-5/
a simple wrapper around the Google Maps API
----
Java-JCR-0.05
http://search.cpan.org/~hanenkamp/Java-JCR-0.05/
Use JSR 170 (JCR) repositories from Perl
----
Log-Log4perl-1.05
http://search.cpan.org/~mschilli/Log-Log4perl-1.05/
Log4j implementation for Perl
----
MP3-M3U-Parser-2.20
http://search.cpan.org/~burak/MP3-M3U-Parser-2.20/
MP3 playlist parser.
----
Math-Cephes-0.43
http://search.cpan.org/~rkobes/Math-Cephes-0.43/
perl interface to the cephes math library
----
Module-Build-Convert-0.30
http://search.cpan.org/~schubiger/Module-Build-Convert-0.30/
Makefile.PL to Build.PL converter
----
Module-Compile-TT-0.01
http://search.cpan.org/~nuffin/Module-Compile-TT-0.01/
Preprocess Perl code with Template Toolkit and Module::Compile.
----
Net-Bluetooth-0.34
http://search.cpan.org/~iguthrie/Net-Bluetooth-0.34/
Perl Bluetooth Interface
----
Net-Bluetooth-0.35
http://search.cpan.org/~iguthrie/Net-Bluetooth-0.35/
Perl Bluetooth Interface
----
PDF-API2-Simple-1.0.4
http://search.cpan.org/~redtree/PDF-API2-Simple-1.0.4/
Simplistic wrapper for the excellent PDF::API2 modules
----
PITA-Test-Dummy-Perl5-Deps-1.00
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-Deps-1.00/
CPAN Test Dummy for PITA Makefile.PL installs
----
PITA-Test-Dummy-Perl5-MI-0.63
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-MI-0.63/
CPAN Test Dummy for testing Module::Install::With
----
PITA-Test-Dummy-Perl5-MI-0.6301
http://search.cpan.org/~adamk/PITA-Test-Dummy-Perl5-MI-0.6301/
CPAN Test Dummy for testing Module::Install::With
----
PITA-XML-0.30
http://search.cpan.org/~adamk/PITA-XML-0.30/
Create, load, save and manipulate PITA-XML files
----
POE-Wheel-UDP-0.02
http://search.cpan.org/~hachi/POE-Wheel-UDP-0.02/
POE Wheel for UDP handling.
----
Safe-Caller-0.02
http://search.cpan.org/~schubiger/Safe-Caller-0.02/
A nicer interface to caller() with code execution restriction
----
Text-NSP-0.93
http://search.cpan.org/~tpederse/Text-NSP-0.93/
The Ngram Statistic Package allows a user to count sequences of words in large corpora of text, and measure their association.
----
Text-NSP-0.95
http://search.cpan.org/~tpederse/Text-NSP-0.95/
The Ngram Statistic Package allows a user to count sequences of words in large corpora of text, and measure their association.
----
WWW-ConfixxBackup-0.02
http://search.cpan.org/~reneeb/WWW-ConfixxBackup-0.02/
Create Backups with Confixx and download them via FTP
----
WWW-Google-Video-0.3
http://search.cpan.org/~kenwu/WWW-Google-Video-0.3/
Fetch the Google Video Information
----
XML-Atom-Syndication-0.91
http://search.cpan.org/~tima/XML-Atom-Syndication-0.91/
a portable client for consuming RFC 4287 Atom Syndication Feeds.
----
XML-Atom-Syndication-0.92
http://search.cpan.org/~tima/XML-Atom-Syndication-0.92/
a portable client for consuming RFC 4287 Atom Syndication Feeds.


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: Sun, 18 Jun 2006 06:42:40 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: question on "if () "
Message-Id: <4494d70d$0$27542$e4fe514c@dreader29.news.xs4all.nl>

Hi,

I want to compare a variable with 1, but the code after "if" is executed 
anyway. This is the code immediately before "if":

	$bezorger = "select bezorger from hvw where lidnr = $record";
	$sth = $dbh->prepare($bezorger);
	$sth->execute or die "SQL Error: $DBI::errstr\n";
	@bezorger = $sth->fetchrow_array;
	print "Record: $record\n";
	print "Bezorger: @bezorger\n";
#	$bezorger = @bezorger;
	if (@bezorger == 1)
	{

I did "if ($bezorger == 1)" and "if (@bezorger == 1)" but neither seems 
to work. Do I miss something?

Thanks,

Huub


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

Date: 17 Jun 2006 22:17:20 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: question on "if () "
Message-Id: <1150607840.747651.159360@f6g2000cwb.googlegroups.com>

Huub wrote:
> Hi,
>
> I want to compare a variable with 1, but the code after "if" is executed
> anyway. This is the code immediately before "if":
>
> 	$bezorger = "select bezorger from hvw where lidnr = $record";

  select bezorger from hvw where lidnr = $record

coz by the above SQL command, you select only one field from your
table.. so the fetched array @bezorger conatian only one element at
each pass. :)

Xicheng



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

Date: 18 Jun 2006 06:09:56 GMT
From: <corff@zedat.fu-berlin.de>
Subject: Re: question on "if () "
Message-Id: <4fk91kF1ihenpU3@uni-berlin.de>

Huub <"v.niekerk at hccnet.nl"> wrote:

:         $bezorger = "select bezorger from hvw where lidnr = $record";

Your result will yield one line only.

: #       $bezorger = @bezorger;

Let @bezorger contain more than one scalar, then you probably want to say
$bezorger=@bezorger[0].

: I did "if ($bezorger == 1)" and "if (@bezorger == 1)" but neither seems 
: to work. Do I miss something?

if ($bezorger == 1) yields true if the scalar $bezorger is exactly equal to 
the numerical value 1.

if (@bezorger == 1) yields true if the array @bezorger contains exactly one
element, regardless of the numerical or textual value of that element.

Oliver.

-- 
Dr. Oliver Corff              e-mail:    corff@zedat.fu-berlin.de


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

Date: 18 Jun 2006 06:13:49 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: question on "if () "
Message-Id: <Xns97E6C8278637castleamber@130.133.1.4>

Huub <"v.niekerk at hccnet.nl"> wrote:

> Hi,
> 
> I want to compare a variable with 1, but the code after "if" is executed 
> anyway. This is the code immediately before "if":
> 
>      $bezorger = "select bezorger from hvw where lidnr = $record";
>      $sth = $dbh->prepare($bezorger);
>      $sth->execute or die "SQL Error: $DBI::errstr\n";
>      @bezorger = $sth->fetchrow_array;
>      print "Record: $record\n";
>      print "Bezorger: @bezorger\n";
> #     $bezorger = @bezorger;
>      if (@bezorger == 1)
>      {
> 
> I did "if ($bezorger == 1)" and "if (@bezorger == 1)" but neither seems 
> to work. Do I miss something?

Your question has already been answered, yet a few tips:

put:

use strict;
use warnings;

on top of your script.

Use prepared statements, especially if $record comes from outside your 
script (and check it, if it has an unexpected value, make your script die 
with an error).

Understand what @bezorger == 1 does, never try to guess / trial and error. 
The problem with that is that you learn guesses, and they might be wrong 
in some cases, adding to the confusion. It also results in cluttered code 
which is hard to read for someone who did do the hard work.


-- 
John Bokma          Freelance software developer
                                &
                    Experienced Perl programmer: http://castleamber.com/


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

Date: Sat, 17 Jun 2006 14:57:47 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: reference to object method
Message-Id: <m264izvcd0.fsf@Sherm-Pendleys-Computer.local>

"Hobo Salesman" <hobosalesman@gmail.com> writes:

> Uri Guttman wrote:
>> yeah, the OP's original issue is long lost in my skull. and i bet he
>> isn't reading this thread anymore!
>
> Actually I am, but lurking. ... I'm still getting familiar with the group
> so I'm doing more reading than posting.

An *excellent* attitude that's far too rare. Congratulations - you're one of
handful of Google Groups users who have managed to climb out of my killfile.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 17 Jun 2006 12:48:08 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: Re: reference to object method
Message-Id: <1150573688.667578.249590@r2g2000cwb.googlegroups.com>

Sherm Pendley wrote:
> An *excellent* attitude that's far too rare. Congratulations - you're one of
> handful of Google Groups users who have managed to climb out of my killfile.

Don't write off google groups users too soon, some (like me) know how
usenet works but have trouble finding a usenet provider that allows
posting. I also like being able to use my google groups account from
any machine. The downside is the extremely lousy interface, I can't
even figure out how to show the thread structure, it's all in a big
linear list.



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

Date: Sat, 17 Jun 2006 20:53:50 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: windows mozilla perl helper app scripts
Message-Id: <e71qd7.1d0.1@news.isolution.nl>

Philip schreef:

> Is there a way around this problem? Have I incorrectly set up perl?

See

  ASSOC /?

and

  FTYPE /?



On a W2K-system I get this:

C:\> assoc | find /i "perl"
 .pl=Perl


C:\> ftype | find /i "perl"
Perl="C:\Perl\bin\perl.exe" "%1" %*
PerlScriptFile=C:\WINNT\System32\WScript.exe "%1" %*

(I am not saying those settings are right)

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: 17 Jun 2006 16:05:03 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: YAPC::NA is approaching fast!
Message-Id: <1150585503.594997.40520@y41g2000cwy.googlegroups.com>

Uri Guttman wrote:

> if you haven't yet registered for yapc::na yet, you still have
> time. yapc is [...] the only pure perl conference out there.

Whilst it may be true that YAPC is the only pure perl conference out
there, it should be noted that YAPC::NA is not the only
YAPC::$Continent [1] out there!

There's been a YAPC::Asia already this year and YAPC::Europe  is
approaching fast too.

http://birmingham2006.com/

If you want you can even attend both NA and Europe! I'm going to do so,
but then again as an organiser of YAPC::Europe::2006 I don't expect to
get the chance to hear many of the talks.

[1] There are also some other YAPCs with only national scope.



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

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


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