Re: SSI in subdomains

2003-09-26 Thread Octavian Rasnita
Try putting a space after the last like: !--#include virtual=/cgi-bin/script.pl -- - Original Message - From: Ramon Chavez [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 25, 2003 9:37 PM Subject: SSI in subdomains Hello all. I have a problem. I have

Include Files in Perl?

2003-09-26 Thread seldan
Hello. I have been writing and maintaining a web-based intranet application for some time, primarily written in PHP with the backend written in POSIX shell. The pages access a postgreSQL database and I use a bit of JavaScript to make things look nice. In effect, it is a typical DB driven app. to

Re: Include Files in Perl?

2003-09-26 Thread drieux
On Thursday, Sep 25, 2003, at 17:44 US/Pacific, seldan wrote: [..] However, I am trying to keep this site as modular and easy to maintain as possible and cannot seem to find the right equivalent for a basic PHP include or require function. I use several variables that stay the same throughout

Re: SSI in subdomains

2003-09-26 Thread Ramon Chavez
Shaun: Thank you. I tried with !--#exec cmd='perl /absolute/path/to/domain.com/cgi-bin/script.pl' -- And it worked Answering some things. I'm hosting on a Cobalt server in Linux. I got no differences using or not the spacebefore --. Anyway It's now in the script. As I said, the only way

separating functionality

2003-09-26 Thread perl
Sorry to ask this question here but I can't seem to get the beginner perl list to work for me. What is the concept/functionality to put functions or sub in a separate file? I'm thinking something like creating a file for basic resusable functions/sub like maybe require or include or something.

Re: separating functionality

2003-09-26 Thread Dan Anderson
Using the package command breaks up things into different namespaces. For instance you could: package my_package; # do something #do somethingelse Puts both #do something and #do something else in the my_package namespace. On the other hand: { package my_package; # do something } #do

Re: How do ISTDIN to a stack until a pattern is matched, How do I

2003-09-26 Thread R. Joseph Newton
Dan Anderson wrote: Is there an easy way to read STDIN into a stack until some pattern is matched and then break. I tried all sorts of (error producing) code, but nothing seemed to work. I ended up with: #! /usr/bin/perl #can I make this more concise? use strict; use warnings; # and

Re: Should loops return a value?

2003-09-26 Thread R. Joseph Newton
Ville Jungman wrote: Shortly, I think it might be good if loops (etc.) could return values. Example 1: Retnext (like 'return next' borrowed from pl/sql) You want to extract numbers from an array if they are 4 and put an 'a'-letter after them. use strict; use warnings;

Re: Getting started in Perl for Windows

2003-09-26 Thread R. Joseph Newton
Dillon, John wrote: Is there a gobble-di-gook looker-upper for perl. For instance, if I don't know what '@_' is saying, as in: my($email, $orig_email) = @_; You should read a Perl reference if you are going to use Perl. perldoc perlvar Joseph -- To unsubscribe, e-mail: [EMAIL

Re: Getting started in Perl for Windows

2003-09-26 Thread R. Joseph Newton
Dillon, John wrote: When I am in a black command.com screen with CPAN prompt, where am I? Why can't I cd to c:\? John You are in a CPAN shell, which you asked for in the command perl use_module(CPAN) execute(SHELL) or *something like that* :-) that you typed into the command line. Joseph

Re: Problems with opening a word doc on similar systems

2003-09-26 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote: I am facing a very strange problem while i try opening a word document through my perl program. So far, i use the system() function. system(1, $winword_pathm $word_document); That works well on a win98 system, but it doesn't on another win98 system. Those

How to pass parameters to a module

2003-09-26 Thread Rajesh Dorairajan
Can someone explain how does one pass a parameter to a Perl Module? To illustrate suppose I've My::Module package My::Module; BEGIN { $scalar = $input; } use Exporter; our @ISA = qw(Exporter); our @EXPORT = ($scalar); In the above script is there anyway to pass the $input variable to the

Perl - HowTo operating with large file?

2003-09-26 Thread Juris
I have one small problem! HowTo read from large text file text in binary mode? if i want read all file, i use this code: my (@LOG_FILE); open (FL, /var/log/maillog); @LOG_FILE=FL; close (FL); #After this code execution file contents stored in array @LOG_FILE @LOG_FILE=grep /$something/, @LOG_FILE

Re: Perl - HowTo operating with large file?

2003-09-26 Thread Paul William
why not read the file line by line and then simply match each line with /$something/, disgarding any lines which do not match /$something/. If you wanted to could push all matching lines into and array. Cheers Paul On Fri, 2003-09-26 at 18:52, Juris wrote: I have one small problem! HowTo

RE: unzipping a record at a time

2003-09-26 Thread JOHN FISHER
I am in a Windows environment using cygwin. The zip file has /r/n as a carriage return (so annoying). When I ran the script below it dumped out a lot of bizarre chars to the screen. I guess this is some of the zip metadata. Using unzip -p zipfile.zip it prints cleanly. The doc states: At this

RE: How to autouse Statistics::Descriptive?

2003-09-26 Thread Bob Showalter
Hoenie Luk wrote: Has anyone try to delay loading the Statistics module by using autouse? I can't get it to work. The usual usage without autouse is this: use Statistics::Descriptive; $stat = Statistics::Descriptive::Sparse-new(); But if I autouse with this syntax: use autouse

Re: Should loops return a value?

2003-09-26 Thread Ville Jungman
Not crap, just unnecessary. If the loop should arrive at a value to be returned, it should probably be enclosed in a function, which was designed for returning values. Everything is unnessessary because always code could be made with machine language or assember - latter of course is

selectdb in DBI

2003-09-26 Thread Ramprasad A Padmanabhan
quick question In my script I need to connect to two different databases How Can I do this $dbh = DBI-connect( DBI:mysql:database=$DBNAME1;host=$DBHOST,, ) or die Can't connect to Mysql database: $DBI::errstr\n; ... ... ... # Now change the database $dbh-selectdb($DBNAME2)

Re: selectdb in DBI

2003-09-26 Thread Mike Blezien
The simplest way would be to create two separate database handles, IE. $dbh1 amd $dbh2 when connecting. Assuming both databases are on the same machine. MikemickaloBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work!

Re: How to pass parameters to a module

2003-09-26 Thread Ramprasad A Padmanabhan
Rajesh Dorairajan wrote: Can someone explain how does one pass a parameter to a Perl Module? To illustrate suppose I've My::Module package My::Module; BEGIN { $scalar = $input; } use Exporter; our @ISA = qw(Exporter); our @EXPORT = ($scalar); In the above script is there anyway to pass the

Re: Should loops return a value?

2003-09-26 Thread Wiggins d'Anconia
On Fri, 26 Sep 2003 16:21:56 +0300, Ville Jungman [EMAIL PROTECTED] wrote: Not crap, just unnecessary. If the loop should arrive at a value to be returned, it should probably be enclosed in a function, which was designed for returning

Re: Perl - HowTo operating with large file?

2003-09-26 Thread Ramprasad A Padmanabhan
Juris wrote: I have one small problem! HowTo read from large text file text in binary mode? if i want read all file, i use this code: my (@LOG_FILE); open (FL, /var/log/maillog); @LOG_FILE=FL; close (FL); #After this code execution file contents stored in array @LOG_FILE @LOG_FILE=grep

RE: unzipping a record at a time

2003-09-26 Thread Wiggins d'Anconia
On Fri, 26 Sep 2003 04:59:34 -0500, JOHN FISHER [EMAIL PROTECTED] wrote: I am in a Windows environment using cygwin. The zip file has /r/n as a carriage return (so annoying). When I ran the script below it dumped out a lot of bizarre chars to

Re: Perl - HowTo operating with large file?

2003-09-26 Thread Wiggins d'Anconia
On Fri, 26 Sep 2003 20:13:21 +0530, Ramprasad A Padmanabhan [EMAIL PROTECTED] wrote: Juris wrote: I have one small problem! HowTo read from large text file text in binary mode? if i want read all file, i use this code: my

Order of Command Line Options

2003-09-26 Thread Jeff Westman
Hi, Why does the order of these options matter? In the first case, no output is produced, but it works correctly in the second case. I would have thought perl would have been smart enough to parse the command line options in any order. $ nslookup someServer | perl -en 'print qq($_);' $

RE: unzipping a record at a time

2003-09-26 Thread JOHN FISHER
I would say its a WinZip type file, but it only has one file in it. WinZip knows what it is. Has an file extension of .zip, not .gz or .tar (my knowledge here is minimal). I will look into Archive::Zip. I don't think Deflate compression was used so I may have problems there as well. But hey I

Re: Do BEGIN blocks and END blocks have priority?

2003-09-26 Thread Dan Anderson
BEGIN blocks do not take precedence over one another--they are all still executed. They are, however, executed immediately after perl finishes compiling them. So, if you have the following code: Ok, so I'm guessing that the reason that 3214 is displayed is not because of precedence, but that

Re: env vars using perl

2003-09-26 Thread Randal L. Schwartz
Pete == Pete Emerson [EMAIL PROTECTED] writes: Pete It's the same way. Here's code that works for me: Pete #!/usr/bin/perl -w Pete use strict; Pete use CGI qw(:standard); Pete print header; Pete print start_html; Pete foreach my $key (sort keys %ENV) { Pete print \$ENV{$key} =

RE: unzipping a record at a time

2003-09-26 Thread Wiggins d'Anconia
On Fri, 26 Sep 2003 10:04:37 -0500, JOHN FISHER [EMAIL PROTECTED] wrote: I would say its a WinZip type file, but it only has one file in it. WinZip knows what it is. Has an file extension of .zip, not .gz or .tar (my knowledge here is

RE: Should loops return a value?

2003-09-26 Thread Hanson, Rob
cleverness and hacks often makes code hard to debug or read particularly when programs grow. I was really just showing that it could be done. The next step would be to package the subroutine up as a library so that is can be reused. This has been done before in module like Error that gives

RE: How to pass parameters to a module

2003-09-26 Thread Hanson, Rob
Can someone explain how does one pass a parameter to a Perl Module? There are a few ways. #1 - On the use line use My::Module qw(foo bar); When you use a module it first loads the module and evaluates it. Second it runs the import() subroutine in the module (if there is one), passing the

Pop3 to SMTP

2003-09-26 Thread Zanardi2k3
Does anybody know of a Perl module / script that can retrieve mail from a POP3 server and forward it to another SMTP system? I currently use pullmail.exe (http://www.swsoft.co.uk/index.asp?page=freesoftware;) but it is not open source and i'd like to have something i can tweak, even if i have

RE: Pop3 to SMTP

2003-09-26 Thread Wiggins d'Anconia
On 26 Sep 2003 14:00:29 -, Zanardi2k3 [EMAIL PROTECTED] wrote: Does anybody know of a Perl module / script that can retrieve mail from a POP3 server and forward it to another SMTP system? I currently use pullmail.exe

RE: Order of Command Line Options

2003-09-26 Thread Thomas Bätzler
Hi, Jeff Westman [mailto:[EMAIL PROTECTED] asked: Why does the order of these options matter? [...] $ nslookup someServer | perl -en 'print qq($_);' $ nslookup someServer | perl -ne 'print qq($_);' -e must be followed by the code: $ perl --help Usage: perl [switches] [--] [programfile]

Unicode Patern matching

2003-09-26 Thread Sturdevant-Contractor, Robert W
Hi, For three days I have been totally _unsuccessful_ at matching a two word pattern (Windows 2000) in a unicode doc in a reasonable fashion. I am using the ActiveState build 635 on W2k. Can someone give me an example? This works for me but is rather ugly; there's gotta be a better way. $_ =~

Reg. Perl script to read comma seperated file.

2003-09-26 Thread Shashank Khanvilkar
Hi, I do know how to read the comma seperated file using the following script while ($lines = INFH){ if ($lines =~ /^\s*$/){ last; } @flds = split(/,/, $lines); ($year, $paperName, $authors, $conf, $fileName, $abstract) = @flds; print $year $paperName, $fileName\n\n; }

RE: Reg. Perl script to read comma seperated file.

2003-09-26 Thread Paul Kraus
Perldoc Text::CSV Easy 2 page doc that will fix you write up. Paul -Original Message- From: Shashank Khanvilkar [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2003 12:54 PM To: [EMAIL PROTECTED] Subject: Reg. Perl script to read comma seperated file. Hi, I do know how to read

Help needed on File manipulation

2003-09-26 Thread Chinku Simon
Hi, I am writing a Perl program that reads files created by another independent process. I have to take care that the perl program does not read the files that are in the process of getting created. I am programming in Windows NT environment. It is also not possible for the perl program to

Help with Win32:FileSecurity

2003-09-26 Thread Carbone, Michael
Hi, I'm working on a script to get the permissions on a list of directories using the following Perl script: use warnings; use Win32::FileSecurity qw(Get); $file=C:\\SomePath\\dirfile; open(DIRLIST, $file ) || die Can't open dirfile: $!\n; @filelist =

RE: Do BEGIN blocks and END blocks have priority?

2003-09-26 Thread david
Dan Anderson wrote: What is really driving me bonkers is if I try the following code: use strict; use warnings; END { print Look ma, i'm using subroutines!; foo::foo(); } BEGIN { print \nouter\n; BEGIN { print \ninner\n; } } print end\n; BEGIN {

What is the best way to handle errors?

2003-09-26 Thread Dan Anderson
I have a program I am trying to develop in Perl, and one of the problems I am running into is what to do with the errors. I was thinking of creating a custom module that I could then use on all of my programs to allow me to call a report_error() sub, which would (depending on whether we

Is -w deprecated?

2003-09-26 Thread Dan Anderson
In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is deprecated. Is this true? Also, will use warnings; work on versions of perl 5.8? Thanks, -Dan -- To unsubscribe, e-mail:

Re: Help needed on File manipulation

2003-09-26 Thread Dan Anderson
I'm a perl noob, so I'm not sure if this is the best way to do it, but just a thought: When a program is accessing the file create a file like: filename.lock. Delete it when you're done. Then check to see if filename.lock exists before trying to access the program -- if not sleep. Of course, I

RE: Should loops return a value?

2003-09-26 Thread Dan Anderson
2 Cents It is possible that your concept -- returning values for all language constructs could be revolutionary. For instance, many, many, many programming constructs support code like: // apologies for the pseudocode while ($foo = bar()) { /* do something */ } bar () { /* return false

Re: Should loops return a value?

2003-09-26 Thread Ville Jungman
Interesting discussion, I am not convinced of the value yet, but then again most of my experience is in Perl and so wouldn't have really thought to do it, so always open to something new... No one has mentioned 'eval' that I have seen in this little discussion, couldn't it be used to wrap the

Re: Is -w deprecated?

2003-09-26 Thread Bob X
Dan Anderson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is deprecated. Is this true? Also, will use warnings; work on versions of

Re: Is -w deprecated?

2003-09-26 Thread David Wall
--On Friday, September 26, 2003 5:51 PM -0400 Dan Anderson [EMAIL PROTECTED] wrote: In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is deprecated. Is this true? Also, will use warnings; work

Re: Should loops return a value?

2003-09-26 Thread david
Ville Jungman wrote: Ville Jungman wrote: Shortly, I think it might be good if loops (etc.) could return values. Yes, You're right John! A very good example! Which one would be more readable? This: @bigger_than_4= foreach $value(@values) { retnext $value.a if $value

RE: Should loops return a value?

2003-09-26 Thread Ville Jungman
It is possible that your concept -- returning values for all language constructs could be revolutionary. BUT, at the same time there are a number of languages which have tried to be innovative and have never been heard from again. I'm not creating a new language - this wouldn't remove anything

Re: Is -w deprecated?

2003-09-26 Thread Daniel Staal
--On Friday, September 26, 2003 20:29 -0400 David Wall [EMAIL PROTECTED] wrote: In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is deprecated. Is this true? Also, will use

subroutine problem

2003-09-26 Thread Gedi
Hi all, I have recently started to learn perl. After reading Randal Schwartz’s Learning perl, I decided to give my first program a whirl. Upon writing it, I was checking each section of code as I went along to make sure everything worked. I got to one section and couldn’t get it to run as a

Re: subroutine problem

2003-09-26 Thread Jeff 'japhy' Pinyan
On Sep 26, Gedi said: fully understand the error I am getting and am hoping somebody can point me in the right direction. You should have shown us the error, so that we don't need to run the code. But as it stands, the code doesn't need to be run. #use strict; Why'd you do that?? elsif

Re: Should loops return a value?

2003-09-26 Thread R. Joseph Newton
Ville Jungman wrote: From: Hanson, Rob [EMAIL PROTECTED] If you really want a loop to return something, you can roll your own, even in Perl 5... but the syntax won't be as you gave. Ye - i'm not searching a way to solve a single problem but trying to make programming easier. If loops

Re: Should loops return a value?

2003-09-26 Thread R. Joseph Newton
Ville Jungman wrote: to hear everybody saying that this is a great thing! But maybe someone agrees with me. What did You think first time You heard about objects, perl or something else, what __? The first ime I heard about Object Oriented Programming, it sounded like a silly-ass

Re: Should loops return a value?

2003-09-26 Thread R. Joseph Newton
Dan Anderson wrote: 2 Cents It is possible that your concept -- returning values for all language constructs could be revolutionary. For instance, many, many, many programming constructs support code like: // apologies for the pseudocode while ($foo = bar()) { /* do something */

Re: Do BEGIN blocks and END blocks have priority?

2003-09-26 Thread R. Joseph Newton
Dan Anderson wrote: I don't understand why if BEGIN blocks can have different priorities a warning would be put out. I mean, require and use are basically begin blocks in disguise, and if you need subroutines, variables, or whatever from a package in a package there needs to be precedence.

Are package and module the same?

2003-09-26 Thread perl
Is this a current or outdated call? main'stderr -rkl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: selectdb in DBI

2003-09-26 Thread R. Joseph Newton
Ramprasad A Padmanabhan wrote: quick question In my script I need to connect to two different databases How Can I do this $dbh = DBI-connect( DBI:mysql:database=$DBNAME1;host=$DBHOST,, ) or die Can't connect to Mysql database: $DBI::errstr\n; ... ... ... # Now

Re: Is -w deprecated?

2003-09-26 Thread R. Joseph Newton
Daniel Staal wrote: --On Friday, September 26, 2003 20:29 -0400 David Wall [EMAIL PROTECTED] wrote: In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is deprecated. Is this

Re: subroutine problem

2003-09-26 Thread R. Joseph Newton
Gedi wrote: Hi all, I have recently started to learn perl. After reading Randal Schwartz’s Learning perl, I decided to give my first program a whirl. Upon writing it, I was checking each section of code as I went along to make sure everything worked. I got to one section and couldn’t get

Re: Are package and module the same?

2003-09-26 Thread Steve Grazzini
On Fri, Sep 26, 2003 at 08:30:29PM -0700, [EMAIL PROTECTED] wrote: Is this a current or outdated call? main'stderr That's old-fashioned, but it doesn't seem to have been deprecated (no warnings, at least). In point of fact, it's better to use the capitalized STDERR, since it's one of the magic

substr parsing mask

2003-09-26 Thread perl
Does anyone have a short routine for displaying mask on some values and displaying the value of the last four? For example, alot of site display credit card numbers like 1234 which shows only the last four. I know how to use the substr but what about replacing the preceding values with ?