Heya Jeff,
You might consider HTTP::Cookies. You can use it with LWP by telling
the useragent to use a new cookie object to grab cookies from the HTML
headers. You'll get a lot more from perldoc HTTP::Cookies, but
following is an example,
Cheers,
C.J.
#!/usr/bin/perl -w
use strict;
u
Jeff K.V. Bhavnanie writes ..
>How do i go about accepting a cookie from a web login site?
in a cookie jar
>I use LWP to do a POST, but i can't login as the server
>sends a cookie. Is there a generic Login perl script lines?
>
>Login to a web site, send username password, accept cookie
>then th
Yeah, the CLI gave me the expected result. I am pretty stumped at this
point. I have added everything to my httpd.conf that should be in there. And
I am geting a different error than before, so I am confident that the file
is found.
Anyone have any other ideas?
Thanks Jason,
Patrick
> jason kin
Daniel Choong writes ..
>okie, this probably sounds very simple but i dunno how
>to do it. i just learnt perl. i need some tips on how
>to use a perl script to automate the updating of files
>on multiple servers. i am trying to use ftp but i do
>not know how to write the script to read the output
J. Patrick Lanigan writes ..
>I tried them on th CLI first. I even su'ed to user nobody to
>match the env of apache.
and on the CLI - I presume that they outputted exactly what you expected ..
ie.
"Content-type: text/html
Hello World!
"
it doesn't seem like a permissions error .. I presume
Hi,
How do i go about accepting a cookie from a web login site?
I use LWP to do a POST, but i can't login as the server
sends a cookie. Is there a generic Login perl script lines?
Login to a web site, send username password, accept cookie
then the rest of the POST forms send that cookie back?
I tried them on th CLI first. I even su'ed to user nobody to match the env
of apache.
> King, Jason wrote:
>
> J. Patrick Lanigan writes ..
>
>
> >I am getting an "Internal Server Error" returned to my
> >browser. The error
> >log shows the following:
> >
> >"[Wed May 2 00:04:39 2001] [error] [c
J. Patrick Lanigan writes ..
>I am getting an "Internal Server Error" returned to my
>browser. The error
>log shows the following:
>
>"[Wed May 2 00:04:39 2001] [error] [client 192.168.0.10]
>Premature end of
>script headers: /path/to/filename"
your scripts are very simple which would sugge
okie, this probably sounds very simple but i dunno how
to do it. i just learnt perl. i need some tips on how
to use a perl script to automate the updating of files
on multiple servers. i am trying to use ftp but i do
not know how to write the script to read the output
from ftp, then send the use
I am getting an "Internal Server Error" returned to my browser. The error
log shows the following:
"[Wed May 2 00:04:39 2001] [error] [client 192.168.0.10] Premature end of
script headers: /path/to/filename"
I have set the directory and file to 755 and the correct ownership. I have
tried a coup
I just keep learning. This list is making learning much easier.
Thanks to Dan and Jason,
Patrick
> you need the global modifier .. what you're trying to do is do the current
> match globally throughout the whole string (not zero or more)
>
> $mystring =~ s/\'/\\'/g;
I wrote ..
>so .. your code could probably have looked something like this
>(using the wonderful File::Path module)
>
> #!perl -w
> use strict;
>
> use File::Path 'rmtree';
>
> open DIRS, 'c:/admin/removedir.txt' or die "Bad open: $!";
> chomp( my @dirs = );
>
> rmtree( \@dirs);
>
> __END
Peter Lemus writes ..
>I need to delete some directories, specified in
>removedir.txt, I'll like to check whether the file
>exists or not, if it doesn't I need to print file has
>been deleted. this is what I've done so far.
ok .. line by line (and excuse the pedantry)
>use file::spec;
>use wi
Use the 'g' switch so the pattern match is
$mystring =~ s/\'/\\'/g;
This 'g' says do it for all occurrences (I remember it by thinking of it
as the 'g' in 'globally').
Dan
"J. Patrick Lanigan" wrote:
>
> I was using:
>
> $mystring =~ s/\'/\\'/;
>
> ...to replace ' with \' in
HI Folks,
I need to delete some directories, specified in
removedir.txt, I'll like to check whether the file
exists or not, if it doesn't I need to print file has
been deleted. this is what I've done so far.
use file::spec;
use win32;
chdir ("c://admin");
open (FILE1, 'c://admin//remove.txt') |
J. Patrick Lanigan writes ..
>> I was using:
>>
>> $mystring =~ s/\'/\\'/;
>>
>> ...to replace ' with \' in $mystring. It was working find I
>> thought, until I
>> encountered a string with multiple apostrophies. How do I replace
>> 0 or more?
>>
>> Ex:
>>
>> "No More 'I Love You's'"
>
lance turner writes ..
>Thanks Jason for your reply.
>
>I tried using an absolute path for gzip, but I'm getting the
>same error.
>
>I don't understand why I can run gzip from the shell but can't run it
>through perl. I'm able to run tar and other programs using the system
>function but not g
Matt Blatchley writes ..
>Does anyone know of a way to use perl and CGI to have the following:
>
>html page w/ form to get stdin from the user for username and
>password.(basic),
>pass the variables to the perl script which then modifies permissions
>for a specific folder on NT and allows the u
Mike Stussie writes ..
>I'm a newbie to perl and trying to solve a problem.. Here is what I'm
>trying to do:
>
>read thru flat file 'A' that looks something like this:(fields
>delimited by
>'::')
>BCSNDTJN::Joe User::1 N.
>Main::Anytown::MO::None::None::None::Unknown::[EMAIL PROTECTED]
>
>and f
Shawn writes ..
>Can someone look at a subroutine for me? Specifically, after
>this (at bottom of email) subroutine runs, it increases my
>RSS by 6 megs, and shouldn't do that. (here it has indexed
>133798 files)
this is normal Perl behaviour - welcome to an interpreted language .. check
out th
Phillip Bruce writes ..
> Anyone with experience in having perl call up mailx and
> at the same time have the body of the messages sent along
> with attachment.
using mailx is almost certainly not the ideal solution for your system ..
there are a number of Perl modules that deal with sending
Opps, I forgot to change the subject. I think I need to get outside and get
some fresh air.
> I was using:
>
> $mystring =~ s/\'/\\'/;
>
> ...to replace ' with \' in $mystring. It was working find I
> thought, until I
> encountered a string with multiple apostrophies. How do I replace
> 0 or
I was using:
$mystring =~ s/\'/\\'/;
...to replace ' with \' in $mystring. It was working find I thought, until I
encountered a string with multiple apostrophies. How do I replace 0 or more?
Ex:
"No More 'I Love You's'"
...should become:
"No More \'I Love You\'s\'"
I
At 12:28 PM 5/1/2001, you wrote:
>sub wanted {
> @FILES = ();
> if ( $File::Find::name =~ /_boot\.js$/ )
> {
>push @FILES, "$File::Find::name\n";
> }
>
> print (@FILES);
>
> open(BOOT_FILES,">boot_files.txt");
>
--- Kaustav Bhattacharya <[EMAIL PROTECTED]> wrote:
> I have an array populated with data, I want to dump its content to
> file but
> my following code is not writing any data out! HELP:
>
> sub wanted {
> @FILES = ();
> if ( $File::Find::name =~ /_boot\.js$/ )
> {
>
On Tue, May 01, 2001 at 01:22:59PM -0700, Paul wrote:
:
: --- Kaustav Bhattacharya <[EMAIL PROTECTED]> wrote:
: > Mark,
: > I only recently started coding in PERL so don't take the following as
: > official.
: >
: > There is no CASE statement in PERL. Instead you use something called
: > SWITCH.
--- Kaustav Bhattacharya <[EMAIL PROTECTED]> wrote:
> Mark,
> I only recently started coding in PERL so don't take the following as
> official.
>
> There is no CASE statement in PERL. Instead you use something called
> SWITCH.
Another trick, possibly not for beginners but sometimes handy:
my %
--- Kaustav Bhattacharya <[EMAIL PROTECTED]> wrote:
> Mark,
> I only recently started coding in PERL so don't take the following as
> official.
>
> There is no CASE statement in PERL. Instead you use something called
> SWITCH.
> The O'Reilly book has an example of how to use the SWITCH statemen
--- Francis Henry <[EMAIL PROTECTED]> wrote:
> Craig,
>
> I'm a newbie too, but isn't the function "chomp"?
chomp is the one Craig seems to need, but there's also a chop.
chop() alsways knock a character off; chomp only pops input record
seperators (like newline, or CRLF, depending on what the
--- "J. Patrick Lanigan" <[EMAIL PROTECTED]> wrote:
> I haven't quite sorted out the more complex data structure in perl
> yet. Anyhow, I need to take the following hash of arrays...
>
> my %tracks = ();
>
> push @{$tracks{$filename}},
> $_, # tracks.fi
--- "McCormick, Rob E" <[EMAIL PROTECTED]> wrote:
>
> print RESULT grep { ! /_vti_cnf/ } ;
>
> # so that could be read as print to the output filehandle the result
> of the input file handle filtered by grep.
Exactly, and because grep is a list context, the one statement prints
the entire s
On Mon, Apr 09, 2001 at 07:21:24PM -, Perl Programmer wrote:
: Is there an ODBC module in perl ?
Yes, search for 'ODBC' at http://search.cpan.org/
If you are using windows as your client operating system, and have
ActiveStat Perl installed, an ODBC driver has already been installed
by defaul
Thanks Jason for your reply.
I tried using an absolute path for gzip, but I'm getting the same error.
I don't understand why I can run gzip from the shell but can't run it
through perl. I'm able to run tar and other programs using the system
function but not gzip.
I'm thinking that I should t
Is there an ODBC module in perl ?
Thanks
Does anyone know of a way to use perl and CGI to have the following:
html page w/ form to get stdin from the user for username and
password.(basic),
pass the variables to the perl script which then modifies permissions for a
specific folder on NT
and allows the user to then have access to a parti
-
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]
Lightning flashed, thunder crashed and "Craig Moynes/Markham/IBM" <[EMAIL PROTECTED]
bm.com> whispered:
| open ( ERR, ";
You are mixing things here you don't want to mix. This should just be:
while ($in = ) {
You *can* mix these, but there is no real reason to. Especially not in
your sample c
Lightning flashed, thunder crashed and "Kaustav Bhattacharya" whispered:
| open(BOOT_FILES,">boot_files.txt");
| print BOOT_FILES @FILES;
| close BOOT_FILES;
You should always check the return of open and close...
open BOOT_FILES, ">boot_files.txt" or die "Can't open boot_file
Lightning flashed, thunder crashed and "Collin Rogowski" <[EMAIL PROTECTED]> w
hispered:
| They exist both.
| chop removes the last character.
| chomp removes the last character if it's newline.
Let's get this straight and correct. chomp removes the input record
separator ($/). This may or may
Hi all,
I'm a newbie to perl and trying to solve a problem.. Here is what I'm
trying to do:
read thru flat file 'A' that looks something like this:(fields delimited by
'::')
BCSNDTJN::Joe User::1 N.
Main::Anytown::MO::None::None::None::Unknown::[EMAIL PROTECTED]
and find any duplicates based o
I feel really stupid now. Yes, I have been forgetting the leading / on the
path to perl. After using #!/usr/bin/perl at the top of the script it
worked fine.
I want to add that I appreciate all the replies to my question. I have used
the internet for a lot of years and have belonged to many ma
Can someone look at a subroutine for me? Specifically, after
this (at bottom of email) subroutine runs, it increases my
RSS by 6 megs, and shouldn't do that. (here it has indexed
133798 files)
This is the program before the checkstuff subroutine runs:
PID USER PRI NI SIZE RSS SHARE STAT
I have an array populated with data, I want to dump its content to file but
my following code is not writing any data out! HELP:
sub wanted {
@FILES = ();
if ( $File::Find::name =~ /_boot\.js$/ )
{
push @FILES, "$File::Find::name\n";
hello world
- Original Message -
From: McCormick, Rob E <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 11:10 PM
Subject: open file, find lines and print to a second file
> gang,
>
> # problem: open a file
> # find lines that meet a condition, p
Thank you so much for your help Gary and Jason. I tried the following and it
works perfectly.
Patrick
#!c:/perl/bin/perl -w
use strict;
my %tracks=(); # create empty hash
$tracks{'test'}->{artist}='test_artist';
$tracks{'test'}->{title}='test_title';
$tracks{'test2'}->{artist}='test_artist2';
$
Mr. Owens,
I find that the best way to write CGI scripts is to write them and run
them on the command line. Then, when I know that they run without errors, I
put them on my web server.
If you do this, you can also specify...
#!/usr/bin/perl -w
(with the -w on the end) to get
Opps, forgot to change the variable name. Ah the power of cut and paste...
for my $row ( keys %tracks ) {
$artist = $tracks{$row}->{artist};
$title = $tracks{$row}->{title};
}
> I wrote:
>
> Excellent! Thanks! So, when I need to iterate through the hash of
> hashes and
> wor
Hi Dale,
When this script fails, it's usually a server configuration problem,
which is not really on-topic here, but.
1) what do you mean by full path? bear in mind that the path you
specify in the URL will get munged by the web server.
2) what error does the browser show you? permissions, fi
Excellent! Thanks! So, when I need to iterate through the hash of hashes and
work on the data would I do this:
for my $row ( keys %tracks ) {
$artist = $tracks{$fname}->{artist};
$title = $tracks{$fname}->{title};
}
Thanks again for the pointer,
Patrick
> Gary Stainburn wrote:
: #!usr/bin/perl
Shouldn't this be
#!/usr/bin/perl
-- tdk
On Tue, May 01, 2001 at 11:28:02AM -0400, Dale Owens wrote:
> I am completely new to perl and this question may seem really lame,
> but I can't get the most basic script to work. I am trying to run
> this on my web host's server:
>
> #!usr/bin/perl
>
> print "Content-type: text/html\n\n";
> pri
There isn't a switch statement either. There's a way to make something
that looks similar to a switch, but it isn't a builtin control structure.
-spp
Lightning flashed, thunder crashed and "Kaustav Bhattacharya" whispered:
| Mark,
| I only recently started coding in PERL so don't take the foll
Lightning flashed, thunder crashed and Mark Martin <[EMAIL PROTECTED]> whisper
ed:
| What I have is this:
|
| if ($variable == 02){
| print OUT1 "$variable";
| $lines1 ++;
| } elsif($variable == 03){
| print OUT1 "$variable\n";
| $lines2 ++;
| } elsif($variable == "08"){
: I think what I need is something called a case. but I can't find the syntax
: anywhere.
Perl doesn't have an official case (that is, switch) statement, but
there is a Switch.pm module available on CPAN. Here's the synopsis from
its manpage:
use Switch;
switch ($val) {
Hello,
I am completely new to perl and this question may seem really lame, but I can't get
the most basic script to work. I am trying to run this on my web host's server:
#!usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello World!\n";
I then try to access the script by providing
Wanted is where you want to change this. Within the function place a
regular expression or file-test ...anything that will give you a true/false
answer that you can use.
To get a list of executable files you would change
>sub wanted {
> print "$File::Find::name\n";
>}
to:
sub wanted
Surely, a hash of hashes would be better then.
my %tracks=(); # create empty hash
Then to populate the data you do something like:
$tracks{$fname}->{artist}=$artist;
$tracls{$fname}->{title}=$title;
Gary
On Tuesday 01 May 2001 4:08 pm, J. Patrick Lanigan wrote:
> Overall what I am trying to
Hi Mark,
Try this:
switch:for ($variable) { #put $variable into $_
(/02/ || /03/ || /08/) && do {
print OUT1 "$variable\n";
$lines1++;
last; } ;
(/79/ || /93/ || /99/) && do {
print OUT3 "$variable\n";
$lines3++;
last; } ;
}
Using this code, if the bit be
Mark,
I only recently started coding in PERL so don't take the following as
official.
There is no CASE statement in PERL. Instead you use something called SWITCH.
The O'Reilly book has an example of how to use the SWITCH statement.
Kaustav
> -Original Message-
> From: Mark Martin [mail
Overall what I am trying to accomplish is to loop through a bunch of mp3
files and extract the ID3 Tag Info into a hash (%tracks) for which each key
references the filename, filepath, artist, album, tracknum, title, genre for
one file. Once I have %tracks populated I need to iterate through it and
What I have is this:
if ($variable == 02){
print OUT1 "$variable";
$lines1 ++;
} elsif($variable == 03){
print OUT1 "$variable\n";
$lines2 ++;
} elsif($variable == "08"){
print OUT1 "$variable\n";
$lines2 ++;
} elsif($variable == 79){
pr
been trying to work out how to get PERL to traverse a given directory tree
looking for all files with the string _boot.js in the file name. then I want
to read each file and find all lines which start with the string "sWinReg"
and copy them in to an array with each line being places in a seperate
In your statements:
print "@zin[$i] \n\r";
You should use:
print "$zin[$i] \n\r";
And:
> $ta = @zin[6];
> $tb = @zin[7];
> $tc = @zin[8];
> $td = @zin[9];
should be:
> $ta = $zin[6];
> $tb = $zin[7];
> $tc = $zin[8];
> $td = $zin[9];
And:
if (@zin[$t] = /212.104.202.50/g) {
Should be:
if ($z
They exist both.
chop removes the last character.
chomp removes the last character if it's newline.
To the original problem:
I had a similar problem once.
Maybe your file has DOS-Newlines which are to characters (\r\n).
If you chop, you keep \r at the end which could mess around with
printing it
chomp removes only the newline (what you want I think) and chop removes the last
character
#instead of
chop $in;
#Try:
chomp $in;
Greg
__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
I didn't quite get what your problem was.
Can you elaborate on that?
There are a couple of newbie problems in your script:
> ##
> #!/usr/bin/perl
You should say:
!/usr/bin/perl -w
This turns on warnings (which is very helpful
Hi,
Anyone with experience in having perl call up mailx and
at the same time have the body of the messages sent along
with attachment.
--
*** Phillip B. Bruce ***
*** http://pbbruce.home.minds
Craig,
I'm a newbie too, but isn't the function "chomp"?
Francis
Craig Moynes/Markham/IBM wrote:
> A little background. I am running an scp process within a perl script and
> redirecting the error to a file (scp_err). I then read in the lines of
> this file and attempt to place them in an e
A little background. I am running an scp process within a perl script and
redirecting the error to a file (scp_err). I then read in the lines of
this file and attempt to place them in an error string to log to syslog.
Code Sample:
#!/usr/bin/perl -w
open ( ERR, ";
chop $in;
pr
Hi,
You may find the MacOSX list helpful. Here's the article announcing the list.
http://use.perl.org/article.pl?sid=01/03/29/1452216&mode=thread&threshold=
send a message to subscribe at [EMAIL PROTECTED]
At 05:32 AM 5/1/2001 -0400, you wrote:
>Hey guys,
>
>Thanks so much for your help. The s
Hi,
I have a small problem, I'm trying to do the following.
I'm using WOTS to scan logfiles, and when it gets an error from our name server, it
has to cut the error message in pieces separated by a space.
And has to compare it to the if statements. After that it has to copy a few pieces to
mak
You probably want to use Perl's built in 'localtime'
function rather than system("date").
Here's an example:
my($day, $month, $year) = (localtime())[3,4,5];
my $a = sprintf("%04u-%02u-%02u", $year + 1900, $month + 1, $day);
Here's a walkthrough ...
You can get the current time using time(
Hey guys,
Thanks so much for your help. The supplied code was excellent. You Perl
people are alright! :-)
In answer to Johnathan Kupferer's question at to my computing platform, I'm
actually working on a Mac g4 running Mac OS X and am very interested in
testing out its Perl programming capabi
Does anybody know how to clean up the system time :
Tue May 1 10:18:32 BST 2001
or select only part of it to give a more managable date format that can be
used to stamp an output file from a program :
$a = system ("date"); # OR A TRUNCATED VERSION
# OR CLEAN IT UP HERE ???
$b = "filenam
David Kalnins writes ..
>I was wondering if it was possible to remove an item from a list whilst
>one is repeating over it with a foreach statement. For example, I was
>hoping that the following code fragment would do this - but instead it
>does exactly what I told it to do :) That is it leaves t
J. Patrick Lanigan writes ..
>I haven't quite sorted out the more complex data structure in perl yet.
>Anyhow, I need to take the following hash of arrays...
you have some very confusing code there .. so let's do it one bit at a time
>my %tracks = ();
create a hash called tracks with zero e
Hi all,
I was wondering if it was possible to remove an item from a list whilst one
is repeating over it with a foreach statement. For example, I was hoping
that the following code fragment would do this - but instead it does
exactly what I told it to do :) That is it leaves the item there but wi
I haven't quite sorted out the more complex data structure in perl yet.
Anyhow, I need to take the following hash of arrays...
my %tracks = ();
push @{$tracks{$filename}},
$_, # tracks.filename
RDWest writes ..
>i just joined the list. i've been fooling with perl scripts for a
>few months now. just installing and editing html output mainly... now
>i'm studying a coupkle books to write my own (i hope)
>
>question: i've seen a couple post in some forums about creating a temp
>file for
79 matches
Mail list logo