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 restore them afterwards.  I want to be able to call 
my command line tool like:

my ${ret} = `command 2>&1`;

and have ${ret} get the both STDOUT and STDERR.  This piece gets called a lot 
so I want to avoid temp files if I can.  This has to work on Windows if that 
makes any difference (I think that means no /dev/console, etc.).  I know 
about:

open( RESTORESTDOUT, '>>&STDOUT' );

and I think I can restore the redirected STDOUT from there, but how to I open 
STDOUT so that it goes to the "console", as if it had never been redirected?

Hopefully this makes some sense.

TIA,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 strict;
};

This gives "Use of uninitialized value at" regarding the inner eval.  If I
change this to:

IWAPI::ExternalTasks::email( -files => [EMAIL PROTECTED], -area => ${area}, -wftask =>
${wftask}, -wfworkflow => ${wfworkflow} );

Then I do not get this message, but that would mean a big switch in my script
which I would prefer to avoid.  What would be happening differently when this
is invoked with eval that could cause this?  I am 100% certain that all of the
variables shown here are defined.  

Any clues would be greatly appreciated.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 could understand, but a repeated binary
value is a little weird.

C:\temp>type try.ipl
use strict;

use Data::Dumper;

use Win32::NetAdmin;

my @{users} = ();

if ( ! Dumper( Win32::NetAdmin::LocalGroupGetMembers( '', 'administrators',
[EMAIL PROTECTED] )))
{
print 'LocalGroupGetMembers call failed.' . ${/};
}

print Dumper( @{users} );

C:\temp>iwperl try.ipl
$VAR1 = '?¦nw?4';
$VAR2 = '?¦nw?4';
$VAR3 = '?¦nw?4';
$VAR4 = '?¦nw?4';
$VAR5 = '?¦nw?4';
$VAR6 = '?¦nw?4';
$VAR7 = '?¦nw?4';
$VAR8 = '?¦nw?4';
$VAR9 = '?¦nw?4';
$VAR10 = '?¦nw?4';
$VAR11 = '?¦nw?4';
$VAR12 = '?¦nw?4';
$VAR13 = '?¦nw?4';
$VAR14 = '?¦nw?4';
$VAR15 = '?¦nw?4';
$VAR16 = '?¦nw?4';
$VAR17 = '?¦nw?4';
$VAR18 = '?¦nw?4';
$VAR19 = '?¦nw?4';
$VAR20 = '?¦nw?4';
$VAR21 = '?¦nw?4';
C:\temp>iwperl -v

This is perl, version 5.005_03 built for MSWin32-x86

Copyright 1987-1999, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 around
> but haven't found an example.
> 
> $text =~ s/\r\n//g;
> 
> doesn't work.
> 
> --charlie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: s::LocalGroupGetMembers

2004-06-29 Thread perl.org
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 and it returns non-zero (error) without providing any information
about the error?

On Mon, 28 Jun 2004 17:37:12 -0700, Tim Johnson wrote
> That's because the SID is stored in binary, and when you try to print
> it, it tries to convert that binary value into a series of 
> characters, one of which is the beep sound (I know it doesn't make 
> 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 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 could understand, but a repeated
> binary
> > value is a little weird.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Win32::NetAdmin::LocalGroupGetMembers

2004-06-29 Thread perl.org
Thanks.  I hadn't thought to try this on my workstation but it works there, so
my guess is it's the version of Perl on the server (I don't think the library
is corrupt since I get the same results in dev and prod).  Unfortunately this
is from the vendor so I can't fix it.

This is perl, version 5.005_03 built for MSWin32-x86

Is there any way to get the users in a group in this version of Perl?

On Mon, 28 Jun 2004 09:57:36 -0500, Mike Flannigan wrote
> I just tried this on my Win2000 client machine and it gave
> the following:
> $VAR1 = 'Administrator';
> $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]>
> > To: [EMAIL PROTECTED]
> >
> > 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 could understand, but a repeated binary
> > value is a little weird.
> >
> > C:\temp>type try.ipl
> > use strict;
> >
> > use Data::Dumper;
> >
> > use Win32::NetAdmin;
> >
> > my @{users} = ();
> >
> > if ( ! Dumper( Win32::NetAdmin::LocalGroupGetMembers( '', 'administrators',
> > [EMAIL PROTECTED] )))
> > {
> > print 'LocalGroupGetMembers call failed.' . ${/};
> > }
> >
> > print Dumper( @{users} );
> >
> > C:\temp>iwperl try.ipl
> > $VAR1 = '?¦nw?4';
> > $VAR2 = '?¦nw?4';
> > $VAR3 = '?¦nw?4';
> > $VAR4 = '?¦nw?4';
> > $VAR5 = '?¦nw?4';
> > $VAR6 = '?¦nw?4';
> > $VAR7 = '?¦nw?4';
> > $VAR8 = '?¦nw?4';
> > $VAR9 = '?¦nw?4';
> > $VAR10 = '?¦nw?4';
> > $VAR11 = '?¦nw?4';
> > $VAR12 = '?¦nw?4';
> > $VAR13 = '?¦nw?4';
> > $VAR14 = '?¦nw?4';
> > $VAR15 = '?¦nw?4';
> > $VAR16 = '?¦nw?4';
> > $VAR17 = '?¦nw?4';
> > $VAR18 = '?¦nw?4';
> > $VAR19 = '?¦nw?4';
> > $VAR20 = '?¦nw?4';
> > $VAR21 = '?¦nw?4';
> > C:\temp>iwperl -v
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 and it returns non-zero (error) without 
> providing any information about the error?

When in doubt, shell out.

sub getGroupMembers
{
  my %{params} = IWAPI::SysUtil::normalizeParams( @{_} );
  my @{users} = ();
  my %{results} = IWAPI::SysUtil::run( -cmd => 'net localgroup ' .
${params{'group'}} );

  if ( ${results{'ret'}} != 0 || ${results{'out'}} !~ m#The command completed
successfully# )
  {
new IWAPI::Exception( -file => __FILE__, -line => __LINE__, -msg =>
${results{'msg'}} );
  }

  my ${parse} = undef;

  foreach my ${line} ( split( /[\r\n]+/, ${results{'out'}} ))
  {
if ( ${line} =~ m#^-{40}# )
{
  ${parse} = 1;
}
elsif ( defined( ${parse} ) && ${line} !~ m#\\# )
{
  ${line} =~ s#\s+$##;

  if ( ${line} ne '' && ${line} !~ m#The command completed successfully# )
  {
push( @{users}, ${line} );
  }
}
  }

  return( @{users} );
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 this? I've tried using both glob and
> readdir to go through the directory. Glob doesnt error out, but it
> doesnt change the links in the documents and when using readdir I get
> this error message. 
> Bad symbol for filehandle at ./recurse.pl line 15.
> 
> Thanks

A website with spaces in directory names?  Yuck.

Without seeing the code, hard to say, but try double-quoting the variable that
contains the filename on this line number.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 though).  I forgot to put the use line in the second module, but
the code still works (I fully qualify it like my ${smtp} = new Net::SMTP(
${params{'server'}} );.  Does that mean I don't need the use statements
anywhere if I fully qualify?  or does it work only because the second module
uses the first module that uses Net::SMTP?

I would like to avoid use statements if possible since they can result in
compiler warnings about circular references and it seems to parse the library
even when it doesn't need to, which seems like a performance concern.

Any light anyone could shed on all this would be greatly appreciated.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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:
> 
>   # some bigger loop
>   while (...) {
> my $line = "";
> 
> while () {
>   if (/\\ex|\\begin{instructions}/) {
> seek IN, -length, 1;
> last;
>   }
>   $line .= $_;
> }
>   }
> 



On Wed, 30 Jun 2004 16:32:00 -0400 (EDT), Jeff 'japhy' Pinyan wrote
> On Jun 30, David Arnold said:
> 
> >As I begin reading in lines from the file, I just print them until I hit a
> >line that has an opening "\ex" in it. At that point I want to accumulate
> >lines in one long string until I hit either "\begin{instructions}" or
> >another "\ex".
> >
> >$line.=   #unless the current line coming in from IN is the start
> >   #of a new \ex or a \begin{instructions}
> >
> >The difficulty is now I've read one line too many. I'd like to "put this
> >last line back" for the next round of reading while I process the
> >accumulated exercise lines.
> 
> I would suggest the following approach:
> 
>   # some bigger loop
>   while (...) {
> my $line = "";
> 
> while () {
>   if (/\\ex|\\begin{instructions}/) {
> seek IN, -length, 1;
> last;
>   }
>   $line .= $_;
> }
>   }
> 
> This uses the seek() function to go to a position in the file.  The last
> argument, 1, means we're moving relative to where we are now.  The middle
> argument, -length, is the number of bytes to move.  So if the line 
> is 20 characters long, we're going 20 characters back from where we 
> are now, essentially to the start of the line.
> 
> -- 
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
> CPAN ID: PINYAN[Need a programmer?  If you like my work, let me know.]
>  what does y/// stand for?   why, yansliterate of course.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 something like $^E on this list - what is that?), or some package variable?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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} = ;
> close( IN );
> 
> my ${ln} = 0;
> while( ${ln} <= $#lines + 1 )
> {
> # check ${lines[${ln}]} and manipulate ${ln} accordingly.
> }
> 
> > I would suggest the following approach:
> > 
> >   # some bigger loop
> >   while (...) {
> > my $line = "";
> > 
> > while () {
> >   if (/\\ex|\\begin{instructions}/) {
> > seek IN, -length, 1;
> > last;
> >   }
> >   $line .= $_;
> > }
> >   }
> > 
> 
> On Wed, 30 Jun 2004 16:32:00 -0400 (EDT), Jeff 'japhy' Pinyan wrote
> > On Jun 30, David Arnold said:
> > 
> > >As I begin reading in lines from the file, I just print them until I hit a
> > >line that has an opening "\ex" in it. At that point I want to accumulate
> > >lines in one long string until I hit either "\begin{instructions}" or
> > >another "\ex".
> > >
> > >$line.=   #unless the current line coming in from IN is the start
> > > #of a new \ex or a \begin{instructions}
> > >
> > >The difficulty is now I've read one line too many. I'd like to "put this
> > >last line back" for the next round of reading while I process the
> > >accumulated exercise lines.
> > 
> > I would suggest the following approach:
> > 
> >   # some bigger loop
> >   while (...) {
> > my $line = "";
> > 
> > while () {
> >   if (/\\ex|\\begin{instructions}/) {
> > seek IN, -length, 1;
> > last;
> >   }
> >   $line .= $_;
> > }
> >   }
> > 
> > This uses the seek() function to go to a position in the file.  The last
> > argument, 1, means we're moving relative to where we are now.  The middle
> > argument, -length, is the number of bytes to move.  So if the line 
> > is 20 characters long, we're going 20 characters back from where we 
> > are now, essentially to the start of the line.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 colored file to some other format I just 
> have no idea how to do it.
> 
> Thanks


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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, but it works.

By fully qualified I meant writing Net::SMTP::method() (which I generally do
to make it easier to read (for me at least), copy and paste code), as opposed
to just method().

As far as the compiler warnings, if I have module a which uses b and module b
that uses a and I perl -c one of the modules I get warnings about variable
redefinition.

Thanks again,

   -John

On Thu, 1 Jul 2004 09:42:59 -0600, Wiggins d Anconia wrote
> > 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.  
> >
> 
> The two key differences are that 'use' happens at compile time,
>  rather than runtime, and that 'use' automatically calls the 
> 'import' function of the module just loaded, if it exists.  More 
> often than not you can do 'use' instead of 'require', but realize 
> that I meant that as a generalization and as a generalization it is 
> inherently flawed.  If you choose to use a require, please check out,
> 
> perldoc -f eval
> 
> I am assuming the docs you mentioned having read were,
> 
> perldoc -f use
> perldoc -f require
> 
> If not you should have a read through them.
> 
> > 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 though).  I forgot to put the use line in the second
> module, but
> > the code still works (I fully qualify it like my ${smtp} = new Net::SMTP(
> > ${params{'server'}} );.  
> 
> The extra sets of braces are not needed in the above, aka ${smtp} 
> can be written $smtp.  Are you using 'use strict'?? That second call 
> is very weird...
> 
> Does that mean I don't need the use statements
> > anywhere if I fully qualify?  or does it work only because the second
> module
> > uses the first module that uses Net::SMTP?
> > 
> 
> It works because the second module is loading Net::SMTP.  You aren't
> actually fully qualifying anything that I see, aka fully qualified 
> would be,
> 
> $::variable = $Net::SMTP::
> 
> Or some such.
> 
> > I would like to avoid use statements if possible since they can result in
> > compiler warnings about circular references and it seems to parse the
> library
> > even when it doesn't need to, which seems like a performance concern.
> > 
> > Any light anyone could shed on all this would be greatly appreciated.
> > 
> > 
> 
> Show us some code, you shouldn't be getting circular references from 
> a simple 'use' statement loading a library.  And the library should only
> be loaded once no matter how many times you 'use' it.
> 
> I smell something fishy
> 
> http://danconia.org





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 reduce my syntax
errors (similar to never putting a variable inside a double-quoted string,
since the perl compiler won't find typos until runtime).  But I agree, to each
their own - hopefully I won't have to maintain your code and of course mine
meets all current and potential future/emerging requirements with no bugs so
no one will ever have to maintain mine.

> Fully qualified is ok (and needed in some instances) but make sure 
> you know the difference between, 
> 
> Net::SMTP::method() and Net::SMTP->method()

Nope, I don't really know the difference and in fact I would expect these to
be equivalent.  I don't think I would ever do either though - I think I would
instantiate an object and call the methods on that.

> Usually I would have thought you would have used,
> 
> $smtp = new Net::SMTP;
> $smtp->method;
> 
> Since I believe Net::SMTP is OOP, could this be part of your problems?

This is what I do - where did you see me do something else?  The code is a mix
of OO and static/procedural, and I always fully qualify both.  For instance,

my ${smtp} = new Net::SMTP( ${server} ); #OO

or:

my %{results} = IWAPI::SysUtil::run( -cmd => ${cmd} ); #static

> > As far as the compiler warnings, if I have module a which uses b and
> module b
> > that uses a and I perl -c one of the modules I get warnings about variable
> > redefinition.
> > 
> 
> Gotcha, are they exported variables?  

No.  I don't see much value in exporting - maybe another thing I should
research.  It's not like Java where I can define a variable or method as
public.  In fact the whole OO paradigm in Perl is a little nutty to me, though
I do see value in it.  Also, the modules may each have my variables by the
same name - I wonder if that could be the issue.

> There seems something fishy 
> with a design setup where a needs b and b needs a, seems like there 
> ought to be a c in there such that b needs c, a needs c, but c needs 
> neither a nor

I agree but I couldn't figure out how to resolve it.

> b.  How would you test such a dependency?

Not sure what you mean by test - I use the code every day and it works, it's
only perl -c that objects.

Anyway, my core issue has been resolved - I always need to explicitly either
use or require any module I access from my script.  Thanks a lot for your help.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 ($seen{$item}) {
# if we get here, we have not seen it before
$seen{$item} = 1;
push(@uniq, $item);
}
}
Faster

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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/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 ($seen{$item}) {
> > # if we get here, we have not seen it before
> > $seen{$item} = 1;
> > push(@uniq, $item);
> > }
> > }
> > Faster
> > 
> 
> Well, in order to get a uniq list, you /must/ visit every element of 
> the list. There are different ways to do this as demonstrated by the 
> Cookbook. The only (wee tiny) optimization missed is an optimization 
> that applies only to ordered lists: you only need to track the 
> previous element in order to determine if the current item is 
> unique. You don't need a hash.
> 
> The above becomes something like (untested):
> 
> my $prev = '';
> my @uniq = ();
> foreach my $item (@list) {
>  push(@uniq, $item) unless ($item eq $prev);
>  $prev = $item;
> }
> 
> You can also use a 'for' loop and avoid variables all together by 
> simply indexing into the array...
> 
> Randy.





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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.  If the authors
care, shouldn't they contact the ISP?  I mean, I can't police the internet
single-handedly.  And I think O'Reilly has probably already made enough take
on this particular snippet...

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 and I am on Windows
which may tend to ignore such conveniences anyway.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 inheriting class tries to call methods my custom
superclass - it says the method is not available to the subclass (Can't locate
object method "whatever" via package).  Does this mean all of the classes need
to have constructors?  If so, in my constructor, how do I explicitly call the
parent constructor?  And in the case of multiple inheritence, will it
automatically call all constructors in the ISA array?

I think I have to have a constructor in order to bless?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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;
> }

In the specific case of multiple inheritence, how do you know what SUPER even
is though?  I mean, is it just the first entry in @ISA?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




${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::name} I do not get these kinds of
warnings; I would like to understand the difference. 

It's possible the difference is the environment the process is running in - my
DBI code gets wrapped with a bunch of vendor code before execution, but my
Find code does not.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 need to pass the
name of one or more subroutines on the command line to another Perl script.  I
would like to avoid hard-coding the subroutine names on the command line and
at the same time automatically ensure I never pass the name of a subroutine
that does not exist.  I guess I need to abstract the subroutine names somehow
and I'm wondering what my options are.  I was thinking of having constants in
the module, one for each subroutine name, but there seems to be a little
duplication there.  When I'm composing the command line (in Perl), is there
some way I can check if a subroutine of a given name exists in the module?  I
would like to die under such conditions.

I know there is some way to get a reference to a subroutine.  If I can figure
out how to get this reference (which I assume would be undef or something if I
try to get a reference to a subroutine that does not exist) that would
probably help, but I am not sure of the syntax or if that's the right approach.

Are there reflection classes for dealing with things like this?

I did search the web (a little) but wasn't sure where to start in the perldocs.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 automated task in the workflow calls a perl
script which basically calls one or more of the subroutines in this module.  I
need to indicate to each call to the script which subroutines to invoke rather
than having multiple scripts, one for each possible combination of
subroutines.  If there's a better solution I am very open to it.

Thanks again,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 and password,
which may then be visible to the user.  Since RaiseError seems to always die
with errstr, I guess I can put eval around that, or is there a best practice
in that area?

Thanks,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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} );

${ref} = CGI->can( 'goober' );

print Dumper( ${ref} );

exit( 0 );

C:\temp>test.pl
$VAR1 = sub { "DUMMY" };
$VAR1 = undef;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




$^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 explanation for this?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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
track) but it seems like I can get the original value after I've gotten the
incremented value.  I will run some tests if I have time.

> I've tried in on my RH and it works fine... :-|

This is perl, version 5.005_03 built for MSWin32-x86

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 foreign to most other languages.  In fact I wish
localtime would return an associative array instead of a positional array (I
basically wrap localtime with a sub that converts the data to a hash).

> I don't know why it is changing, 
> (I can't see your entire program) but perhaps you should just store 
> the current time in a scalar and see if that helps.

It would have to be a global or environment variable, which I am hoping to
avoid (especially since this one should already contain the value).

Thanks,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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've gotten the incremented value.  I will run some tests if I 
> have time.

I have not been able to reproduce this in my drastically simplified test case;
it must be a bug in my code (while I've written my share of bugs I honestly
don't see how this could be one), a side effect of more complex interaction or
some other issue.

use strict;

my %data = getDateTime();
my $orig = $data{sec};
print 'Original seconds : ', $orig, ${/};

for( my $i = 0 ; ${i} < 500 ; $i++ )
{
  %data = getDateTime();
  my $sec = $data{sec};

  if ( $sec != $orig )
  {
print $sec, ' does not match original value ', $orig, ' : iteration : ',
${i}, $/;
  }
}

sub getDateTime
{
  ( $data{sec}, $data{min}, $data{hour}, $data{day}, $data{mon}, $data{year},
$data{wday}, $data{yday}, $data{isdst} ) = localtime( $^T );
  $data{year} += 1900;
  $data{mon}++;
  return( %{data} );
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 things harder for everyone - let me know if that's the case.

> The value in $^T should remain the same for the duration of the 
> program.  When it changes does it stay at the new value or does it 
> switch back to the old value?

I agree that it should remain the same, but it seems not to.  Basically I have
a logging function that can be called from anywhere in my code.  It determines
the log file name based on $0, $$, $^T, etc.  Every once in a while I see one
line written to a log that is very close to the right log file.  For instance,
 most of the data goes to:

jwest.CMIInstall.ipl.08-07-2004_09-00-02.2304.log

but a little is written to:

jwest.CMIInstall.ipl.08-07-2004_09-00-03.2304.log

As I was unable to reproduce the issue with the simplified test case I am
assuming that I've just lost more of my mind.  I think I remember seeing this
issue a few years ago (I wouldn't have posted if I wasn't pretty sure I had
seen a valid case).  Anyway if I can prove it I will summarize to the list.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 always die with errstr, I guess I can put eval around that, 
> or is there a best practice in that area?

Looks like in some contexts there should be an eval block around connect() to
ensure the password is not shown.  The pun in the output here was actually an
accident...

C:\temp>type db.pl
use strict;

use DBI;

my ${dbh} = DBI->connect( 'this', 'is', 'bad', { RaiseError => 1 } );

C:\temp>db.pl
Can't connect(this is bad HASH(0x1abf084)), no database driver specified and DBI
_DSN env var not set at C:\temp\db.pl line 5


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 to wrap it, which means parsing
an extra module, which may have an insignificant effect on performance).

Thanks though,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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] } = 
> localtime $^T;$data{ year } += 1900;$data{ 
> mon }++;}return %data;} }
> 

I read about closures in the the o'reilly objects, classes and references
book, but I don't think it sunk in.  Would this work if this sub is in a
module?  Does this basically make %data the equivalent of a Java static, where
all calls to the sub get the same variable?  If the caller undefs all
references to %data, won't %data disappear?  I don't see how the syntax of
putting it in another set of braces makes it a closure (don't have the book
with me today).  Anyway if you have time to answer any of these issues I would
appreciate it.  For now, until I can prove (at least to myself) that $^T is
changing I'm going to leave the code as it is, but I would like to understand
more about closures (not sure that's for a beginner's forum?).

Thanks again,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 it matters but I prefer to show
the parens when I invoke a function, but everywhere in my code I have $var =
undef;.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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).
> 
> The standard idiom is to place
> 
>   1;
> 
> at the end of foo.pl, so that the last expression evaluated will be true.

To be more explicit (for people coming from non-Perl backgrounds taking
ownership of the code) I like to use:

#-
# DO NOT REMOVE THIS return( 1 ) - INDICATES SUCCESS TO PERL COMPILER.
#-

return( 1 ).



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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.
> 
> Is it possible or more complicated than regex?

Just to make it more fun, sometimes the < and > are encoded as < and > -
I would hope for a regex that ignores both.  I was thinking I could remove the
elements with s#<[^>]+>##g before comparison but I'm not sure how to code the
regex if > might be >.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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,

For modules, can I just put this after the package declaration, or do I have
to put it in each subroutine?

$^W = 1;

Thanks,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 disease" - bumper sticker.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 because Perl is upgraded.

Actually I've just started adding $^W to my scripts and modules and haven't
seen any warnings yet.  What could I insert to generate a warning?  I'm not
sure what the difference between strict and warning is (I have always used
strict and resolved any "warnings" that can generate).


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 shouldn't to do it any of these ways (though I agree the
first is most clear).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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?  I think
an eval block sounds right, but I'm not sure.  My guess would look something like:

eval
{
  use module;
  module::subroutine();
};

But the use statement of course throws a compiler error, so I think the
appropriate thing is to put this code into a string and eval that.  But this
code is going to get replicated to a large number of files and I want the
shortest syntax possible, or if there is some better way...

TIA,

   -John




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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, so I couldn't install your module there...).


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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()
SomeFunction()

TIA,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 consistant), and I would more prefer to be able to read
my own code than worry that someone else would only be able to read code
styled according to Larry.

There is still a question here - is there any convention difference between
local sub names (in the script) and sub names in modules?  I guess I can
always name my local subs lsWhatever if there is no established convention.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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
anyone have pretty good code examples using Getopt::Long?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 PROTECTED]
 




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, huh?  and huh?
> 
> http://danconia.org

It would be nice to have a discussion on prototypes - from what I understand
they are not really enforced and I have even seen some suggestions on how to
change them.

As far as named parameters, I mean like most languages, something like:

sub whatever( param1, param2 )
{
  if ( param1 )

I get around this by calling whatever like

whatever( -param1 => value, -param2 => value )

then 

sub whatever
{
  my %{params} = normalizeParams( @{_} )

but this is obviously broken as the params aren't validated, resulting in my
original defect.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 the sub was expecting -seed.  If I had been using
named parameters instead of hash keys this would not have been possible. 

By prototyping I really mean named and typed parameters and a typed return
value (like C).

I mistyped on my last post - I have seen suggestions that prototypes should
not even be used.  Is there a difinitive answer on this?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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, yikes, you have just cut out half of the value of
> using a 4GL... Back to C with you! ;-)  Let's see if we can get P5P 
> to implement pointer arithmetic for references...uh

No, Java has this and no pointer arithmetic is required.

> As Bob stated, I have never used them, though I don't consider 
> myself a true guru.

I would like to use them if just for documentation purposes - it is just
slightly more clear to me to see

sub something( $$$ )
{

than

sub something
{

Still nothing near what I would hope for in 2004, but at least a step.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 that describes why
prototypes are bad?  and if they're bad, why are they in the implementation at
all, why don't they generate warnings and why are they not documented to be
deprecated?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 section are you referring to?  The version I have has section on
prototypes but nothing seems to indicate that they shouldn't be used (is there
something specific I should grep for?).

This does kindof make me laugh though:

"Alphanumerics have
been intentionally left out of prototypes for the express purpose of
someday in the future adding named, formal parameters"

Sorry in advance to anyone who will inform me that's copyrighted content.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 it solves.

This is what I'm trying to understand - what issues does it create?  I still
don't have a real answer.  In fact, in one response on why *not* to use
prototypes, the content included "it's probably best to prototype new functions".

> Welcome to Perl.

I've been programming Perl for about 10 years.  I do hate the syntax and other
annoyances when I return to Perl from Java or C#, but I also appreciate the
flexibility.  I hope to use this list as a forum for what I hope are best
practices and to further my understanding.  If I am not welcome here, just let
me know.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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.  People seem a
little over-invested in their knowledge sometimes, and
resultantly/inappropriately resistant to change/progress (though Perl 6 scares
me too).  There should be some kind of tone flag in email clients.  I'm a
joker, just keep that in mind.

> My main reason is that Perl's Method Dispatch bypasses them 
> altogether.   That makes them useless with objects and thus useless 
> to me most of the time.

I agree but I think that's a problem with the Perl engine, not with my use of it.

All the best,

   -John

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 programming practice, like storing
multiple values in a single database column.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 don't care
about JavaScript links, and the Perl code would not have to crawl over http,
just scan a filesystem.  It seems really easy - File::Find and
HTML::TokeParser, parse each file matching the criteria and populate an
associative array.  If someone has already written and tested something that
functions like this and would be willing to share code, I would have to make
slight modifications which would save me some time.  Otherwise I would be
interested in suggestions for how to write one.  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 files contain the links, I just want to know what domains are 
> referenced.  I don't care about JavaScript links, and the Perl code 
> would not have to crawl over http, just scan a filesystem.  It seems 
> really easy - File::Find and HTML::TokeParser, parse each file 
> matching the criteria and populate an associative array.  If someone 
> has already written and tested something that functions like this 
> and would be willing to share code, I would have to make slight 
> modifications which would save me some time.  Otherwise I would be 
> interested in suggestions for how to write one.  

Here's what I came up with.  Suggestions greatly appreciated...

use strict;

use File::Basename;
use File::Find;

use Getopt::Std;

use HTML::TokeParser;

my %{opts} = ();
main();
exit( 0 );

sub main
{
  lsHandleArgs();
  my %{exts} = ();
  my %{found} = ();

  File::Find::find( sub
  {
my ${path} = ${File::Find::name};
lsMessage( ${path} );

if ( -f ${path} && ${path} =~ m#\.([^\.]+)?$#i )
{
  my ${ext} = lc( ${1} );

  if ( ! defined( ${exts{${ext}}} ))
  {
${exts{${ext}}} = 1;
  }
  else
  {
${exts{${ext}}}++;
  }

  if ( ${ext} =~ m#^html?# )
  {
my ${parser} = new HTML::TokeParser( ${path} );

while( my ${token} = ${parser}->get_tag( 'a' ))
{
  my ${url} = lc( ${token}->[1]{'href'} || '-' );
  ${url} =~ s#\#.+##;

  if ( ${url} =~ m#^(http|ftp)#i )
  {
${url} =~ s#^.+//([^/]+)/?.*#${1}#;
${found{${url}}} = ${path};
  }
}
  }
}
  }, ${opts{'d'}} );

  foreach my ${key} ( sort( keys( %{exts} )))
  {
print ${exts{${key}}} . ' ' . ${key} . ' files.' . ${/};
  }

  print join( ${/}, '', sort( keys( %{found} )));
}

sub lsHandleArgs()
{
  my @{args} = @{ARGV};

  if ( ! Getopt::Std::getopts( 'd:hv', \%{opts} ))
  {
lsUsage( 'invalid command line parameters' );
  }
  elsif ( defined( ${opts{'h'}} ))
  {
lsUsage( 'usage information requested' );
  }
  elsif ( $#{ARGV} > -1 )
  {
lsUsage( 'unrecognized command line parameters : ' . join( ' ', @{ARGV} ));
  }

  if ( ! defined( ${opts{'d'}} ))
  {
lsUsage( '-d : directory required' );
  }
  elsif ( ! -d ${opts{'d'}} )
  {
lsUsage( '-d : ' . ${opts{'d'}} . ' does not exist or is not a directory :
' . ${!} );
  }

  @{ARGV} = @{args};
}

sub lsUsage( $ )
{
  my ${msg} = shift( @{_} );
  my ${script} = File::Basename::basename( ${0} );
  my ${params} = join( ' ', @{ARGV} );
  print <  Directory (or workarea) to scan
-hHelp (display usage information)
-vEnable verbose (debug) mode

${script} : parameter dump : ${params}

${script} : ${msg} : exit 1

END_USAGE

  exit( 1 );
}

sub lsMessage
{
  if ( defined( ${opts{'v'}} ))
  {
foreach my ${msg} ( @{_} )
{
  print scalar( localtime( time())) . ' : ' . ${msg} . ${/};
}
  }
}


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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. The whole point of environment variables is so the 
> user can establish his environment *before* invoking your script.

I agree with this in general, but sometimes the environment in which your Perl
runs cannot define these variables for you.  For instance, Interwoven TeamSite
Data Capture Template inline callout invocations clear all environment
variables before forking your process (the vendor claims this is for security
reasons).  For Oracle you must set ORACLE_HOME, etc, and for SQL Server you
have to define SYSTEMROOT or something like that or ODBC or whatever doesn't
work.  If coded, this logic of course belongs in a module.  

I also sometimes use environment variables to hold global configurables when
it is not feasible to pass these values to the subroutines that need them. 
It's faster for the subroutine to use an environment variable than to do a
lookup into a flat file to get some configuration info.  If I put this in the
environment before forking the process the space would be cluttered.  If
there's a better way to cache global confgiurables or other feedback on these
subjects I am all ears - I don't like using the environment, let alone setting
values that should be set elsewhere.

Thanks,

   -John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 feeble attempt:

use strict;

my @input = ( '/path/to/file/with.ext', '/path/to/file/with.htm',
'/path/to/file/without', '/path/to/file/with.eml', '/path/to/file/with.pdf' );
my @output = sort
{
  my $ex1 = '';
  my $ex2 = '';

  if ( $a =~ m#[^\\/]\.([^\\/]+)$# )
  {
$ex1 = $1;
  }

  if ( $b =~ m#[^\\/]\.([^\\/]+)$# )
  {
$ex2 = $1;
  }

  return( lc( $ex1 ) cmp lc( $ex2 ));
} @input;

print join( $/, @output );

C:\temp>sortext.pl
/path/to/file/without
/path/to/file/with.eml
/path/to/file/with.ext
/path/to/file/with.htm
/path/to/file/with.pdf

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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.txt?

Excellent point about basename - I knew of the module, not sure why I didn't
use it.  For multi-extension files (which there shouldn't be, it's a website)
I just want the last extension.  Now to find out which basename returns...

Thanks,

   -John





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




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 and still find them hard to read.  I have to
worry about programmers with no Perl experience maintaining the code, and
since these structures don't seem to exist in any other languages they are
intimidating.  Plus, the Perl may need to get ported to Java or C#, which is
easiest if the logic structures can be similar.  I would only use them if they
significantly improve performance, not to reduce typing (since then I would
have to type a long comment reminding me what the logic does - your
explanation of this solution is precise but lengthy).

> It's 
> easier to read that code bottom to top, so let's start with:
> 
> map { m/\.([^.]+)$/ ? [$_, $1] : [$_, ''] } @input;

Unfortunately I really don't find this easy to read.

> Are you a "fan" of sort()?  It works just like map() and grep().

I like the convenient functionality, but I don't like the syntax.  I don't
understand why there is no between logic and @data here:

print join( $/, sort( { $a <=> $b } @data ));

These are the kinds of idiosyncrasies that make Perl difficult when coming
from other languages.

>  I think you'll surprise yourself and hopefully, become a "fan"...

I agree, I could really use these, but the fact is I probably won't be
programming Perl much longer so I may not make the effort.  If I could just
think of a way to make them clear to other programmers - maybe I'll just link
to your post in the docs.  Again, thanks for the thorough explanation.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 also prefer not to use, along with unless).  At least map is a
word instead of a (cryptic) token.

> >I like the convenient functionality, but I don't like the syntax.  I don't
> >understand why there is no between logic and @data here:
> >
> >print join( $/, sort( { $a <=> $b } @data ));
> 
> I'm not sure I understand YOU.  Did you mean "... why there is COMMA
> between THE SORT logic and @data here:"?  That makes more sense.

Yep, typo on sort, thought the other was obvious.

> The reason there's no comma is because Perl's grammar says you don't 
> put commas after blocks like that.

Great, maybe this is what I'm missing - what is the difference between
sort/map/grep blocks and other blocks?  I don't understand why I would want
multiple syntaxes for what I consider function calls.  Just out of curiosity,
what other functions/blocks work this way?

Thanks again,

   -John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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
> ?, data grids ?, date controls ?, the way that asp.net
> works ?, why perl is better ?, give examples of robust
> web applications writtern in perl , links, examples,
> etc. anything that could help me prove that perl is
> better for the project. 

This is major flamebait and I'm not going to try to address all potential
objections to this post.  What is the reason that Perl must be justified over
.NET?  Has the decision been made and you are just rationalizing it, do you
have Perl skills and fear of learning .NET, or what is the motivation?

What might be more interesting might be a comparison of Perl against Java. 
Also, try to factor out the M$ concerns - I believe Mono will port .NET to
Linux over time.

I think to a great extent the answer depends on your requirements, developer
toolsets and the applications that must be provided (integrated) on the site.  

Personally, I'm more productive on a number of levels in Visual Studio than in
vi, textpad, etc., but then that's another cost (in addition to the IIS M$
licensing, security concerns, vendor dependence, etc.).  And be aware that (at
least poorly-written) Perl has it's own security concerns.  I don't think
there's much that can justify Perl in this context - a lot of what you're
looking for are UI components that *can* be built with Perl, but are much
easier in a drag-and-drop UI like Visual Studio.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




"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 factors are taken into account to determine
which to use.  Generally I want the program to wait for the command to
complete (so I think exec() is not an option), and I want the return code,
STDOUT and STDERR from the command (so I don't think system() works for me as
it doesn't give the command's output.
  
I would assume that the pipe is most flexible, but I was unable or too lazy to
get it working reliably.  If this is the right approach I will give it more time.

So I generally use backticks, but what I (sometimes) don't like about this is
that it merges STDOUT and STDERR unless I redirect each to a temp file.  Since
sometimes I actually do want the ordered mix, I guess I want one routine that
returns an associative array of everything - OS return code, STDOUT, STDERR,
and merged STDOUT and STDERR, without using temp files.

TIA,

   -John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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 job 
instantiation form.  Consider renaming the DCRs instead of deleting them so 
users can get back to the data, see history and restore lost content more 
easily.

> If a user is deleting a html page I need to parse that page and 
> report on all assets (images, pdfs) attached to the page and delete 
> them as well.

There are HTML parser modules, but what if something else references one of 
those assets?  Review becomes important before deleting the files.  A link 
check could also be important, but you also might not want to actually 
delete the files from TeamSite until the very end, so you may need to deploy 
a file list from an empty directory to delete the files from a "staging" 
environment before running link scan.  If you are generating emails with CCI 
links, check the variable and put "WARNING" in the subject line.

> How do I go about doing this? I'll do the legwork just broadbrush 
> the approach.

You probably want an externaltask before approval that parses 
all .htm, .html, etc. files for img, href, etc. references, attaching each 
to the task.  If those assets could be in another branch, that really 
complicates things as each task can only be associated with one area and you 
need a tasks for each area, or externaltask logic that knows about the other 
areas.  You may need some special submittask options to ensure the deletions 
are committed (I usually implement submit as externalltask) and OpenDeploy 
configuration to support deletion.  If you are using DataDeploy there are 
probably additional considerations.

Thing modularization.  Interwoven has tools representing job task; use the 
method for retrieving the list of files associated with that and any actions 
available for adding files, etc.  Subclass these if the behaviours you need 
aren't provided; this generally involves calling the Command Line Tools.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]