Re: 0; and 1;

2005-07-13 Thread Chris Devers
On Thu, 14 Jul 2005, Beast wrote: > I coudn't find any reference (yet) the meaning of 0; or 1; in the end > of perl program. In the absense of an explicit return statement, a block of Perl code will return the value of the last statement to any calling code. For an ordinary script, this doesn'

RE: Pass a value to Perl script

2005-07-13 Thread Dhanashri Bhate
-> -Original Message- -> From: Larsen, Errin M HMMA/Information Technology Department -> -> Hi Dhanashri, -> Thanks for responding Errin, but the question was from "Perl [EMAIL PROTECTED]" , not from me! :) -> tell us more about this 'APP'? Windows or UNIX (or other)? Is the -> 'APP

0; and 1;

2005-07-13 Thread Beast
I coudn't find any reference (yet) the meaning of 0; or 1; in the end of perl program. It means exit or return value? when I explicitly type "return 0;" it gives error, but when I give "exit 100;" the value of $$ isn't 100 anyway. -- --beast -- To unsubscribe, e-mail: [EMAIL PROTECTED]

How to programmatically exit Tk::MainLoop?

2005-07-13 Thread Siegfried Heintze
How do I programmatically and gracefully exit a TK GUI program? I was looking for a close function for MainWindow, but could find none. Thanks, Siegfried -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: each

2005-07-13 Thread Gerard Robin
On Wed, Jul 13, 2005 at 11:53:33AM -0700 John W. Krahn wrote: .. .. > You have two keys in the hash and you are calling each() twice which does > not > reset the iterator. You need to reset the iterator by either calling each() > until it returns nothing (undef) or by calling keys() or v

Re: Object persistence

2005-07-13 Thread Scott R. Godin
Jeff 'japhy' Pinyan wrote: On Jul 13, Scott R. Godin said: The original object itself is at http://www.webdragon.net/miscel/Subscriber.pm [snip] Additionally uploaded my skeleton starting ideas on Subscriber::DB at http://www.webdragon.net/miscel/DB.pm All Subscriber::DB objects would shar

Re: Object persistence

2005-07-13 Thread Scott R. Godin
Jeff 'japhy' Pinyan wrote: On Jul 13, Scott R. Godin said: The first thing you need to do is figure out the mapping from the old methods to the new methods. I'm not quite certain what you're getting at, here. You mean, which methods will get re-mapped to do things slightly differently for t

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Scott R. Godin said: The first thing you need to do is figure out the mapping from the old methods to the new methods. I'm not quite certain what you're getting at, here. You mean, which methods will get re-mapped to do things slightly differently for the DB version? Right. What

Re: Array of hashes

2005-07-13 Thread Scott R. Godin
Jeff 'japhy' Pinyan wrote: Here you want to do: foreach my $key (keys %$result) { since each element in @results is a hash-ref, and $result is an element from @results, you need to gets its keys. Since $result is a hash reference, you need to write %$result to get at the hash. I'v

Re: Object persistence

2005-07-13 Thread Scott R. Godin
Jeff 'japhy' Pinyan wrote: On Jul 13, Scott R. Godin said: The original object itself is at http://www.webdragon.net/miscel/Subscriber.pm Now updated some, as mentioned below :) (the Subscriber::DB object will need $database, $username, $password, a DBI $dbh handle, and possibly a $hostname

Re: Regular expressions and closing HTML tags

2005-07-13 Thread Wiggins d'Anconia
Chris Schults wrote: > I have a text string, with some HTML code, that I truncate (using substr). > In some instances, I truncate off some HTML close tags. > > In the case of anchor tags, I do this (please tell me if there is a more > elegant ay to do this!): > > if ($text =~ /\/) {$text .= '';}

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Jeff 'japhy' Pinyan said: # Subscriber::DB::get_greeting sub get_greeting { my ($self) = @_; my $id = $self->{_id}; $greeting_sql->bind_columns( \$self->{_salutation}, \$self->{_firstname}, \$self->{_lastname}, ); $greeting_sql->execute($id); It turn

Regular expressions and closing HTML tags

2005-07-13 Thread Chris Schults
I have a text string, with some HTML code, that I truncate (using substr). In some instances, I truncate off some HTML close tags. In the case of anchor tags, I do this (please tell me if there is a more elegant ay to do this!): if ($text =~ /\/) {$text .= '';} But I realized that this doesn't w

Re: Array of hashes

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, The Ghost said: foreach my $col (keys %{$ref}) { $results[$x]{$col}=$ref->{$col}; } $x++;} The @results array holds hash references... foreach my $result (@results) { foreach my $key (keys {$results[$x]}) { Here you want to do: foreach my $key (ke

Re: Array of hashes

2005-07-13 Thread John W. Krahn
The Ghost wrote: How can I get the information out of the hashes? sub somthing { while (my $ref = $sth->fetchrow_hashref()) { foreach my $col (keys %{$ref}) { $results[$x]{$col}=$ref->{$col}; } $x++;} return (@results); } Then later: (I don't understand this part

Re: each

2005-07-13 Thread John W. Krahn
Gerard Robin wrote: Hello, Hello, with perl 5.8 with this script: #!/usr/bin/perl #hash2.pl use warnings; use strict; my %where=( London => "England", Madrid => "Spain", ); print "-"x20, "\n"; my ($a, $b) = each %where; my ($c, $d) = each %where; print "$

Array of hashes

2005-07-13 Thread The Ghost
How can I get the information out of the hashes? sub somthing { while (my $ref = $sth->fetchrow_hashref()) { foreach my $col (keys %{$ref}) { $results[$x]{$col}=$ref->{$col}; } $x++;} return (@results); } Then later: (I don't understand this part) foreach my $re

Re: each

2005-07-13 Thread Stephen Mayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gerard, I believe the answer you are looking for is this from `perldoc -f each`: When the hash is entirely read, a null array is returned in list context (which when assigned produces a false (0) value), and "undef" i

each

2005-07-13 Thread Gerard Robin
Hello, with perl 5.8 with this script: #!/usr/bin/perl #hash2.pl use warnings; use strict; my %where=( London => "England", Madrid => "Spain", ); print "-"x20, "\n"; my ($a, $b) = each %where; my ($c, $d) = each %where; print "$a $b\n"; print "$c $d\n"; pr

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Jeff 'japhy' Pinyan said: Or you could have a set() method: sub set { my $self = shift; while (@_) { my ($field, $value) = @_; That should be: my ($field, $value) = (shift, shift); if (exists $self->{$field}) { $self->{$field} = $value } else { die

Re: Object persistence

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Scott R. Godin said: The original object itself is at http://www.webdragon.net/miscel/Subscriber.pm (the Subscriber::DB object will need $database, $username, $password, a DBI $dbh handle, and possibly a $hostname as well, in addition to the data stored in the Subscriber object, th

Komodo Question: How do you install a local copy of perl documentation?

2005-07-13 Thread Dave Adams
I am behind a firewall and I cannot get out to the internet and I want to integrate a local copy of perl documentation in the the IDE of Komodo, but the default is for it to go out to the internet to get it. Does anyone know how to configure this? Thanks in advance, Dave Adams -- To unsubscribe,

Object persistence

2005-07-13 Thread Scott R. Godin
This might be better suited for the DBI list, but primarily I'm interested in learning more about the things necessary to enable me to take an existing module's object and make its data persistent (via a mysql database) I've been giving thought to inheriting from the main module. Or not. in n

RE: Pass a value to Perl script

2005-07-13 Thread Larsen, Errin M HMMA/Information Technology Department
Perl wrote: > Dhanashri/ Chris > > Yes!! exactly that is what I am trying to do. I am sorry for not > making it clear before. here is the true picture. I have an APP which > can run a perl script but just before running the script I have a > variable in that app which is holding a value let say >

Re: Access __END__ from module/package

2005-07-13 Thread JupiterHost.Net
Jeff 'japhy' Pinyan wrote: On Jul 13, JupiterHost.Net said: In a script I can access __END__ via I'd like to access __END__ form within a module (IE package) Reading 'perldoc perldata' yields this: Text after __DATA__ but may be read via the filehandle "PACK- NAME::DATA", where "PA

Re: Pass a value to Perl script

2005-07-13 Thread Perl
Dhanashri/ Chris Yes!! exactly that is what I am trying to do. I am sorry for not making it clear before. here is the true picture. I have an APP which can run a perl script but just before running the script I have a variable in that app which is holding a value let say "c:\documents\test.pl" al

Re: Access __END__ from module/package

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, JupiterHost.Net said: In a script I can access __END__ via I'd like to access __END__ form within a module (IE package) Reading 'perldoc perldata' yields this: Text after __DATA__ but may be read via the filehandle "PACK- NAME::DATA", where "PACKNAME" is the package that was

Access __END__ from module/package

2005-07-13 Thread JupiterHost.Net
Howdy all, In a script I can access __END__ via I'd like to access __END__ form within a module (IE package) Foo.pm package Foo; use strict; use warnings; sub dofoo { print ; } 1; __END__ hello world in script: #!/usr/bin/perl use strict; use warnings; use Foo; Foo::dofoo(); shoul

RE: Regular Expressions

2005-07-13 Thread arjun.mallik
Hi , Use the expression/^G.*G$/ ^ > Denotes the beginning of the line $ -> denotes ending of the line if u dont want case sensitivity use/^G.*G$/i i --> ignores case sensitivity Arjun Deserve before you desire -Original Message- From: April T.Barrett [

RE: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Ankur Gupta said: Jeff 'japhy' Pinyan wrote: Is there any builtin function in perl to sort the above array based on uid, username or fulname? my @sorted = sort { $a->[0] <=> $b->[0] } @employees; Hey, This will sort only numbers. Will have no effect if the values have t

RE: sorting list of array

2005-07-13 Thread Ankur Gupta
Jeff 'japhy' Pinyan wrote: > On Jul 13, Beast said: > >> Jeff 'japhy' Pinyan wrote: >>> Is there any builtin function in perl to sort the above array based on uid, username or fulname? >>> >>> There is a built-in function to sort a list, yes. But the mechani

RE: sorting list of array

2005-07-13 Thread Ankur Gupta
Beast wrote: > I have an array: > > > my @employee = ( [29243, 'john', 'John doe'], > [24322, 'jane', 'Jane doe'], > [27282, 'james', 'James doe'] > ); > > > Is there any builtin function in perl to sort the above ar

Re: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Beast said: Jeff 'japhy' Pinyan wrote: Is there any builtin function in perl to sort the above array based on uid, username or fulname? There is a built-in function to sort a list, yes. But the mechanism by which to sort the list is, in this case, up to you to provide. This wo

Re: create a calender graphic

2005-07-13 Thread Dermot Paikkos
I guess I didn't look hard enough; Dave Cross's Calender::Simple looks like it will do most of the work for me. Dp. On 13 Jul 2005 at 11:03, Perl beginners wrote: > Hi, > > I am looking for a module that might help create a graphic of a > calender in the similar format to the unix cal function:

Require info on encoding iso-8859-16 on EBCDIC platform

2005-07-13 Thread Sastry
Hi I am getting strange result when I run this Perl Script on EBCDIC platform. The $enc_string contains >ñ=Á When I run the same on linux, I get the same string as "ravi". can someone enlighten me as how the encode method is supposed to work on? use Encode; $string = "ravi"; enc_string = encode(

Re: sorting list of array

2005-07-13 Thread Beast
Jeff 'japhy' Pinyan wrote: Is there any builtin function in perl to sort the above array based on uid, username or fulname? There is a built-in function to sort a list, yes. But the mechanism by which to sort the list is, in this case, up to you to provide. This works: my @sorted = so

Re: sorting list of array

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Beast said: my @employee = ( [29243, 'john', 'John doe'], [24322, 'jane', 'Jane doe'], [27282, 'james', 'James doe'] ); Is there any builtin function in perl to sort the above array based on uid, username or fulname? There is a built-i

RE: [Fwd: fetchrow_arrayref()]

2005-07-13 Thread Moon, John
Subject:fetchrow_arrayref() Date: Wed, 13 Jul 2005 11:08:00 +0100 From: David Foley <[EMAIL PROTECTED]> To: beginners@perl.org Hi Guys, I need help with this. Please find below some code: #!/usr/bin/perl -w # Reduce scripting errors + call DBI module use strict; us

Re: [Fwd: fetchrow_arrayref()]

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, David Foley said: my $SQLQ2a = "INSERT INTO dev (batman, robin) VALUES ($FirstName, $SecondName)"; #SQL Query 2 HANDLE my $SQLQ2 = $MySQL2->prepare($SQLQ2a); $SQLQ2->execute(); You should be using placeholders instead of actual values in your SQL query: my $SQLQ2a = "INSERT IN

Re: Regular Expressions

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Ing. Branislav Gerzo said: Thomas Bätzler [TB], on Wednesday, July 13, 2005 at 12:38 (+0200) made these points: that - for example - Begin and end with an "G" TB> while( $line =~ m/\W((g\w*?)|(\w*?g))\W/ig ){ this will print OR, he wants AND, so, change this regexp to: m/\W((g)\

sorting list of array

2005-07-13 Thread Beast
I have an array: my @employee = ( [29243, 'john', 'John doe'], [24322, 'jane', 'Jane doe'], [27282, 'james', 'James doe'] ); Is there any builtin function in perl to sort the above array based on uid, username or fulname? -- --beast --

Strip special characters

2005-07-13 Thread David Foley
<>

Re: Regular Expressions

2005-07-13 Thread Ing. Branislav Gerzo
Thomas Bätzler [TB], on Wednesday, July 13, 2005 at 12:38 (+0200) made these points: >> that - for example - Begin and end with an "G" TB> while( $line =~ m/\W((g\w*?)|(\w*?g))\W/ig ){ this will print OR, he wants AND, so, change this regexp to: m/\W((g)\w*\2)\W/ig -- How do you protect mail

RE: Regular Expressions

2005-07-13 Thread Thomas Bätzler
April T.Barrett <[EMAIL PROTECTED]> asked: > I need some tips on going about regular expression: > > parsing through a text file and printing all of the words > that - for example - Begin and end with an "G" Sample text courtesy of Project Gutenberg: #!/usr/bin/perl -w while( my $line = ){

Re: create a calender graphic

2005-07-13 Thread Randal L. Schwartz
> "Dermot" == Dermot Paikkos <[EMAIL PROTECTED]> writes: Dermot> I am looking for a module that might help create a graphic of a Dermot> calender in the similar format to the unix cal function: Dermot> The idea being that the user can click on a day and the date is Dermot> returned. I have

create a calender graphic

2005-07-13 Thread Dermot Paikkos
Hi, I am looking for a module that might help create a graphic of a calender in the similar format to the unix cal function: July 2005 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 The idea being that the u

Regular Expressions

2005-07-13 Thread April T . Barrett
Hello: I need some tips on going about regular expression: parsing through a text file and printing all of the words that - for example - Begin and end with an "G" Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

[Fwd: fetchrow_arrayref()]

2005-07-13 Thread David Foley
Original Message Subject:fetchrow_arrayref() Date: Wed, 13 Jul 2005 11:08:00 +0100 From: David Foley <[EMAIL PROTECTED]> To: beginners@perl.org Hi Guys, I need help with this. Please find below some code: #!/usr/bin/perl -w # Reduce scripting er

fetchrow_arrayref()

2005-07-13 Thread David Foley
<>