open CONSOLE?

2004-06-22 Thread perl.org
Hi, Is there a way to explicitly open a handle to the "console", or wherever STDOUT/STDERR are directed to by default? My process is running in an environment in which STDOUT and STDERR have already been redirected. I want to intercept these streams when running command line tools, then resto

warning with eval, not with inline

2004-06-22 Thread perl.org
Given this piece of code (where ${components[${i}]} is 'email'): eval { my ${name} = 'IWAPI::ExternalTasks::' . ${components[${i}]}; no strict; eval( &${name}( -files => [EMAIL PROTECTED], -area => ${area}, -wftask => ${wftask}, -wfworkflow => ${wfworkflow} )); use

Win32::NetAdmin::LocalGroupGetMembers

2004-06-25 Thread perl.org
I need to get the members of a local group on a Windows 2000 server. I was reading the docs for Win32::NetAdmin (http://perlhelp.web.cern.ch/PerlHelp/site/lib/Win32/NetAdmin.html) which looks like the place to start, but it is giving me weird results (including beeps). Any suggestions? SIDs I c

recursive grep for Windows

2004-06-28 Thread perl.org
Can anyone share a script that recurses a filesystem for files containing one or more patterns? Seems like it would be easy to write but if it's already out there... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: newline to

2004-06-28 Thread perl.org
Maybe: ${text} =~ s#[\r\n]+##g; On 28 Jun 2004 15:13:06 -0400, Charles Farinella wrote > I have a textarea on a webpage that gets stored in a database. I'd like > to convert the newline to an HTML before it gets stored so when > I display it, the line breaks as it was typed. I've been looking

RE: s::LocalGroupGetMembers

2004-06-29 Thread perl.org
t; any sense, but it's true). > > > Subject: Win32::NetAdmin::LocalGroupGetMembers > > Date: Fri, 25 Jun 2004 17:40:05 -0400 > > From: "perl.org" <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > > > I need to get the members of a local gro

Re: Win32::NetAdmin::LocalGroupGetMembers

2004-06-29 Thread perl.org
7;; > $VAR2 = 'Mike Flannigan'; > > So it appeared to work to me. It made no sounds. > > Mike > > > Subject: Win32::NetAdmin::LocalGroupGetMembers > > Date: Fri, 25 Jun 2004 17:40:05 -0400 > > From: "perl.org" <[EMAIL PROTECTED]> >

RE: s::LocalGroupGetMembers

2004-06-29 Thread perl.org
On Tue, 29 Jun 2004 12:50:14 -0400, perl.org wrote > Thanks. So I have to pass the SID to some other function to get the > actual username? or call a different function? I tried > LocalGroupGetMembersWithDomain (which should give domain\users) but > it's not any better a

Re: recurisiveness

2004-06-30 Thread perl.org
On Wed, 30 Jun 2004 12:00:44 -0500, Joe Stuart wrote > I have a script that recursively goes through the filesystem and changes > links in html documents The problem I'm having is that it chokes on > directories with spaces in there names. Does anyone have any > suggestions on how to deal with th

use, require or none of the above?

2004-06-30 Thread perl.org
I have read the docs but I'm still not quite clear on the difference between use and require and if either is even needed. I just moved some code from one module to another. The orignal module has use Net::SMTP in it, but the module I moved the code to does not (it does use the first module tho

Re: Searching ahead in a file

2004-06-30 Thread perl.org
If the file is relatively small, why not read it into an array, then just manipulate the array index? Something like: my @{lines} = ; close( IN ); my ${ln} = 0; while( ${ln} <= $#lines + 1 ) { # check ${lines[${ln}]} and manipulate ${ln} accordingly. } > I would suggest the following approach:

Net::SMTP error handling

2004-06-30 Thread perl.org
"Unless otherwise stated all methods return either a *true* or *false* value, with *true* meaning that the operation was a success." So sayeth the perldocs, but where is information about the error? With docs like this do you assume it's ${!}, or could it be that other thing (I think I saw someth

Re: Searching ahead in a file

2004-06-30 Thread perl.org
Sorry, while( ${ln} <= $#lines ) That $# starting with -1 thing really gets to me. On Wed, 30 Jun 2004 16:38:45 -0400, perl.org wrote > If the file is relatively small, why not read it into an array, then > just manipulate the array index? Something like: > > my @{lines}

Re: OT - Perl editing with colors

2004-07-01 Thread perl.org
http://www.textpad.com has an "Edit->Copy Other -> html" if that might help. On Thu, 01 Jul 2004 16:03:10 +, Ohad Ohad wrote > Say I edit perl script with nedit or gvim and color highlight the syntax. > Is there anyway I can print the file WITH the colors? > > I guess it means saving the colo

Re: use, require or none of the above?

2004-07-01 Thread perl.org
Great, thanks for the detailed response. I have read the docs several times, but each time it becomes a little less clear... I like the extra braces because they look pretty in syntax-highlighting editors. I am always using strict. Not sure what the second call was or what looked weird about it

Re: use, require or none of the above?

2004-07-01 Thread perl.org
On Thu, 1 Jul 2004 11:14:51 -0600, Wiggins d Anconia wrote > > non-descript. Definitely a lot of extra punctuation that would be more > difficult to read for me and an easy way for syntax errors to creep > in, but to each their own. Interesting - I have found that the extra braces actually reduc

unique array

2004-07-02 Thread perl.org
>From http://iis1.cps.unizar.es/Oreilly/perl/cookbook/ch04_07.htm, is this really the best way to ensure an *ordered* list contains only unique values? It seems like it could/should be easier. I wonder why the examples don't use my. %seen = (); @uniq = (); foreach $item (@list) { unless ($se

Re: unique array

2004-07-02 Thread perl.org
Sorry, I didn't mean ordered as in sorted, I meant ordered as in I don't want to lose whatever order their in. But thanks for the tip. On Fri, 02 Jul 2004 14:26:02 -0400, Randy W. Sims wrote > perl.org wrote: > >>From http://iis1.cps.unizar.es/Oreilly/perl/cookboo

RE: unique array

2004-07-02 Thread perl.org
On Fri, 2 Jul 2004 14:32:49 -0400 , Bob Showalter wrote > perl.org wrote: > > From http://iis1.cps.unizar.es/Oreilly/perl/cookbook/ch04_07.htm, > > Methinks that stuff is illegally posted copyrighted information. Several people responded individually with comments like this.

Re: Copyright Violation -> RE: unique array

2004-07-02 Thread perl.org
Hmm, if I hadn't posted the link at least one person would have told me to check the docs. But I guess there are more useless responses if I do post the link. So next time please don't ask me to check the docs. Why doesn't someone go police google then - they gave me the link. -- To unsubscr

warnings on old Perl

2004-07-06 Thread perl.org
I have to work with this version of Perl: This is perl, version 5.005_03 built for MSWin32-x86 When I 'use warnings' it says: Can't locate warnings.pm in @INC How do I enable warnings in this case? I think there is a -w on the shebang line, but I am trying to enable warnings from my modules an

multiple inheritance

2004-07-06 Thread perl.org
I have a vendor-provided OO package and a custom OO package. The custom package does not need a constructor. I want to have a class that inherits from both. It also does not need a constructor - it should use the constructor from the vendor-provided package. I have a problem when my inheritin

RE: multiple inheritance

2004-07-06 Thread perl.org
On Tue, 6 Jul 2004 12:01:44 -0700, Bakken, Luke wrote > > Wouldn't you want this instead? > > package Bar; > > @ISA = qw/Foo/; > > sub new > { > my $s = shift; > my $class = ref($s) || $s; > my $self = $class->SUPER::new(); > bless $self, $class; > return $self; >

${DBI::errstr} vs $DBI::errstr

2004-07-07 Thread perl.org
If my Perl contains ${DBI::errstr} I get warnings like this: Ambiguous use of ${DBI::errstr} resolved to $DBI::errstr at (eval 20) line 284. If my Perl contains $DBI::errstr (without the braces) I don't get these warnings. Is there an explanation for this? When I use things like ${File::Find::n

Determine if sub exists in module

2004-07-08 Thread perl.org
I can probably figure this out if I spend some time but as I was going through it more questions were raised. Is it possible for a Perl script to check if a subroutine exists in a module without actually invoking that subroutine? I have a Perl module that contains a bunch of subroutines. I nee

Re: Determine if sub exists in module

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 08:51:08 -0600, Wiggins d Anconia wrote > > All of this seems a little fishy, what is > the overall goal and why do you need to pass sub names to a separate > script? I am assembling the command line under the Interwoven CMS workflow engine, which is basically Perl. Each auto

Re: ${DBI::errstr} vs $DBI::errstr

2004-07-08 Thread perl.org
On 8 Jul 2004 13:41:28 -, Peter Scott wrote > Also, look at the RaiseError property of DBI connections. I gave up > referring to DBI::errstr some years ago. Looks good, except I think I noticed yesterday that if the error is actually connecting to the database, errstr may contain the username

Re: Determine if sub exists in module

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 08:51:08 -0600, Wiggins d Anconia wrote > > perldoc UNIVERSAL specifically the 'can' function. That's the one. But who's it calling "DUMMY"? That's not my code... C:\temp>type test.pl use CGI; use Data::Dumper; my ${ref} = CGI->can( 'param' ); print Dumper( ${ref} ); ${re

$^T inconsistant?

2004-07-08 Thread perl.org
I am doing something like: ( $data{sec}, $data{min}, $data{hour}, $data{day}, $data{mon}, $data{year}, $data{wday}, $data{yday}, $data{isdst} ) = localtime( $^T ); If I do this repeatedly on Windows for one invocation of a Perl script, the value of $data{sec} can vary by 1. Is there an explana

Re: $^T inconsistant?

2004-07-08 Thread perl.org
On 08 Jul 2004 17:59:26 +0100, Jose Alves de Castro wrote > Does it vary randomly, or does it just change after a while and stick > with the new value? It seems random - most of the time it gets one number, but just once in a while it gets that number plus one. I can't prove it (it's difficult to

Re: $^T inconsistant?

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 13:01:07 -0700, John W. Krahn wrote > > You like typing a lot? :-) You could use a hash slice. I'm not really a Perl programmer so I try to make the code clear to people coming from Java, C#, etc. (no remarks on my relative success are needed). This kind of construct seems f

Re: $^T inconsistant?

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 14:05:59 -0400, perl.org wrote > It seems random - most of the time it gets one number, but just once > in a while it gets that number plus one. I can't prove it (it's > difficult to track) but it seems like I can get the original value > after I

Re: $^T inconsistant?

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 15:06:49 -0700, John W. Krahn wrote > > then why are you using $/ instead of "\n" in your example? I used to use \n but have converted to $/. I thought I was doing this to be less platform-specific and that's more important to me than readability. I could be just making thing

Re: ${DBI::errstr} vs $DBI::errstr

2004-07-08 Thread perl.org
On Thu, 8 Jul 2004 10:57:28 -0400, perl.org wrote > > Looks good, except I think I noticed yesterday that if the error is actually > connecting to the database, errstr may contain the username and > password, which may then be visible to the user. Since RaiseError > seems to

Re: $^T inconsistant?

2004-07-08 Thread perl.org
On 08 Jul 2004 16:36:59 -0700, Randal L. Schwartz wrote > Maybe you'd be happier with: > > use Time::localtime; > printf "Year is %d\n", localtime->year + 1900; Nope - I don't feel that year logic should be in every piece of code that needs to know the date (so I would still have

Re: $^T inconsistant?

2004-07-09 Thread perl.org
On Fri, 9 Jul 2004 02:55:41 -0700, John W. Krahn wrote > > Perhaps you should keep the localtime data local to the sub (sort of > like a closure.) > > { my %data; > sub getDateTime { > unless ( %data ) { > @data{ qw[sec min hour day mon year wday yday isdst] } = > local

Re: delete vs undef

2004-07-09 Thread perl.org
On Fri, 9 Jul 2004 09:28:13 -0600, Wiggins d Anconia wrote > > > also, are these functionally equivalent? > > $myvar = undef(); > > undef($myvar); > > > > To my knowledge. Wait a second...I always thought undef was a constant value. Is it always a function or are there both? I don't know that

RE: Help with "use"

2004-07-09 Thread perl.org
On Fri, 9 Jul 2004 13:36:26 -0400 , Bob Showalter wrote > BOLCATO CHRIS (esm1cmb) wrote: > > I am receiving "/home/users/me/foo.pl did not return a true value at > > ./program1.pl at line 2" > > where line 2 is the "require". > > That's the semantics of "require" (see perldoc -f require). > > Th

regex help : find % not within <>

2004-07-09 Thread perl.org
Hello, I need to find all % characters in a string that are not element attributes. for syntax instance: some value% I need a regex that matches the % in value% but not in 100% because it is within angle braces. Is it possible or more complicated than regex? TIA, -John -- To unsubscribe

Re: regex help : find % not within <>

2004-07-09 Thread perl.org
On Fri, 9 Jul 2004 15:17:20 -0400, perl.org wrote > > I need to find all % characters in a string that are not element > attributes. for syntax instance: > > some value% > > I need a regex that matches the % in value% but not in 100% because > it is within angle braces

Re: warnings on old Perl

2004-07-09 Thread perl.org
On Tue, 06 Jul 2004 20:18:53 +0200, Gunnar Hjalmarsson wrote > > But if you want to ensure that warnings is enabled, the equivalent of > using the -w switch is to give the $^W variable a true value. Note > that unlike "use warnings;", this enables warnings dynamically, not > lexically. Hi Gunnar,

Re: Searching ahead in a file

2004-07-09 Thread perl.org
> From: ml-perl[at]thepierianspring.org (Randy W. Sims) > > Once > your program allocates memory, it can never be freed even if you > undefine every variable in your script. Will that memory be re-used by the existing Perl process, or is it just leaked? "Terrorism is a symptom, not the diseas

Optiperl

2004-07-09 Thread perl.org
Has anyone used Optiperl (http://www.xarka.com/optiperl/) and if so do you have any feedback on it? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: warnings on old Perl

2004-07-09 Thread perl.org
Also on this subject, is there some easy syntax that will use warnings if it is supported or set $^W otherwise, so I don't have to go through all the scripts (the vendor has upgraded their Perl distro to 5.6 with the current release we haven't migrated to yet)? -- To unsubscribe, e-mail: [EMAIL P

Re: warnings on old Perl

2004-07-09 Thread perl.org
On Sat, 10 Jul 2004 00:59:08 +0200, Gunnar Hjalmarsson wrote > > If you have made your scripts pass $^W (or the -w switch) without > generating warnings, you obviously don't need the flexibility that > "use warnings;" may offer, so there is really no need to replace $^W > with "use warnings;" just

Re: Split the line with "|" character

2004-07-09 Thread perl.org
> "Bob Showalter" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > You should write it like: > > > >split(/\|/, $line) > > > > or > > > >split('\|', $line) > > > > this will work (but don't do it this way) see why? > > > >split("\\|", $line) I don't see why you shoul

use module only if it exists

2004-07-13 Thread perl.org
I want my code to call some subroutines in a custom module only if that module exists on the system. I can think of at least three techniques to determine if the module exists: scan @INC, use UNIVERSAL::can (not sure that would work), or put the code in an eval block. What is the best solution?

Re: use module only if it exists

2004-07-13 Thread perl.org
On Tue, 13 Jul 2004 12:59:06 -0500, JupiterHost.Net wrote > I know of a module that is almost done with that has a function called Thanks, but unfortunately I'm working on a very restricted system (not being able to install custom modules on the production platform is actually the issue I'm facing

sub naming conventions

2004-07-13 Thread perl.org
Is there an established, documented best practice for naming subroutines in Perl? does it differ whether the subroutine is in a script or a module (I would like it to be clear in my scripts whether I am expecting something local or packaged). I have seen at least: some_function() someFunction()

Re: sub naming conventions

2004-07-13 Thread perl.org
On Tue, 13 Jul 2004 18:57:57 -0500, James Edward Gray II wrote > > perldoc perlstyle Thanks. I had done perldoc perl | find /i "nam" but didn't see anything that looked relevant. The people that maintain Perl apparently have a very different mindset than I do... -- To unsubscribe, e-mail: [EM

Re: sub naming conventions

2004-07-13 Thread perl.org
On Tue, 13 Jul 2004 19:17:06 -0500, Wiggins d'Anconia wrote > > Which particular style you happen to choose is less important, than > being consistent with it all the way through your programming. Good because according to that perldoc I am following about 10% of convention (though it is pretty

Getopt::Std vs. Getopt::Long

2004-07-14 Thread perl.org
I have been using Getopt::Std for some time and I'm pretty happy with it. I've been reading about Getopt::Long and it seems to support everything in Getopt::Std and has some nice conveniences. Does anyone have experience converting scripts (or just development process) from Std to Long? Does any

Re: $^T inconsistant?

2004-07-14 Thread perl.org
We can all breath a sigh of relief now that I believe I've identified this as my bug. I would say the true root cause is that Perl doesn't support prototyping properly and named parameters at all though... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

Re: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 11:05:45 -0600, Wiggins d Anconia wrote > > We can all breath a sigh of relief now that I believe I've identified > this as > > my bug. I would say the true root cause is that Perl doesn't support > > prototyping properly and named parameters at all though... > > > > properly

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 13:26:36 -0400, Bob Showalter wrote > > I second the "huh?" > > How did prototyping relate to the trouble with $^T? > > How do you define "support prototyping properly?" Basically because of my implementation of named parameters. I was passing -value instead of -seed and th

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 13:06:24 -0600, Wiggins d Anconia wrote > > Yikes, funny I see this as a feature. You were still passing the wrong > value, your sub should validate the parameters itself, presuming > thorough code, it would still have caused an error. No comprende. > Typed return value, yi

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 15:33:21 -0400, Bob Showalter wrote > > Except that those are different in much more that just "documentation". > Don't go that way... I still don't understand the reasoning for this - how could adding more to the sub signature be worse than not having any? Is there a URL tha

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 15:45:52 -0400, Bob Showalter wrote > perl.org wrote: > > > > I still don't understand the reasoning for this - how could adding > > more to the sub signature be worse than not having any? > > This is explained in perldoc perlsub. What se

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 15:55:35 -0400, Bob Showalter wrote > >It's probably best to prototype new functions, not retrofit > prototyping >into older ones. OK, unless I'm missing something, I will only prototype my functions, not the legacy code here. -- To unsubscribe, e-mail: [EMA

Re: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 15:31:00 -0500, James Edward Gray II wrote > > We're trying to teach you Perl. Please remember that. It's why you > are here. This sure can be an unfriendly list... > Most of us Perl users aren't big on prototyping. As far as I'm > concerned, it creates more issues than

Re: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 15:53:45 -0500, James Edward Gray II wrote > On Jul 14, 2004, at 3:39 PM, perl.org wrote: > > That was my Nice Voice, actually. Ask the list. I ran off some guy > using my Mean Voice recently. No problem, I tend to upset a lot of people in a lot of forums. P

RE: $^T inconsistant?

2004-07-14 Thread perl.org
On Wed, 14 Jul 2004 22:49:42 +0200, Jenda Krynicky wrote > > And does the language-that-should-not-be-named support this? > > ($x, $y) = some_function( $some, $params); Sure, a method can return an array (or a Hash, depending on your object types). It's just generally considered bad progr

Re: Still getting warning for "Use of uninitialized value in join or string " (Please Help)..

2004-07-15 Thread perl.org
On Thu, 15 Jul 2004 10:22:26 -0700 (PDT), jason corbett wrote > > $recordlist=join(",",@record); #This statement is causing the problem > I didn't follow the original thread, but if you put: select nvl( column, '' ) instead of just selecting the column, do you still get the warning? -- To

Filesystem Link Scanner

2004-07-26 Thread perl.org
I want to get a list of the distinct domains (like perl.org) in all href attribute values of anchor tags in all files under a given directory that end with the extensions .htm and .html. I don't need to know which files contain the links, I just want to know what domains are referenced. I

Re: Filesystem Link Scanner

2004-07-26 Thread perl.org
On Mon, 26 Jul 2004 11:27:50 -0400, perl.org wrote > I want to get a list of the distinct domains (like perl.org) in all href > attribute values of anchor tags in all files under a given directory > that end with the extensions .htm and .html. I don't need to know > which

RE: setting the environment variables in perl

2004-07-27 Thread perl.org
On Tue, 27 Jul 2004 11:58:51 -0400, Bob Showalter wrote > > It's really not a Perl issue per se. I assume you're talking about variables > used by Oracle libraries, like ORACLE_HOME and ORACLE_SID. > > I advise you to *not* attempt to set or monkey with these variables inside > the Perl script. T

sort files by extension

2004-07-28 Thread perl.org
I have a list of files I want to case-insensitive sort by extension, files with no extension appearing first. It should handle both Windows and Unix directory separators. I think I have working code, but I am interested in the various syntax for this one - there MUST be a better way than my feebl

Re: sort files by extension

2004-07-28 Thread perl.org
On Wed, 28 Jul 2004 14:04:26 -0400 (EDT), Jeff 'japhy' Pinyan wrote > On Jul 28, perl.org said: > > I would use File::Basename so that I can be sure it works on all > platforms. What is your take on files with multiple extensions, like > program.pl.bak or jeff.pinyan.tx

Re: sort by extension

2004-07-29 Thread perl.org
Thanks for the detailed response. I know the interspersed comments won't make some members of the list happy, but they're just opinions. On Wed, 28 Jul 2004 13:46:07 -0500, James Edward Gray II wrote > > Not a "fan" of map() and grep() or just don't understand them? Both, didn't understand them

Re: sort by extension

2004-07-29 Thread perl.org
On Thu, 29 Jul 2004 12:08:20 -0400 (EDT), Jeff 'japhy' Pinyan wrote > > That's why he broke it down. Is the map() really the problem, or is > it the regex, the ?: operator, and the two array references? All of the above ;), but now that I think about it the map looks easiest, then ?: (which I a

Re: Web Application with PERL or ASP.NET

2004-08-12 Thread perl.org
On Tue, 10 Aug 2004 12:36:30 -0700 (PDT), Joe Echavarria wrote > Hi there, > > The company i work is considering two tools for the > web version of a loan system. I need to prove that > perl is better that ASP.NET for the project. Can > anyone help me ?, is posible with perl have controls > ?,

"best" way to invoke command line

2004-08-27 Thread perl.org
I call command line tools constantly as the third-party application's API is not exposed to Perl any other way. I am wondering why there are at least three options for executing a command line (including backticks, system() and pipe), if there is a "best" way to invoke a command line, or what fa

RE: First module

2004-09-15 Thread perl.org
> you certainly have given this module more thought than I did, To be fair, I've had to write this for about 10 clients in 3 languages (Java, C# and Perl). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Site management - content deletion stage 1

2004-09-19 Thread perl.org
On Mon, 20 Sep 2004 12:26:45 +1000, Johnstone, Colin wrote > Gidday all, > > In our CMS (Interwoven Teamsite) I need to write a content deletion workflow. Typically a job (workflow) variable is set to indicate all files associated with the joy should be "deleted", maybe using a checkbox on the