Re: Regex not working as expected when doing multiple checks and updates

2005-02-11 Thread John W. Krahn
Wagner, David --- Senior Programmer Analyst --- WGO wrote: Here is a watered down version, but unclear what I am missing. You should be able to cut and past. It is self contained and I am running on XP Pro, using AS 5.8.4. What am I trying to do? Well I have to implement a new setup. So I pull the

Re: Changing the path in @INC

2005-02-11 Thread Andrew Black
Boysenberry Payne wrote: I know how to add to the perl path, but how do you take away. I have the fink /sw/ path included in the @INC array, and I want to be able to temporarily remove them, or at least put them at the end. Is there a way to set it up so that it's semi permanent? I would ask how

CGI/DBI - Can anyone work out why this fails

2005-02-11 Thread mike
I have the following code $cat1; if ($cat1){ my $cat1="%$category%"; } else { $cat1="$category"; } $row=$dbh->prepare("SELECT contact_id,first_name,last_name,organisation FROM tb_contacts WHERE (organisation ILIKE ? OR last_name ILIKE ?) OR contact_id = ?"); $cat1; print $cat1; $row->bind_param

How to create a blank text file on win2k

2005-02-11 Thread Mark Panasci
I'm using active state perl on win2k box, and need the script to create zero byte length text files, like the touch command does in Unix. I've been searching around for a couple of days now and haven't found anything. Surely there's an easy way to do this? Thanks! -- To unsubscribe, e-mail: [E

Re: IS there any way to get rthe content of the file

2005-02-11 Thread Octavian Rasnita
Hi, You can do: local $/; open(IN, $file) || die "Can't read $file - $!"; my $content = ; close IN; Teddy - Original Message - From: "Anish Kumar K." <[EMAIL PROTECTED]> To: "beginners perl" Sent: Friday, February 11, 2005 8:10 AM Subject: IS there any way to get rthe content of the f

Re: How to create a blank text file on win2k

2005-02-11 Thread John W. Krahn
Mark Panasci wrote: I'm using active state perl on win2k box, and need the script to create zero byte length text files, like the touch command does in Unix. I've been searching around for a couple of days now and haven't found anything. Surely there's an easy way to do this? Thanks! Just open t

RE: How to create a blank text file on win2k

2005-02-11 Thread Laurent Coudeur
open file to create it then close open (FILE,">filename"); close (FILE); should do the trick Regards. Laurent. -Original Message- From: Mark Panasci [mailto:[EMAIL PROTECTED] Sent: 11 February 2005 05:55 To: beginners@perl.org Subject: How to create a blank text file on win2k I'm usin

Re: uninstalling module

2005-02-11 Thread Randy W. Sims
Martin Mrazek wrote: Hello, I have installed PDL module for perl, but something went wrong and I need to reinstall it. Shall I remove the module first and then install again? How to remove it? It depends on how it was installed. Normally, from the directory of the distribution (./PDL): perl Mak

how to share DB connection

2005-02-11 Thread Ing. Branislav Gerzo
Hi, I have script: use strict; use warnings; use lib '/data/home/2ge/perl/modules'; use Foo::Bar; my $dbh = DBI->connect("DBI:mysql:database=foo;host=localhost;port=3306", "", "") or die "Can't connect: ", $DBI::errstr; ... now I want to share this $dbh connection to Bar.pm, so I shoul

RE: CGI/DBI - Can anyone work out why this fails

2005-02-11 Thread Bob Showalter
mike wrote: > I have the following code > > $cat1; > if ($cat1){ > my $cat1="%$category%"; The "my" here is scoped to this if { } block, so you aren't changing the outer $cat1 > } > else { > $cat1="$category"; > } > > $row=$dbh->prepare("SELECT > contact_id,first_name,last_name,organisation FRO

RE: how to share DB connection

2005-02-11 Thread Bob Showalter
Ing. Branislav Gerzo wrote: > Hi, > > I have script: > > use strict; > use warnings; > use lib '/data/home/2ge/perl/modules'; > use Foo::Bar; > > my $dbh = > > DBI->connect("DBI:mysql:database=foo;host=localhost;port=3306", "", > "") or die "Can't connect: ", $DBI::errstr; ... > > now

Re: how to share DB connection

2005-02-11 Thread Ing. Branislav Gerzo
Bob Showalter [BS], on Friday, February 11, 2005 at 08:07 (-0500) typed the following: BS> Well, Bar.pm can't see the my() variable in your main program, so you need BS> to: BS> a) pass $dbh to db_get(), or ok, this seems good for me, I call all db_operations with reference of hash, so I can: $r

Re: how to share DB connection

2005-02-11 Thread JupiterHost.Net
Ing. Branislav Gerzo wrote: Bob Showalter [BS], on Friday, February 11, 2005 at 08:07 (-0500) typed the following: BS> Well, Bar.pm can't see the my() variable in your main program, so you need BS> to: BS> a) pass $dbh to db_get(), or ok, this seems good for me, I call all db_operations with refer

RE: how to share DB connection

2005-02-11 Thread Bob Showalter
Ing. Branislav Gerzo wrote: > Bob Showalter [BS], on Friday, February 11, 2005 at 08:07 (-0500) > typed the following: > > c) Have $dbh live in Bar.pm and use Exporter to export it back to > > the main program, or > > I want set $dbh in main script. You can still do that. You would do something l

Re: how to share DB connection

2005-02-11 Thread Ing. Branislav Gerzo
Bob Showalter [BS], on Friday, February 11, 2005 at 09:40 (-0500) wrote: BS> You can still do that. You would do something like this: BS>package Foo::Bar; BS>use base 'Exporter'; BS>our @EXPORT = qw/$dbh/; BS>our $dbh; thanks a lot, that's exactly I looking for. -- ...m8s, cu

write new file to same dir

2005-02-11 Thread Brian Volk
Hi All, I'm having trouble w/ my script... I can open the dir, read the dir and even get the s/// to work I just don't know how to write the new file to a new dir. or the same dir for that matter... If someone could point me in the right direction I would really appreciate it. Maybe

Re: write new file to same dir

2005-02-11 Thread Gareth Johnston
On Fri, February 11, 2005 15:45, Brian Volk said: > Hi All, > > I'm having trouble w/ my script... I can open the dir, read the dir and even > get the s/// to work I just don't know how to write the new file to a > new dir. or the same dir for that matter... If someone could point > me >

Re: write new file to same dir

2005-02-11 Thread bright true
Hi , actually you're just opening a directory ... and you're not writing into a file to write a file .. you can use the following 1- with replace the old file open(FILE,">$dir/filenamt.txt"); print FILE "Something Here"; close(FILE); 2- to write into a file with out replace it .. (with out rem

RE: write new file to same dir

2005-02-11 Thread Brian Volk
Thank you for your help... Where I'm still confused is, the script below does just what I want it to do and I can even see the results in the STOUT... I'm just not sure how I get the changes written to the 5 files in the dir... my $dir = "C:/brian/test_html"; opendir (HTML, $dir) or die "Can't

Re: write new file to same dir

2005-02-11 Thread Wiggins d'Anconia
Brian Volk wrote: Hi All, I'm having trouble w/ my script... I can open the dir, read the dir and even get the s/// to work I just don't know how to write the new file to a new dir. or the same dir for that matter... If someone could point me in the right direction I would really appr

Re: write new file to same dir

2005-02-11 Thread John W. Krahn
Brian Volk wrote: Hi All, Hello, I'm having trouble w/ my script... I can open the dir, read the dir and even get the s/// to work I just don't know how to write the new file to a new dir. or the same dir for that matter... If someone could point me in the right direction I would really

Software to understand Scale.

2005-02-11 Thread Diogo Nunes de Oliveira
Hi folks, I´d like to know if you can give me a hand. Well, I´m trying to develop a software that understands the code/protocol generated by a scale when it weights something. Picture this: The scale weights the product and the software interprets that weight. The scale has a different code/proto

RE: write new file to same dir

2005-02-11 Thread Brian Volk
Thank you so much for spelling it out for me. I learned a lot! ...BTW your "--Untested--" worked great! :~) Brian > -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 1:31 PM > To: Brian Volk > Cc: Beginners (E-mail) > Subject: Re:

Read Serial Port String

2005-02-11 Thread Diogo Nunes de Oliveira
Hi you all... Do you know how I can get the code that is passed by the serial port? I mean, I wanna create a script that "snifs" the serial port, gets the string, and write it to a file to then, convert it into plain english (portuguese, really, hehehe)... What should I do? Does Win32::SerialPort

Compare file modification time

2005-02-11 Thread perl
How do I best compare mtime of several files. I have a script for making daily backups into a given directory. Now I want to modify it to delete old backups if the total exceed cetain number. The idea was to compare the mtime of all file to figure out old files to delete, but somehow I think it

Perl versus EXPECT(tcl)

2005-02-11 Thread A B C
Greetings, I've heard that Expect(tcl) is outstanding in what it specializes in. Can any experts in both Expect and Perl Networking comment? I want to know if Perl's Networking arena is superior or equal to what Expect specializes in. __ Do you

Re: Software to understand Scale.

2005-02-11 Thread Chris Devers
On Fri, 11 Feb 2005, Diogo Nunes de Oliveira wrote: > I´m trying to develop a software that understands the code/protocol > generated by a scale when it weights something. Picture this: The > scale weights the product and the software interprets that weight. The > scale has a different code/pro

Re: Read Serial Port String

2005-02-11 Thread Xiaofang Zhou
Hi, Diogo, Yes, that module can do what you need. I've been using that Win32::SerialPort under win9x some years ago. It can send/receive data with COM port. Thanks, Xiaofang. 在 2005-02-11 21:31:00 您写道: >Hi you all... > >Do you know how I can get the code that is passed by the serial port? I >mea

Re: Perl versus EXPECT(tcl)

2005-02-11 Thread Chris Devers
On Fri, 11 Feb 2005, A B C wrote: > I've heard that Expect(tcl) is outstanding in what it > specializes in. Can any experts in both Expect and > Perl Networking comment? > > I want to know if Perl's Networking arena is superior > or equal to what Expect specializes in. They can't really be compa

Re: Perl versus EXPECT(tcl)

2005-02-11 Thread Bob Showalter
Chris Devers wrote: Several programming languages have mechanisms for building wrappers around Expect, including Perl. In this case, you need a module like Expect.pm or Expect::Simple, as described here: Pedantic point: Expect.pm is perhaps best thought of as an Expect "clone" or "workalike". It d

Re: Re: Perl versus EXPECT(tcl)

2005-02-11 Thread Xiaofang Zhou
Hi, Bob, Sounds the expert.pm is cool. But when I try to install the pre-required io::pty, I got a fatal error. Is it possible to install io::tty and expert on xp? --- cl -c -nologo -O1 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAV E_DES_FCRYPT -DPERL_IMP

Re: Read Serial Port String

2005-02-11 Thread Todd W
"Diogo Nunes de Oliveira" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi you all... > > Do you know how I can get the code that is passed by the serial port? I > mean, I wanna create a script that "snifs" the serial port, gets the > string, and write it to a file to then, convert

Re: Perl versus EXPECT(tcl)

2005-02-11 Thread forknerr
Perl has modules you can include that allow you to use the power of perl and the functionality of Expect. - Original Message - From: A B C <[EMAIL PROTECTED]> Date: Friday, February 11, 2005 6:16 pm Subject: Perl versus EXPECT(tcl) > Greetings, > > I've heard that Expect(tcl) is outstan

Re: Re: Re: Perl versus EXPECT(tcl)

2005-02-11 Thread Xiaofang Zhou
Hi, I have trouble using B::Bytecode on xp/activeperl 5.6. With a very simple script, the command: perl -MO=Bytecode,-ofirst.byte first.pl Can't work properly. --first.pl #!/usr/bin/perl -w use strict; print "Hello World!\n"; 1; - Please let me know if anyone have successf