Re: Mail::Send question

2003-08-02 Thread gregg
On Friday, August 1, 2003, at 11:09  PM, Wiggins d'Anconia wrote:

Camilo Gonzalez wrote:
Wiggins d'Anconia wrote:
Scot Robnett wrote:

Is there any way to force Mail::Send to accept a From name, as 
opposed to
simply sending and using the hostname by default? I don't see 
anything in
the docs about setting the From field in the headers.

(of course, I can just open a pipe to sendmail, but I want to see 
if there's
a way to pull this off first...)

Definitely avoid this if possible, there are numerous mail message 
modules, one of them is bound to provide what you need.
Why is sendmail held in such low regard by this group?



Sendmail itself most of this group will hold in very high regard, as I 
do. It is the method by which it is invoked that is not held in high 
regard. A mail message is a very complex beast, and getting more 
complex by the day, and most programmers don't know enough about it to 
construct a message properly, and they shouldn't, why bother when 
there are so many well designed and properly coded modules available 
that will do it for you. On top of that sendmail is not necessarily on 
every system or running on all systems, so by allowing code to use a 
module it is more likely to be portable to different systems, etc. On 
top of all of this sendmail itself is incredibly complex and most 
people do not know how to properly invoke it, etc.

In most cases sendmail probably provides the mechanism for actually 
transferring the message however the details can be hidden from the 
programmer by a module, which makes his life much easier.  It is this 
same reasoning why the CGI module should be used rather than parsing 
an HTTP request directly, parsing query strings or cookies, etc.
Just use the Perl Sendmail module:

http://search.cpan.org/dist/Mail-Sendmail/Sendmail.pm

It will run on any platform.  After all, if I can understand it, 
anybody can.

Gregg Allen


http://danconia.org

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


passing variable to module

2003-08-02 Thread awarsd
Hi,

I currently have a script that has all the password and path for my scripts.
and I have module that uses them.
i.e
#!/usr/bin/perl
## script.pl -- name of script
require 'config.pl';
use lib  '/home/site/module';
use Test;
---
now let say we have in config.pl
$passvar = ' test';

To use the variable in my module 'Test', should I do
$::passvar or $main::passvar?

And how should i declare the variable, Should i only declare in script.pl?
or in config.pl?

Thank you for any help

Awards



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



Re: passing variable to module

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, awarsd said:

now let say we have in config.pl
$passvar = ' test';

To use the variable in my module 'Test', should I do
$::passvar or $main::passvar?

Both of them refer to $main::passvar, so either would work.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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



Re: regex grep andING search words together

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, Alan C. said:

#!/perl/bin/perl -w
use strict;
#map  join from @ARGV into $pattern snipped
my $pattern='(?=.*doc)(?=.*sort)';
#print $pattern;
#directory files foreach file to be searched snipped
if (s/^H=($pattern)/$1/io) {
  print $fil:$_ ;
  }
#end

In the map and join line I tried \b

(?=.*\bdoc\b)

but the pattern got messed up, part of the pattern got cut off.

If the map  join line is the one you worked on, why did you omit it from
your code?  Chances are, that's where the problem lies.  Perhaps you used
doubled quotes around that part of the pattern?

  my $pattern = join , map (?=.*\b$_\b), @ARGV;

Is that what your code looks like?  If so, the problem is that \b, in
double quotes, means backspace.  In order to get around this, you'll
need to either double the backslash, or use different quoting:

  my $pattern = join , map (?=.*\\b$_\\b), @ARGV;
  my $pattern = join , map '(?=.*\b' . $_ . '\b)', @ARGV;

For reasons that are probably obvious, I prefer the first of those
approaches.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



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



use lib problem

2003-08-02 Thread awarsd
Hi,

I have a problem maybe it is normal.
My problem is with using lib
now to retrieve my module i do this
use lib /path/to/Module;
it works just fine
but created a configuration file.
with $dir = '/path/to';
and when i do
use lib $dir/Module;
it give me an error I also tried use lib qw() but same problem is there a
way to fix the problem??

regards
awards



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



Re: Uploading files

2003-08-02 Thread Li Ngok Lam

- Original Message - 
From: K. Parker [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 12:00 PM
Subject: Uploading files


 On a site I'm developing, I'm trying to create a script that uploads
 encrypted files and saves them in a particular directory.

You will do in this way :
1. Create a html form which have a file type input.
2. Then write a CGI program to pick up the form
3. Read the Data from what you get.
4. Write the data to anywhere in your host as whatever file.
5. Done


 While the CGI mod
 had documentation about how to get an upload field up, I don't know how to
 actually upload the file entered by a user and save it in
Uploaded_Files/.

you will write a html form like this :
form method=post enctype=multipart/form-data action=yourscript.pl
input type=file name=file
input type=submit
/form

You will then use CGI to pick up the file, while I will use my own GetForm
module.
Anyway, those data are just going as a scalar data, so you can write them to
anywhere
(If you have the rights to do so) with a file handle which is open for
write.


 And secondly, I'm clueless as to how I can ensure that I'm not uploading a
 virus.  Like I said, all the files will be encrypted, and that by a third
 party whose encryption I (obviously) can't crack.  So there is no
 Content-type or similar denotation.

As you've wrote on the top, you are going to receive an encrypted  file,
so the
encryption is done on the users side, Is that right ? Maybe I don't
understand well,
so I would like to ask what kind of encryption you are using and what kind
of
file you would likely to be received(Binary or Text). For my knowledge,
encrypted
stuff are being somewhat like text, at least no exectutive stuff. So, there
is nothing
to deal with about virus


HTH



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



Re: use lib problem

2003-08-02 Thread Li Ngok Lam

- Original Message - 
From: awarsd [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 10:01 PM
Subject: use lib problem


 Hi,

 I have a problem maybe it is normal.
 My problem is with using lib
 now to retrieve my module i do this
 use lib /path/to/Module;
 it works just fine
 but created a configuration file.
 with $dir = '/path/to';
 and when i do
 use lib $dir/Module;
 it give me an error I also tried use lib qw() but same problem is there a
 way to fix the problem??

 regards
 awards


I am not sure, but I bet a guess, use is activated at comiple time, that
means
use $dir/Module is still going earlier than $dir = path/to even the
declaration
of $dir is going earlier than use lib...

In case if you want to do this, you may try ;
package blah;

BEGIN{ $dir = path/to }
use lib $dir/Module;

1;





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



Re: use lib problem

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, awarsd said:

use lib /path/to/Module;
it works just fine

with $dir = '/path/to';
use lib $dir/Module;
it give me an error I also tried use lib qw() but same problem is there a
way to fix the problem??

The problem is that 'use' is a compile-time directive, whereas assigning a
value to $dir happens at run-time.

When Perl runs your program, it does a preliminary sweep over it, and does
things like include modules when 'use'd, and execute BEGIN blocks.

A statement like 'use lib ...' is really just

  BEGIN {
require lib;
lib-import(...);
  }

so it happens at compile-time.  This means that your variable $dir, which
gets assigned at run-time, won't have a value when you need it to.  Here's
a simple demonstration:

  $x = 2;
  BEGIN {
print x is '$x'\n;
  }

That prints x is '', because the BEGIN block happens before we set $x to
2.  You probably want to require() your config file in a BEGIN block
before you do 'use lib'.

  BEGIN { require my_vars.pl }
  use lib $dir/...;

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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



Re: use lib problem

2003-08-02 Thread awarsd
Hi,

I messed around and found that
if in config i do $datadir = /my/path/;
instead o f$datadir= /my/path;

then in my script i do
#!/usr/bin/perl
require 'config.pl';
use $datadir.Module;

everything works again.
Thanx for the suggestion tough because i didn't know how to use BEGIN now i
do :-

Awards



Jeff 'Japhy' Pinyan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Aug 2, awarsd said:

 use lib /path/to/Module;
 it works just fine

 with $dir = '/path/to';
 use lib $dir/Module;
 it give me an error I also tried use lib qw() but same problem is there a
 way to fix the problem??

 The problem is that 'use' is a compile-time directive, whereas assigning a
 value to $dir happens at run-time.

 When Perl runs your program, it does a preliminary sweep over it, and does
 things like include modules when 'use'd, and execute BEGIN blocks.

 A statement like 'use lib ...' is really just

   BEGIN {
 require lib;
 lib-import(...);
   }

 so it happens at compile-time.  This means that your variable $dir, which
 gets assigned at run-time, won't have a value when you need it to.  Here's
 a simple demonstration:

   $x = 2;
   BEGIN {
 print x is '$x'\n;
   }

 That prints x is '', because the BEGIN block happens before we set $x to
 2.  You probably want to require() your config file in a BEGIN block
 before you do 'use lib'.

   BEGIN { require my_vars.pl }
   use lib $dir/...;

 -- 
 Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
 RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 stu what does y/// stand for?  tenderpuss why, yansliterate of course.
 [  I'm looking for programming work.  If you like my work, let me know.  ]




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



Re: use lib problem

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, awarsd said:

I messed around and found that
if in config i do $datadir = /my/path/;
instead o f$datadir= /my/path;

then in my script i do
#!/usr/bin/perl
require 'config.pl';
use $datadir.Module;

everything works again.

I don't know how everything works.  You haven't changed the problem at
all.  That gives me a syntax error.  And even if it didn't, you haven't
changed the fact that 'use' is using $datadir, which HAS NOT BEEN DEFINED
yet.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



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



Re: use lib problem

2003-08-02 Thread awarsd
Hi,

no sorry it is not use but use lib $datadir.Module;
just a typo

awards

Jeff 'Japhy' Pinyan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Aug 2, awarsd said:

 I messed around and found that
 if in config i do $datadir = /my/path/;
 instead o f$datadir= /my/path;
 
 then in my script i do
 #!/usr/bin/perl
 require 'config.pl';
 use $datadir.Module;
 
 everything works again.

 I don't know how everything works.  You haven't changed the problem at
 all.  That gives me a syntax error.  And even if it didn't, you haven't
 changed the fact that 'use' is using $datadir, which HAS NOT BEEN DEFINED
 yet.

 -- 
 Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
 RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 stu what does y/// stand for?  tenderpuss why, yansliterate of course.
 [  I'm looking for programming work.  If you like my work, let me know.  ]





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



Re: use lib problem

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, awarsd said:

no sorry it is not use but use lib $datadir.Module;

That doesn't change the fact that $datadir does NOT have a value when the
'use' line happens.  Is the require() being done in a BEGIN block?  If so,
you neglected to show us that as well.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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



Re: use lib problem

2003-08-02 Thread awarsd
Hi,

here is the actual top of the file


#!/usr/bin/perl

use CGI qw(:standard);
use DBI;

require /path/to/config.pl;
 ##inside config.pl it has $dataDir
##$dataDir = /path/to/;
use lib $dataDir.Module;
use Test;
...

Should I declare variable i.e
my $datDir inside the program or in the config.pl??
Also should i declare in module $main::dataDir like
my $main::dataDir; or I can just leave $main::dataDir??

Anthony



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



Re: use lib problem

2003-08-02 Thread Jeff 'japhy' Pinyan
On Aug 2, awarsd said:

#!/usr/bin/perl

use CGI qw(:standard);
use DBI;

require /path/to/config.pl;
 ##inside config.pl it has $dataDir
##$dataDir = /path/to/;
use lib $dataDir.Module;
use Test;

You named your module Test?  That's why you're getting a false positive.
There's a standard module named Test; it's being use'd, instead of your
module.

The 'use lib ...' statement happens at COMPILE-time.  The 'require ...'
statement happens at RUN-time.  COMPILE-time is before RUN-time, so 'use
lib ...' happens first, and $datadir is EMPTY then, because it hasn't been
filled, because 'require ...' hasn't happened yet.

You must do two things:

1. rename your module, to something like MyStuff.pm
2. put the 'require ...' code inside a BEGIN block

  BEGIN { require /path/to/config.pl }
  use lib $dataDir/Module;
  use MyStuff;

Should I declare variable i.e
my $datDir inside the program or in the config.pl??
Also should i declare in module $main::dataDir like
my $main::dataDir; or I can just leave $main::dataDir??

If you declare any my() variables in config.pl, NO OTHER FILE can see
them.  Therefore, do NOT make $dataDir a my() variable.  Furthermore, a
my() variable CANNOT belong to a package, so you can't say my $main::var.
It just doesn't make sense.

Leave your variables as they are.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
stu what does y/// stand for?  tenderpuss why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



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



[ot: test] Re: use lib problem

2003-08-02 Thread Randal L. Schwartz
 Jeff == Jeff 'Japhy' Pinyan [EMAIL PROTECTED] writes:

Jeff On Aug 2, awarsd said:
 #!/usr/bin/perl
 
 use CGI qw(:standard);
 use DBI;
 
 require /path/to/config.pl;
 ##inside config.pl it has $dataDir
 ##$dataDir = /path/to/;
 use lib $dataDir.Module;
 use Test;

Jeff You named your module Test?  That's why you're getting a false positive.
Jeff There's a standard module named Test; it's being use'd, instead of your
Jeff module.

This may be the first occurance in the wild of the test overload,
comparable to naming your Perl program test and then wondering
why it doesn't generate any output when invoked as

$ test

because that's actually executing the shell built-in called test.
You have to use

$ ./test

to get the program to run.  Hence, in the Llama, we advocate always
starting a proggram with ./ if it's in the current directory.

print Just another Perl [book] hacker,

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: deleting files from the directory from a file list. Please Help!

2003-08-02 Thread R. Joseph Newton
perlwannabe wrote:


 Not at all.  I am checking various sources for this problem.  The
 responses on the usenet were helpful...but the problem remains.  I came to
 the mailing list to have a direct dialogue with individuals rather than a
 post that will get lost in two days.  I am appreciative for the assistance
 in the newsgroup, but I would also like to get the problem solved.  I am
 certainly not an uber perl programmer, but I am not a novice.  Perhaps
 that is why this problem is bugging me so.  BTW...I am also continuing the
 thread in the newsgroup as well.

 If this is some breach of etiquette for this mail list I will certainly
 abide by the rules.  It wasn't meant to offend or be discourteous.  Please
 let me know.

You're fine, as far as cross-posting goes.  The posts to each group were
discrete, thus avoiding the main negative effect of cross-posting--that
replies find their way to lists where the responcant may not have permission
to post.  Just do it mindfully when you do it, knowing the reason for
addressing each group.

Joseph



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



c compiler needs

2003-08-02 Thread Hodge, Jeff F (ECIII)

while config-ing perl 5.8.0 with 
sh Configure -Accflags=-DPERL_Y2KWARN -DPERL_POLLUTE_MALLOC

 I am getting an error that I need a C compiler...but I have gcc installed
through SuSe 8.0 linux...

What's the deal?


RE: c compiler needs....disregard

2003-08-02 Thread Hodge, Jeff F (ECIII)

Please disregard.

tks
-jh
-Original Message-
From: Hodge, Jeff F (ECIII) [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 2:33 PM
To: '[EMAIL PROTECTED]'
Subject: c compiler needs



while config-ing perl 5.8.0 with 
sh Configure -Accflags=-DPERL_Y2KWARN -DPERL_POLLUTE_MALLOC

 I am getting an error that I need a C compiler...but I have gcc installed
through SuSe 8.0 linux...

What's the deal?


Splitting a path

2003-08-02 Thread Gupta, Sharad

Hi,

I have a path which may look like:


UNIX:
-

PATH=/usr/local/share:/usr/local:...

Where each path is seperated by :.


Windows:
--
PATH=E:\foo:D:\bar

Again the path seperated by :. ( I cannot change the seperator )


How can i split the path on : which gives me correct entries irrespective of whether 
i am on windows or unix.

Right now i am trying to do something like:

sub tokens {

my ($path) = @_;
if($OSNAME eq Win32) {
my @tokens = split(/:/,$path);
my @newtokens;
for (my $i=0;$i$#tokens;$i++) {
push @newtokens,join(/:/,$tokens[$i],$tokens[$i++]);
}
return @newtokens;
}
return split(/:/,$path);
}

But i am not convinced, this is elegant.

TIA,
-Sharad



Re: Splitting a path

2003-08-02 Thread Casey West
It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, saying:
: 
: Hi,
: 
: I have a path which may look like:

  use Env [EMAIL PROTECTED];

  print $_\n foreach @PATH;

I love the Perl core.  :-)

For more information read http://search.cpan.org/perldoc?Env

  Casey West

-- 
Shooting yourself in the foot with Powerbuilder 
While attempting to load the gun you discover that the LoadGun system
function is buggy; as a work around you tape the bullet to the outside
of the gun and unsuccessfully attempt to fire it with a nail. In
frustration you club your foot with the butt of the gun and explain to
your client that this approximates the functionality of shooting
yourself in the foot and that the next version of Powerbuilder will
fix it. 


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



RE: Splitting a path

2003-08-02 Thread Gupta, Sharad
I miscommunicated here, by path i did'nt meant the PATH env variable.
By Path i meant any  string having some directories seperated by : , say it could be

FOO=E:\foo:D:\bar.

And yes it can be in the %ENV.

-Sharad



-Original Message-
From: Casey West [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 3:12 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting a path


It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, saying:
: 
: Hi,
: 
: I have a path which may look like:

  use Env [EMAIL PROTECTED];

  print $_\n foreach @PATH;

I love the Perl core.  :-)

For more information read http://search.cpan.org/perldoc?Env

  Casey West

-- 
Shooting yourself in the foot with Powerbuilder 
While attempting to load the gun you discover that the LoadGun system
function is buggy; as a work around you tape the bullet to the outside
of the gun and unsuccessfully attempt to fire it with a nail. In
frustration you club your foot with the butt of the gun and explain to
your client that this approximates the functionality of shooting
yourself in the foot and that the next version of Powerbuilder will
fix it. 



Re: Splitting a path

2003-08-02 Thread Wiggins d'Anconia
Gupta, Sharad wrote:

I miscommunicated here, by path i did'nt meant the PATH env variable.
By Path i meant any  string having some directories seperated by : , say it could be
FOO=E:\foo:D:\bar.

And yes it can be in the %ENV.

-Sharad
How about:

my @paths = split(/:(?!\\)/, $path;

perldoc perlre for more essentially it is using a zero-width negative 
look ahead assertion. At least I think :-)..

http://danconia.org



-Original Message-
From: Casey West [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 3:12 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting a path
It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, saying:
: 
: Hi,
: 
: I have a path which may look like:

  use Env [EMAIL PROTECTED];

  print $_\n foreach @PATH;

I love the Perl core.  :-)

For more information read http://search.cpan.org/perldoc?Env

  Casey West



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


Re: Splitting a path

2003-08-02 Thread Wiggins d'Anconia
Sorry missed a parenthesis. It would be nice if I had some way to paste 
from an X windows terminal from fink into a aqua app :-)

Wiggins d'Anconia wrote:

Gupta, Sharad wrote:

I miscommunicated here, by path i did'nt meant the PATH env variable.
By Path i meant any  string having some directories seperated by : , 
say it could be

FOO=E:\foo:D:\bar.

And yes it can be in the %ENV.

-Sharad


How about:

my @paths = split(/:(?!\\)/, $path;
Should be:

my @paths = split(/:(?!\\)/, $path);

http://danconia.org

perldoc perlre for more essentially it is using a zero-width negative 
look ahead assertion. At least I think :-)..

http://danconia.org



-Original Message-
From: Casey West [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 02, 2003 3:12 PM
To: Gupta, Sharad
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting a path
It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, 
saying:
: : Hi,
: : I have a path which may look like:

  use Env [EMAIL PROTECTED];

  print $_\n foreach @PATH;

I love the Perl core.  :-)

For more information read http://search.cpan.org/perldoc?Env

  Casey West





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


Re: What systems using \r\n and what systems using \n etc ?

2003-08-02 Thread Mark Stosberg
In article [EMAIL PROTECTED], LI NGOK LAM wrote:
 --=_NextPart_000_002B_01C353EC.615A7010
 Content-Type: text/plain;
   charset=big5
 Content-Transfer-Encoding: quoted-printable
 
 Is that any module can help to detect what is the right new line =
 declaration for the=20
 current system ? Somwhat if the system is detected be Windows, the =
 newline
 declaration is \n, for *nix, is \r\n , for Mac and etc.

This is covered in detail in perldoc perlport with Perl 5.8. Search
for the string Newline in the documentation and start reading.

Mark

--
http://mark.stosberg.com/ 


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



Re: Uploading files

2003-08-02 Thread Mark Stosberg
In article [EMAIL PROTECTED], Li Ngok Lam wrote:
 
 - Original Message - 
 From: K. Parker [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, August 02, 2003 12:00 PM
 Subject: Uploading files
 
 
 On a site I'm developing, I'm trying to create a script that uploads
 encrypted files and saves them in a particular directory.
 
 You will do in this way :
 1. Create a html form which have a file type input.
 2. Then write a CGI program to pick up the form
 3. Read the Data from what you get.
 4. Write the data to anywhere in your host as whatever file.
 5. Done

In particular, check out the upload function of CGI.pm. 

Mark

--
http://mark.stosberg.com/ 


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



Re: Splitting a path

2003-08-02 Thread Steve Grazzini
On Sat, Aug 02, 2003 at 03:20:14PM -0700, Gupta, Sharad wrote:
 From: Casey West [mailto:[EMAIL PROTECTED]
 It was Saturday, August 02, 2003 when Gupta, Sharad took the soap box, saying:
 : 
 : Hi,
 : 
 : I have a path which may look like:
 
   use Env [EMAIL PROTECTED];
 
   print $_\n foreach @PATH;
 
 I love the Perl core.  :-)

 I miscommunicated here, by path i did'nt meant the PATH env 
 variable.  By Path i meant any  string having some directories 
 seperated by : , say it could be
 
 FOO=E:\foo:D:\bar.
 
 And yes it can be in the %ENV.

Then Casey's suggestion will work for you with just one tiny
modification.

use Env [EMAIL PROTECTED];

print $_\n foreach @FOO;

 For more information read http://search.cpan.org/perldoc?Env

This is still recommended.  ^_^

And it would be great if you could arrange for your mail/news
reader to quote the text of the original message rather than
appending it unmodified at the end of your response.

-- 
Steve

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