Re: variables and sql-statements within perlscripts

2009-09-28 Thread Lawrence Statton
On Sep 28, 2009, at 11:01 AM, Ruprecht Helms wrote: Hi, How have I to write the sql-statement if I want to use variables like this: Don't.http://xkcd.com/327/ The value of the variable can have the value of another recordsetloop or a value come from outsite the script. Regards,

Re: Ternary operator: Am I missing something?

2010-03-29 Thread Lawrence Statton
On Mar 29, 2010, at 10:54 AM, r...@i.frys.com wrote: I looked through perlop and was unable to find where it stated that the ternary operator should only be used in an assignment such as you've shown. Can you point out where that's located. In my reasonably-arrogant opinion: That's kind of

Re: reference to subroutine???

2008-03-27 Thread Lawrence Statton
sanket vaidya wrote: >Whereas the output on perl 5.6.1 is > >Hello!!1 Ummm, beg to differ #!/usr/bin/perl use strict; use warnings; sub hello; my $ref = \&hello; &{$ref}; sub hello { print "hello!!"; } [EMAIL PROTECTED]:~$ perl -l pbml.pl hello!! [EMAIL PROTECTED]:~$ perl -v This is

Re: diff says memory exhausted need help with perl

2008-03-28 Thread Lawrence Statton
If you're using Gnu diff (i.e. the diff that comes with most Linuces) --speed-large-files might help you, without having to jump through a perl hoop. --L -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: $o->document vs $o->document()

2008-10-08 Thread Lawrence Statton
> I am using a module having documentation saying document() is a > method. However, I see it used as > > $o->document; > > Can you reference a method in this way? (I takes no args). I always > thought > > $o->document() and $o->document meant different things, function > verses attribute. >

Re: How to check empty hash value properly?

2008-10-08 Thread Lawrence Statton
> This distinction between canonical existence and logical existence--or > perhaps more properly the distinction between the existence of an > element and of a position--is important because, while useful, the > distinction does have implications for the value of $#array, the > return value of scal

Re: match and putting in a variable with a single statement

2008-10-24 Thread Lawrence Statton
> > I was just trying to match a string and save it in a single statement > as follows: > > $extracted = "cp xyz"; > $state_var = $extracted =~ m/cp\s+(.*)/; > print "$state_var $1 \n"; > > The output is: 1 xyz > > So the assignment to $state_var does not work. Is this an incorrect way. > The

Re: Question on subroutines

2004-11-30 Thread Lawrence Statton
On Tue, 30 Nov 2004 23:33:39 +, Jonathan Paton <[EMAIL PROTECTED]> wrote: > Dave, > > Yes, look up references in your books. > > E.g. > > sub example { > my @data = qw; > return [EMAIL PROTECTED]; > } > > my $reference = example(); > > for my $word (@{ $reference }) { > print "

Re: Search Tab-delimited file for Null fields

2004-12-01 Thread Lawrence Statton
John Krahn wrote: > Debbie Cooper wrote: > > my @empty = (); > > my @headings = (); > > Aggregate variables created with my() are empty by default so assigning an > empty list to them is redundant. > I hope I am not opening a can of worms by getting into a style disucssion, and I will preface t

Re: Reading external file. Open files from listing and do a search and replace then continue...

2004-12-01 Thread Lawrence Statton
> > Sure...if I know someone can do the job. I'll just go to rentacoder.com > > I'd be more than happy to consult for your Perl needs, send me an email > off list if you're interested. > > >>If not, "steal it from the market" might be more apt. > > > > > > So you don't take examples you find o

Re: Reading external file. Open files from listing and do a search and replace then continue...

2004-12-01 Thread Lawrence Statton
> > Got it so far. > > open CHECKFILE, "< file.in" or die qq(Cannot open file "file.in": $!); > @filecontent = ; > foreach $line (@filecontent) { > print " $line"; > } > close (INFILE); > > > The input file (list of files) looks something like this: > > P: 1

Re: pdf 2 bmp

2004-12-02 Thread Lawrence Statton
::Magick provides a Perl implementation that will call ghostscript for you. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions.

Re: Checking if a scalar value is a number or not

2004-12-02 Thread Lawrence Statton
$phrase = 'Anna would like a banana'; my ($greedy) = $phrase =~ /(.*)na/; my ($nongreedy) = $phrase =~ /(.*?)na/; print "Greedy: $greedy \nNongreedy: $nongreedy \n"; produces the output Greedy: Anna would like a bana Nongreedy: An -- -- -- -- -- -- -- -- -- -- -- -

Re: Making hash from two arrays

2004-12-02 Thread Lawrence Statton
ords (and THAT , class, is why embedded blanks in hash keys for positional parameters is a Bad Idea - because you can't use qw//) So, if instead of two parameters I had to pass a handful of parameters: some_graphic_function ( @opt{ qw / x_position y_position radius line_style color depth /

Re: [ADMIN] Re: Reading external file. Open files from listing and do a searc h and replace then continue...

2004-12-02 Thread Lawrence Statton
> Casey West wrote: > > It was Wednesday, December 01, 2004 when Gunnar Hjalmarsson took the > > soap box, saying: > >> Casey West wrote: > >>> The original question was places squarely within reasonable query > >>> boundaries. > >> > >> What do you refer to as "the original question"? To me it's

Re: [ADMIN] Re: Reading external file. Open files from listing and do a searc h and replace then continue...

2004-12-02 Thread Lawrence Statton
on is required or warranted. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: ftp script

2004-12-02 Thread Lawrence Statton
set binary mode. $ftp->binary || die "Could not set binary mode", $ftp->message; warn "Bin mode set ... " ; # # Now we are ready to get the file we want # $ftp->get('random_file.jpg') || die "Get failed ", $ftp->message; warn "Get c

META: Unreliable delivery

2004-12-02 Thread Lawrence Statton
rs later. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail

Re: Passing hashes as parameters to construct objects

2004-12-02 Thread Lawrence Statton
> > Is it something like: > [snippage snipped] > > TIA! > > > Regards, > Not a hash reference, a hash ... sub method { my ($class, %opt) = @_ ; . . . } -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL

Re: Making hash from two arrays

2004-12-02 Thread Lawrence Statton
*IS* much faster, but always leaves me with the feeling that it's overly obfuscated. (Although maybe if I forced myself to use it more often I'd be more comfortable with it... ) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/a

Re: $ID = $newcook{'usrID'}->value;

2004-12-03 Thread Lawrence Statton
n empty string if there is no cookie $ID = $newcook{usrID}->value if ref($newcook{usrID}); # if there is no cookie, $ID will be untouched (maybe undef?) $ID = ( ref($newcook{usrID} ? $newcook{usrID}->value : 'no cookie set yet' ); # $ID will get *SOME* value you can change

Re: Spam:Re: using $! for die()ing with Package function

2004-12-03 Thread Lawrence Statton
k and friends, or even taking the bigger step and start throwing exceptions. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. --

Re: setting more than 1 -domain=> in cookies

2004-12-03 Thread Lawrence Statton
I bring this up: You're going to spend a lot of effort to debug your cookie problem, perhaps to find later that some large segement of your population doesn't permit cookies). -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s

Re: perl questions.

2004-12-04 Thread Lawrence Statton
* another corner of Perl to explore, even if you've been living there for a long time. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal propo

Re: Tabulate data in a sequential file

2004-12-04 Thread Lawrence Statton
he line if ( my ($key, $value) = /(.*): (.*)$/) { warn "Got $value for $key"; push @{$data{$key}}, $value; } } warn Dumper \%data; __DATA__ key1: data1a key2: data2a key3: data3a key1: data1b key2: data2b key3: data3b .END PERL PROGRAM ..

Re: stat and chmod safety and prtability

2004-12-04 Thread Lawrence Statton
e) ", sprintf("%o", $mode),"\n" ; ... END PERL PROGRAM ....... -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components:

Re: Tabulate data in a sequential file

2004-12-04 Thread Lawrence Statton
d work: print join("\t", @key ),"\n"; my $stop; until ( $stop ) { $stop = 1; foreach my $key ( @key ) { print shift @{$data{$key}} || '', "\t"; undef $stop if @{$data{$key}}; } print "\n"; } I've had too many

Re: close (...) or die "$!"

2004-12-04 Thread Lawrence Statton
a previous read or write operation, the OS may post an error when you attempt to close. Another possibility (although far-fetched): What if the filesystem goes away while you had it open? -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTEC

close or die() semantics

2004-12-04 Thread Lawrence Statton
. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: a warning which i can't understand

2004-12-04 Thread Lawrence Statton
Green Yellow Blue Rojo Verde Amarillo Azul Red Green Yellow Blue Rojo Verde Amarillo Azul Red Green Yellow Blue Red Green Yellow Blue Rojo Verde Amarillo Azul -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software

Re: Useless use of numeric gt (>) in void context and Useless use of private variable in void context

2004-12-05 Thread Lawrence Statton
Why don't you try trimming everything out except the block that encloses line 382 and post that. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zero

Re: Trouble with compound regular expression matching

2004-12-06 Thread Lawrence Statton
> Okay, now I have to admit I'm also new to Perl, but I can adapt to change: > > /^.*\.[tj][pi][gfe].{0,1}$/i > > I threw in the quantifier to avoid what Felix exposed. Now, there's > probably a hole in this somewhere, but it's got to be a small one... > > -Paul > Zeroth: It would better

Re: ip4 check

2004-12-07 Thread Lawrence Statton
($var)) { > print "your variable is a number $var\n"; > } else { > print "number $var is not a number\n"; > } 1) Read perldoc Net::IPv4Addr 2) change ipv4_checkip to ipv4_chkip -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: Need Help Installing DBI-1.46

2004-12-07 Thread Lawrence Statton
use) or (b) explicitly pass it to make. make CC=/opt/bin/gcc -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To uns

Re: Variables and MySQL

2004-12-08 Thread Lawrence Statton
" My gut (and many years of experience) tells me "putting a big fat database select in the middle of your route selection code is going to be a performance pig". Caching, caching, caching. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence

Re: Variables and MySQL

2004-12-08 Thread Lawrence Statton
Aww, dangit --- I should have not used __TARGET__ as the replacement tag -- there is just too much room for confusion with reserved words like __PACKAGE__ or __LINE__ ... Everyone take out your erasers and change that to --TARGET-- please :) --L -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Help with cookies

2004-12-08 Thread Lawrence Statton
#x27;name' => 'cookie', 'path' => '/' }, 'CGI::Cookie' ); And, it got promoted into a cookie pretty well ... cookie=USER_CATEGORIES&HASH%280x12afe8%29&LEVEL&exulted&USER_GROUPS&ARRAY%280x21d24c%2

Re: I am looking for a free perl compiler.

2004-12-08 Thread Lawrence Statton
demand for open-source source-closing software. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PRO

Re: Help with cookies

2004-12-08 Thread Lawrence Statton
again. Footnotes: [1] I actually think cookie paranoia is misplaced, and would love to see users educated -- but The Client Is Always Right, and if they say "Our industry demands no cookies" then so be it. There are other ways of keeping state, use them when you must. -- -- -- --

Re: I am looking for a free perl compiler.

2004-12-08 Thread Lawrence Statton
ld thinks pearl is something that grows inside an oyster and just want to have a dot-exe file they can download and run. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two component

Re: traversing (and accessing values in) a hash of hashes

2004-12-11 Thread Lawrence Statton
n" if $log{$key}{user_type} eq 'robot'; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to s

Re: traversing (and accessing values in) a hash of hashes

2004-12-11 Thread Lawrence Statton
... END PERL CODE . Produces the follwoing output: lawrence /tmp > perl ./jm.pl 192.168.1.1 "...GoogleBot..." 192.168.1.3 "...Linux...Firefox..." 192.168.1.5 "...Windows...MSIE..." Another place that could be giving you grief is trying to embed

Re: traversing (and accessing values in) a hash of hashes

2004-12-11 Thread Lawrence Statton
it...? Your homework: Starting with that structure above, write a subroutine that will iterate across it producing the following output: Hint - it will definitely be easier to explicitly break the structure into lists and hashes at first. Then squeeze your code to eliminate the intermediat

Re: Finding missing syntax element

2004-12-12 Thread Lawrence Statton
is a bad idea. One of the unspeakable horrors that was thrust upon me in my current job, was a chunk of 7,467 lines of code that is one enormous if/elsif/elsif/elsif/elsif/ block. Now it is 287 subs and a %dispatch table. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: Assigning a match to a varible without an IF

2004-12-13 Thread Lawrence Statton
rom_ is either your match or undef Which just allows you to defer the test for undef until later. print "I saw an email address $from_\n" if defined($from_); I just wrote about this a mere two weeks ago in this very forum. http://www.nntp.perl.org/group/perl.beginners/70671 -- -- -- --

Re: DBD::Oracle Instalation errors

2004-12-14 Thread Lawrence Statton
6:20: ocidfn.h: No such file or directory Well -- find those files... maybe your sysadmin installed Oracle's libraries in some non-standard place find / -name oci.h Then, fixup the incdir path, and try again. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence S

Re: How to detect present X-Server

2004-12-16 Thread Lawrence Statton
ut without ill effect) that allows me to SUPPRESS that automatic check is a GOOD thing. But requiring me to know that my $DISPLAY is set but unreachable is a stone in my shoe. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g C

Re: Resetting of the dataset

2004-12-16 Thread Lawrence Statton
) ); if ( my $cursor = $sth->execute ) { while (my $row = $sth->fetchrow_hashref) { . . . } } Of course, this just trades the KNOWN quantity of "straightforward memory for time" for a relatively unknown tradeoff on the database server. -- -- -- -- -- -- --

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Lawrence Statton
; Class methods have uppercase forms: Employee->Create(); Functions/methods that return a list have plural noun forms: $division->Employees; $person->email_addresses. Well -- enough philosophy for one day ... -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: How to detect present X-Server

2004-12-16 Thread Lawrence Statton
ed `X'\n"; } ... END PERL PROGRAM ... -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is t

Re: Getting the prefered language of the browser

2005-01-12 Thread Lawrence Statton
rence (@preference) { print $preference->{language},"\n"; } --- end perl code --- Plugging this into a CGI and doing something useful with it is, as they say, left as an exercise to the reader. -- -- -- -- -- -- -- -- -- --

Re: A second beginner's question

2005-01-14 Thread Lawrence Statton
cal variables is a good thing, but you don't just litter your code with 'my' -- you have to declare each variable once in the narrowest usable scope ... my @group = qw / Fred Mary Lawrence Georgia / ; my @newgroup = @group; my $switch = ...whever this comes from... if ( 0 == $switch

Re: A Beginner's problem

2005-01-14 Thread Lawrence Statton
rogram does nothing useful"; -- ... put it into your crontab and see what happens. Reading the man page for your system's cron will also be enlightening. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software

Re: perl script to binary executible

2005-01-24 Thread Lawrence Statton
a single .EXE file they can just run, without having to install Perl. The comes-with perlcc will function for those cases where "I just want to save myself the support hassle of casual users tweaking the script." -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- L

Re: hash slice/exists vs. grep benchmark weirdness...

2005-01-24 Thread Lawrence Statton
ut its consistently faster by an average 6-10% > > Any ideas why that might be? Well, first -- you're creating the hash inside the benchmark loop, which is not particularly light-weight. Second: You're using pathologically small lists. Try running it with 10,000 elements

Re: hash slice/exists vs. grep benchmark weirdness...

2005-01-25 Thread Lawrence Statton
ash version was about 10 times faster for *JUST THE SELECTION OPERATION* than the grep-the-list version. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them

Re: hash slice/exists vs. grep benchmark weirdness...

2005-01-25 Thread Lawrence Statton
-long and randomly-variable amount of time (printing) inside the function you are trying to test, you are basically destroying the exact number you are trying to compute, and have merely computed the deviation of the print operator. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: Hash Getting Doubled?

2005-01-31 Thread Lawrence Statton
sort keys %capdef ) { } -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Re: perl and PostgreSQL?

2005-02-01 Thread Lawrence Statton
> Hi, > can anybody address me to online resources to learn how to connect to a > PostgreSQL DB server through a Perl script? > Code examples are welcome ;-) > TIA > - begin perl code --- #!/usr/bin/perl use strict; use warnings; use DBI; our $_db

Re: Premature end of script headers

2005-02-08 Thread Lawrence Statton
t; > Thnx in advance Yes. The cause of this is the script headers are ending prematurely. If you would rather have *USEFUL* answers to stupid questions, including some code to elicit the error would be reccomended. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: Problem with script requiring valid referrer

2005-02-08 Thread Lawrence Statton
ere who configure their browsers to either not issue referrer at all, or tomangle it in an effort to obfuscate their activities. My instinct tells me: If the CGI::referrer() call is not giving you what you want, then it's unlikely that the browser is correctly passing in the header. -- -- -- -- --

Re: Undef value trouble

2005-02-18 Thread Lawrence Statton
ne record because it has the "0" value. > How could I pass this situation? > while ( defined ( my ($pid) = $sth->fetchrow_array ) ) { } -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software c

Re: tricky hash

2005-03-08 Thread Lawrence Statton
series of data indexed by a monotonically increasing integer. The List. my @keyword = split ( /\//, 'something/wicked/this/way/comes' ) ; If you like the refence version of it my $keywords = [ split (/\//, 'something/wicked/this/way/comes') ] ; -- -- -- -- -- -- -- -- -- -- --

Re: Testing for a '\' in a string

2005-03-09 Thread Lawrence Statton
> --_=_NextPart_001_01C524BC.E5934C9B > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > Hi all, > =20 > I am trying to evaluate a string, and determine if the last charater of > the string has a backslash '\' . The piece of code I am usin

Re: NIC Cards

2005-03-09 Thread Lawrence Statton
y listen on a given address. Getting the IP-addresses for the various interfaces on your system is left as an exercise to the user. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two comp

Re: NIC Cards

2005-03-09 Thread Lawrence Statton
5.456'))) || die "bind: $!"; between the calls to socket() and connect(). Obviously you'll need to replace that bogus IP-addr with the ip-addr of your local interface. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s

Re: Passing parameters into post

2005-03-09 Thread Lawrence Statton
ides a helper function POST that will generate a properly formated HTTP::Request object. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into th

Re: PDF creation

2005-03-09 Thread Lawrence Statton
) would give me > better mileage. > I use PDF::API2 every day and love it. The documentation is horribly lacking (Track down the example files - that is the best doco there is), but the library can do it all. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Re: Use of uninitialized value

2005-03-17 Thread Lawrence Statton
amp;& $value eq 'spring' ) { print "Flowers are in bloom\n"; } else { print "No flowers here!\n"; } -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal

Re: Database -> Excel

2005-03-31 Thread Lawrence Statton
dsheet::WriteExcel -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail

Re: functionality of .pl from .pm

2005-04-06 Thread Lawrence Statton
t -e script client 15173 I can even get more clever lawrence /home/export/lawrence > alias wonko-summary 'perl -I/tmp/libperl -MWonko=script -e script' Now I can do lawrence /home/export/lawrence > wonko-summary client 15173 Total invoiced: 372.56 Aged 30 days: 144.31 Aged 6

Re: Simple MySQL Example?

2005-04-08 Thread Lawrence Statton
> I was looking at the example code in the mysql examples directory. They seem > to have been created for testing things like very large records. > > Does anyone have a minimal example that executes a SQL SELECT command and > displays the results? > > I need something really simple to get me star

Re: basic class problem

2005-04-24 Thread Lawrence Statton
self->{foo} is *INSIDE* the defining class. And even there, you *USUALLY* should not. Notice in my little example, I used $self->customer_number. Even though I was "inside" the class for configuration, and I "know" that customer_number is an attribute of the object, i

More on basic classes

2005-04-24 Thread Lawrence Statton
... Footnotes: [1]: This, along with create world peace is left as an exercise for the reader. [2]: One of the things that really loses with English is the fact that there are many collisions between verb, noun, and adjective

Re: Sort multi referenced array/hash

2005-04-24 Thread Lawrence Statton
24 } } ; foreach my $key (sort { $serverdata->{$a}{hour} <=> $serverdata->{$b}{hour} } keys %$serverdata) { ... do something with $serverdata->{$key} ... } > > Thanks > De nada. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawr

Re: grouping mechanism

2005-05-11 Thread Lawrence Statton
7; => [ #{ # 'amount' => '100.00', # 'pay_date' => '3rd May 2005', # 'supplier' => 'supplierC', #

Re: Need information for Tcl/tk

2006-05-20 Thread Lawrence Statton
rving Perl programmers. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to sort them into the correct order. -- To unsubscribe, e-mail:

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
> Hi list, > > Hope this is not too simple or a stupid question: > > I have a slight problem with a loop. It is a simple numbers guessing game. It > works fine, but when I run this script, it gives me "Too low" immediately aft > er > the prompt. What should I do to get the last "else" statement d

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
> > #!/usr/bin/perl > use strict; > use warnings; > > our ($upper, $lower, $target) = ( 20, 1, 11 ); > D'oh! I really _meant_ to make those lexical instead of package variables - another good habit to get in early. my ($upper, $lower, $target) = (20,1,11); -- To unsubscribe, e-mail: [EMAIL

Re: Simple loop question

2006-05-31 Thread Lawrence Statton
> > Get in the habit of using strict and warnings -- 'use warnings' is > > subtly different from 'perl -w' and you should start good habits > > early. Upgrade if you are using an ancient version of Perl that does > > not come with warnings. > > > So would it be a conflict to use both "-w" and "st

Re: Yet another OO question

2006-06-08 Thread Lawrence Statton
e call - so it does increase the total knowledge of your program. My hitherto prefered answer is "It should return the object." Only because I (used to) like to chain method calls. I've since lost this bad habit. $fruit->name('apple')->color('red

Re: modifying @INC permanently

2006-06-08 Thread Lawrence Statton
ipts have logic to push the same directory to @INC. It's > rather repetative. > You do not need logic to do that. It would seem better to use: use lib '/path/to/my/misplaced/perl-modules'; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawre

Re: Yet another OO question

2006-06-10 Thread Lawrence Statton
;color('red'); > $_->texture('crunchy') > } > Hrm ... a Clever Construction, indeed. Our local style guide bans the use of for without an explicit index variable , so that bit of cleverness would lead to the following silly code: for my $localfruit ($fruit) { $localfr

Re: scoping problem with hash

2006-06-15 Thread Lawrence Statton
Charles Clarkson wrote: > @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys %kv_pairs} = values %kv_pairs; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTEC

Re: perl web apps

2010-11-22 Thread Lawrence Statton
On 11/22/2010 09:02 AM, shawn wilson wrote: any of y'all write web apps in perl? what do you use? i'm using html::template but i was thinking of going back to straight cgi.pm or having my perl send back json for the page to render (but i'm not that familiar with js). thoughts? Your major unwri

Re: call method by name

2011-04-12 Thread Lawrence Statton
On 04/12/2011 08:26 AM, marcos rebelo wrote: Hi all I have a code like: foreach my $key ( ... ) { my $sub = "get_$key"; $self->$sub; ... } If I can do this, I can also do it without the variable $sub. What is the syntax? please Best Regards Marcos Rebelo #!/usr/bin/perl use str

Re: utf8 and md5.

2011-05-05 Thread Lawrence Statton
On 05/05/2011 10:53 AM, apm wrote: I have old legacy code on .net 1.1 c# Byte[] clearBytes = new UnicodeEncoding().GetBytes(cleanString); Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes); return BitConverter

Re: website vs web app

2011-09-17 Thread Lawrence Statton
On 09/16/2011 06:10 PM, Rajeev Prasad wrote: why do i need a web app? becuase of size of my project? I mean if it is going to be a very big website with lot of pages and tables etc. should i have a webapp? apache and cgi wont cut it? (alongwith other technologies used commonly in websites)

Re: website vs web app

2011-09-17 Thread Lawrence Statton
On 09/17/2011 08:51 PM, Rob Dixon wrote: On 17/09/2011 20:10, Lawrence Statton wrote: On 09/16/2011 06:10 PM, Rajeev Prasad wrote: why do i need a web app? becuase of size of my project? I mean if it is going to be a very big website with lot of pages and tables etc. should i have a webapp

Re: perl and pattern

2012-02-21 Thread Lawrence Statton
On 02/21/2012 01:47 PM, Vyacheslav wrote: Hello. I'm new in perl and have many questions. This my first programm. #!/usr/bin/perl use strict; use warnings; EXCELLENT START! my $number = 0; my $_ = 0; print "Enter number:"; chomp($number = <>); if ( $number = /[0-9]/) { You want the matc

Re: XML parsing question

2012-03-15 Thread Lawrence Statton
On 03/15/2012 09:11 AM, Anirban Adhikary wrote: > I am writting a following code to parse this xml but not able yo understand > that why the value of $bsc_id_1 getting changed. > here is my code > > use strict; > use warnings; > > my $xml_file_to_read = "BSC-19478.xml"; > my $counter = 1; > my $

Re: Creating 100 buttons!

2007-05-06 Thread Lawrence Statton
ecial cases, soft references are a terrible idea, and this snippet is a perfect example of a case when you should NOT use them. Why not for ( 1 .. 100 ) { push @buttons, $mw->Button->pack; } Now you have a nice list of 100 buttons in @buttons -- Lawrence Statton - [EMAIL PROTECT

Re: Processing Arguments

2007-07-06 Thread Lawrence Statton
nt? > /tmp/* got expanded into a list of filenames matching that glob by the shell long before Perl got involved. You need to escape or quote your arguments such that the shell won't glob filenames before launching your script. ./sr "/tmp/*" -- Lawrence Statton - [EMA

Re: Timelocal's input parameters

2007-08-08 Thread Lawrence Statton
foo = ( one => 'uno', two => 'dos', three => 'tres' ); is equivalent to ... my %foo; $foo{one} = 'uno'; $foo{two} = 'dos'; $foo{three} = 'tres'; -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g

Re: slices

2007-08-08 Thread Lawrence Statton
> From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007 > Return-Path: <[EMAIL PROTECTED]> > X-Original-To: [EMAIL PROTECTED] > Delivered-To: [EMAIL PROTECTED] > Received: from localhost (localhost [127.0.0.1]) > by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0 > for <[EMAIL PROTECTED]

Re: Perl LWP post to a web form

2007-08-10 Thread Lawrence Statton
n, only the author of index.php would know for sure but passing in '3' where the word 'number' is expected in the searchtype field may lead to your lack of joy. Not passing in any value for 'query' might also be causing grief. -- Lawrence Statton - [EMAIL PROT

Re: How to convert csv file to excel

2007-08-14 Thread Lawrence Statton
> > Can anybody help me how to convert csv file to excel file using Perl > or Shell scripts? > I would use Text::CSV_XS to read the CSV file and SpreadSheet::WriteExcel to produce the Excel file. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: manipulating csv file fields through perl

2007-08-28 Thread Lawrence Statton
; > > > > 'SomeName20070827.csv'}; > > # tie the table name to the filename ... here you can see they are mapping a table SomeName to the file "SomeName20070827.csv" -- Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g Computer software consists of on

Re: (OT) Re: sourcing one perl file from another

2007-10-22 Thread Lawrence Statton
> It is also is a stand-alone command to interpret Tcl scripts. I'd guess > Tcl was the original source of source and was adopted by BASH and other > shells afterwards. I don't know anything about Tcl but maybe it has a > group of functions along the lines of file-type file-name. > I'd find tha

Re: line-equation program gives wrong results

2007-10-23 Thread Lawrence Statton
> > $slope = ($ARGV[1] - $ARGV[3]) / ($ARGV[0] - $ARGV[2]); > $b = $ARGV[1] - ($ARGV[0] * $slope); > print "\n$ARGV[1] = $slope * $ARGV[0] + $b\n"; > > For this input : > > perl my_program 16.81 16.57 0 0 > > It gives me this result : > > 16.57 = 0.985722784057109 * 16.81 + 0 > > Clearly

  1   2   >