[27893] in Perl-Users-Digest
Perl-Users Digest, Issue: 9257 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 11:05:58 2006
Date: Tue, 6 Jun 2006 08:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 6 Jun 2006 Volume: 10 Number: 9257
Today's topics:
Re: foreach @list ( (1,2), (5,6) ){ ... } <benmorrow@tiscali.co.uk>
Re: ftp perl script problem.. <brian.raven@aems.net>
Re: ftp perl script problem.. <tadmc@augustmail.com>
help needed in getting output kbnumesh@gmail.com
Re: help needed in getting output <josef.moellers@fujitsu-siemens.com>
Re: help needed in getting output kbnumesh@gmail.com
Re: help needed in getting output <josef.moellers@fujitsu-siemens.com>
Re: HOST - dreamhost.com / Liberality (Hosting, Basic R <ewfalor@gmail.com>
How do I make web services work with perl ? dmedhora@gmail.com
Re: how to read Chinese filenames? <benmorrow@tiscali.co.uk>
Re: How to retreive values from HTML to perl script kbnumesh@gmail.com
Re: How to retreive values from HTML to perl script <noreply@gunnar.cc>
Re: Howto self-delete files periodically with Perl <gundalav@gmail.com>
Re: installing modules <hara.acharya@gmail.com>
Re: malformated substitution attempt <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: malformated substitution attempt <OllyP@ATXmdk10.MAX>
Re: malformated substitution attempt <OllyP@ATXmdk10.MAX>
Need help with Apache::Session <mario.albornoz@gmail.com>
problem with hashes of attachments and Mail::Sender::Ea <daninbrum@hotmail.com>
Re: Session Timeout in Perl fred@fredthomas.co.uk
Re: word replacement <t.poisot@gmail.com>
Re: word replacement <rvtol+news@isolution.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 6 Jun 2006 12:11:38 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: foreach @list ( (1,2), (5,6) ){ ... }
Message-Id: <ag4gl3-uc3.ln1@osiris.mauzo.dyndns.org>
Quoth "Ferry Bolhar" <bol@adv.magwien.gv.at>:
> Paul Lalli:
>
> > That advice should really be
> >
> > "Avoid using $a and $b except in a sort subroutine".
>
> [...]
>
> > What warning, exactly, are you suggesting be added?
>
> Well, perhaps exactly what you've written above?
>
> Or - because $a and $b can be seen as special variables
> like $/:
>
> "Can't use global $a in "my" at ...
They aren't, though. The situation is much more complicated and crufty
than that. Consider
~% perl -le'$a = "foo"; my $a = "bar"; print $a; print $main::a'
bar
foo
So $a can be C<my>ed, just like any other by-default-global name. Then
consider
~% perl -le'my $a = "bar"; print sort {warn $a} qw/a b/;'
bar at -e line 1
ba
So C<my>ing $a will break all sort subs in that scope. So don't do that
:). A possibility would be to warn if a sort sub is compiled against a
lexical $a/$b rather than the correct package vars: you could try suggesting
it to p5p.
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one. [benmorrow@tiscali.co.uk]
'We come in peace'---the order came to cut them down.
------------------------------
Date: Tue, 06 Jun 2006 12:40:42 +0100
From: Brian Raven <brian.raven@aems.net>
Subject: Re: ftp perl script problem..
Message-Id: <vtvereqzph.fsf@lxdevws06.admin.liffe.com>
"Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net> writes:
> jac wrote:
>> { # True if file exists and is graeter than the time period
>> if ( -f $name && -M _ > $TimePeriod )
>
> You say "-M _" above. Did you mean "-M $_" or "-M $name"?
In this context, the underscore represents a special filehandle used to save a
system call. This is described in more detail in 'perldoc -f -X'.
HTH
--
Brian Raven
: I've tried (in vi) "g/[a-z]\n[a-z]/s//_/"...but that doesn't
: cut it. Any ideas? (I take it that it may be a two-pass sort of solution).
In the first pass, install perl. :-)
-- Larry Wall <6849@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Tue, 6 Jun 2006 08:05:00 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: ftp perl script problem..
Message-Id: <slrne8avbs.l5v.tadmc@magna.augustmail.com>
jac <jacaranda.jwl@gmail.com> wrote:
> Weird this is when executed, sometimes its transfering, sometimes its
> not.
>
> Could someone help me please?
You should ask your machine for help *before* resorting to asking
hundreds of people around the world for help.
Perl can help you find many common bugs, but it will only do so
if you ask it to:
use warnings;
use strict;
> require "find.pl";
What is in find.pl?
> &find($LocalBase);
perldoc perlsub
then you'll probably see that you want
find($LocalBase);
instead.
> { &TransferFiles; }
{ TransferFiles(); }
> ##########################
> # TransferFiles()
> ##########################
> sub TransferFiles
> {
> local ($File, $Goodxfr, $Cnt);
Why are you using package variables rather than lexical variables?
> # Initialize variables to zero
> $Goodxfr = 0;
> $Cnt = 0;
> # Change to the Base directory where the log files are written to #
> chdir($LocalBase);
Errr, where is the closing curly brace for the subroutine?
Please post Real Perl Code.
You should check to see if you actually got what you asked for:
chdir($LocalBase) or die "could not cd to '$LocalBase' $!";
> # $FileSize{$Name} = (stat($name))[7];
# $FileSize{$Name} = -s $name;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Jun 2006 03:56:57 -0700
From: kbnumesh@gmail.com
Subject: help needed in getting output
Message-Id: <1149591417.353516.152680@i39g2000cwa.googlegroups.com>
hi,
i am new to this perl and CGI programming ( just a day)
i wrote one cgi program to retreive values from html file
When i input some text in edit box of an html and press submit button
its printing the cgi file instead of outputing the value.....
that i entered in that edit box
is there any thing that i need to do pre settings to print the
ouput....
Thanks in advance
------------------------------
Date: Tue, 06 Jun 2006 13:16:22 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: help needed in getting output
Message-Id: <e63ocq$ql9$1@nntp.fujitsu-siemens.com>
kbnumesh@gmail.com wrote:
> hi,
>=20
> i am new to this perl and CGI programming ( just a day)
>=20
>=20
> i wrote one cgi program to retreive values from html file
>=20
>=20
> When i input some text in edit box of an html and press submit button
>=20
>=20
> its printing the cgi file instead of outputing the value.....
>=20
>=20
> that i entered in that edit box
>=20
>=20
> is there any thing that i need to do pre settings to print the
> ouput....=20
You're missing a semicolon in line 23 of your program.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 6 Jun 2006 05:18:23 -0700
From: kbnumesh@gmail.com
Subject: Re: help needed in getting output
Message-Id: <1149596303.482901.237320@i40g2000cwc.googlegroups.com>
can any one tell How to setup IIS server in my machine......
thanks in advance
Josef Moellers wrote:
> kbnumesh@gmail.com wrote:
> > hi,
> >
> > i am new to this perl and CGI programming ( just a day)
> >
> >
> > i wrote one cgi program to retreive values from html file
> >
> >
> > When i input some text in edit box of an html and press submit button
> >
> >
> > its printing the cgi file instead of outputing the value.....
> >
> >
> > that i entered in that edit box
> >
> >
> > is there any thing that i need to do pre settings to print the
> > ouput....
>
> You're missing a semicolon in line 23 of your program.
>
> --
> Josef M=F6llers (Pinguinpfleger bei FSC)
> If failure had no penalty success would not be a prize
> -- T. Pratchett
------------------------------
Date: Tue, 06 Jun 2006 16:00:18 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: help needed in getting output
Message-Id: <e64223$t1h$1@nntp.fujitsu-siemens.com>
kbnumesh@gmail.com wrote:
> can any one tell How to setup IIS server in my machine......
And your perl question is?
Sigh,
Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 6 Jun 2006 07:59:26 -0700
From: "ewfalor@gmail.com" <ewfalor@gmail.com>
Subject: Re: HOST - dreamhost.com / Liberality (Hosting, Basic Requirement)
Message-Id: <1149605966.439022.116360@c74g2000cwc.googlegroups.com>
Vincenzo Ciancia wrote:
> Come on! What does it cost to ignore a thread compared to what it costs to
> allow arbitrary censorship?
I would hardly call this "arbitrary censorship." Arbitrary censorship
would be nuking people's accounts without warning and without reason.
It would be remarkable if Xah Lee wasn't aware of the negative
consequences of his posts. And by breaking rules of nettiquete, he was
giving ample reason for the consequences to be doled out as they were.
None of us here are for "arbitrary censorship." So please leave your
straw men in the fields where they belong.
Honestly, should Xah be able to cross-post his diatribes on
alt.sports.baseball.ny-yankees? And when they kick him off for doing
so, are you going to cry "censorship?" One way to look at this
situation is to say that his voice is being throttled. But that is
only one way of looking at it, and these kind of slippery-slope
arguments are disingenuous.
The rules of Usenet are what make it useful. Enforcing the
partitioning posts into the appropriate threads is not a means of
thought-control; it is a way to organize information on Usenet so that
people can find what they are looking for. No one in their right mind
goes to comp.lang.*.misc for philosophical discussions.
> Also, what would it cost to this guy to get
> another account and irritate people again for many years until termination
> of the new account? The only difference here is that someone legally
> decided that he could not express himself for a while.
You know, if Xah clicked AGREE on the TOS, then he ought not be
surprised that this happened to him. Underhanded business practice?
Sure, I wouldn't sign up with that kind of ISP if it were the last
choice on earth. However, if Mr. Lee is half as intelligent as he
purports to be, he would have seen the inevitiability of this.
Besides, there are plenty of places on Usenet where his rants are
perfectly on-topic.
>This will not prevent him coming back.
Sadly, you are probably right. I don't want Xah to have to go back to
the 19th century. I just want him to respect the rules of the game.
If we want to read his blatherings, we already know where to find them.
>There are lots of people that irritate me in
> italian politics for example, telling bullshit all the time :) but I do not
> hope they will be censored :)
This is a last resort. If Xah had bothered to stick around in the
threads he began, he would have been appraised of this situation long
ago. And that's giving him the benefit of assuming that he isn't a
troll.
>Again, in kmail I press the "i" key when I
> see Xah Lee and I live happier.
Good for you, we're all very proud. Your medal is in the mail.
------------------------------
Date: 6 Jun 2006 04:02:38 -0700
From: dmedhora@gmail.com
Subject: How do I make web services work with perl ?
Message-Id: <1149591758.518258.28390@f6g2000cwb.googlegroups.com>
I mean really now... I've tried the examples in the documentation and
though a simple client and server works, its practically impossible for
me to get WSDL::Generator working.
I'm sure I'm doing something wrong, or the documentation sucks.
Can someone help me find out?
Following is the HOW TO that I extracted from the documentation :-
BEGIN
.How To
Produce a WSDL schema from a SOAP::Lite/Apache/mod_perl web service.
In this example a web service that exposes two methods - Hello and
GoodBye (Could you respect example that did include Hello World as
the
basis?). One method, Hello, accepts a string as an argument
(presumably
the first name of the person to greet) and returns a string with
"Hello,
" prepended to the argument and "\n" added to the end. The other,
GoodBye, accepts a string as an argument (presumably the first name
of
the person to greet) and returns a string with "Goodbye, "
prepended to
the argument and "\n" added to the end.
Because these examples are so short and so you will know exactly
what is
going on, the complete setup including source code is included here
before WSDL::Generator is used to build a WSDL schema.
Configuration
In your perl.conf file you should see the following directive:
<Location /world> SetHandler perl-script PerlHandler CLASS::World
</Location>
Which will point the appropriate CLASS::World.pm file on you
system. You
could include this module in one of the standard directories
searchable
by @INC or you could add a "use lib" statement to your startup.pl
script
to add the directory containing the module to @INC.
CLASS::World.pm
package CLASS::World;
use SOAP::Transport::HTTP;
my $server = SOAP::Transport::HTTP::Apache ->
dispatch_to('WorldFunctions');
sub handler { $server->handler(@_); }
package WorldFunctions;
sub new { bless {}, shift; }
sub Hello { my ($s, $name) = @_;
return 'Hello, ' . $name . "\n";
}
sub GoodBye { my ($s, $name) = @_;
return 'Goodbye, ' . $name . "\n";
}
1;
As you can see this is a really generic and straightforward
service. If
everything is configured correctly and you get no errors when you
start
Apache, you should be able to access the methods in this service
with
the following client script. Replace *host.your.domain* with the
hostname of your SOAP server.
world_client.pl
#!/usr/bin/perl
use SOAP::Lite +autodispatch => uri=>"WorldFunctions",
proxy=>'http://host.your.domain/world';
print Hello('Joe');
print GoodBye('Joe');
Generating the WSDL schema.
Using WSDL::Generator, one can quickly generate the WSDL schema for
a
particular SOAP service. You will need to copy the Perl module for
the
service to a directory and modify it as follows.
SOAP Service Perl module
# package CLASS::World;
# use SOAP::Transport::HTTP;
# my $server = SOAP::Transport::HTTP::Apache
# -> dispatch_to('WorldFunctions');
# sub handler {
# $server->handler(@_);
# }
package WorldFunctions;
sub new { bless {}, shift; }
sub Hello { my ($s, $name) = @_;
return 'Hello, ' . $name . "\n";
}
sub GoodBye { my ($s, $name) = @_;
return 'Goodbye, ' . $name . "\n";
}
1;
Save this file as WorldFunctions.pm. The following script will call
WSDL::Generator, build the WSDL schema and output it to the screen.
#!/usr/bin/perl
use WSDL::Generator;
my $init = {
'schema_namesp' =>
'http://host.your.domain/world/WorldFunctions.xsd',
'services' => 'WorldFunctions',
'service_name' => 'WorldFunctions',
'target_namesp' => 'http://host.your.domain/world/',
'documentation' => 'Simple Hello World SOAP Service.',
'location' => 'http://host.your.domain/world'
};
my $w = WSDL::Generator->new($init);
WorldFunctions->Hello('Joe');
WorldFunctions->GoodBye('Joe');
print $w->get(WorldFunctions);
You should save this script in the same directory as the
WorldFunctions.pm Perl module file. The $init hash reference above
looks
a little confusing for those used to SOAP::Lite. That is because
SOAP::Lite save the programmer from having to know these types of
things
in order to build a working SOAP service and/or client. Where to
plug
the components of the SOAP::Lite constructor into the keys of the
$init
hashref are explained below:
* 'schema_namesp' => This is URL of where the WSDL schema will
eventually live.
* 'services' => This is the uri portion of the SOAP::Lite
constructor.
* 'service_name' => This is the uri portion of the SOAP::Lite
constructor.
* 'target_namesp' => This is the proxy portion of the SOAP::Lite
constructor.
* 'documentation' => A scalar or literal that contains the
documentation
for your exposed services.
* 'location' => This is the proxy portion of the SOAP::Lite
constructor.
Conclusion
With a little work, it is possible to build web services with
SOAP::Lite/Apache/mod_perl that can be utilized by programming
languages
other than Perl.
Joe Breeden jbreeden@ena.com
END
I tried doing the above but somehow it doesn't seem to work.
I get 404 not founds and all kinds of frustrating like:
404 Not Found at /usr/lib/perl5/site_perl/5.8.5/SOAP/Lite.pm line 3113
Aargh!
Has anyone made this work?
Do people program web services with perl? ( even the oreilly book that
i read on this
topic is ill-documented for actual perl work )
Thanks
------------------------------
Date: Tue, 6 Jun 2006 11:57:43 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: how to read Chinese filenames?
Message-Id: <7m3gl3-uc3.ln1@osiris.mauzo.dyndns.org>
Quoth "Alan J. Flavell" <flavell@physics.gla.ac.uk>:
> On Mon, 5 Jun 2006, ckyang74@gmail.com wrote:
>
> > I have many files named with Chinese characters. When I read in
> > filenames, the Chinese characters become question marks.
>
> As I understand it: you need to use Win32 wide system calls.
>
> In an earlier version of Perl, this was implemented using the -C flag.
> Then the developers changed their minds, and took it out again, saying
> they would re-introduced it in a different way. But I don't know
> whether they did, nor how. Hope those clues are useful somehow. The
> phrase "wide system calls" may be a useful term to search for.
AFAICT, it is not implemented in 5.8.7 at all. You probably want to use
Win32::API to call the FindFirstFileW/FindNextFileW/FindClose Win32 API
functions directly: Win32API::File doesn't seem to wrap these, which is
a shame. This is likely to be at least slightly tricky: if you manage
it, you may want to consider publishing a module which does the work.
Ben
--
All persons, living or dead, are entirely coincidental.
benmorrow@tiscali.co.uk Kurt Vonnegut
------------------------------
Date: 6 Jun 2006 03:44:01 -0700
From: kbnumesh@gmail.com
Subject: Re: How to retreive values from HTML to perl script
Message-Id: <1149590641.147151.18440@u72g2000cwu.googlegroups.com>
When i input some text and press submit button
its printing the cgi file instead of outputing the value.....
is there any thing that i need to do pre settings to print the
ouput....
Thanks in advance
Tintin wrote:
> <kbnumesh@gmail.com> wrote in message
> news:1149583693.696006.5390@f6g2000cwb.googlegroups.com...
> > Hi,
> >
> >
> > I am very new to perl scripting can any one write an example to
> > retreive a value from an edit box of an html into perl script.
> >
> >
> > for example login program ....
> >
> >
> > the HTML should contain edit box to enter the input
> > the perl script retreive the data entered in that HTML edit box..
>
> perldoc CGI
>
> or
>
> http://perldoc.perl.org/CGI.html
>
>
>
> --
> Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: Tue, 06 Jun 2006 13:13:40 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to retreive values from HTML to perl script
Message-Id: <4el6b5F1bjc44U1@individual.net>
kbnumesh@gmail.com wrote:
> When i input some text and press submit button
>
> its printing the cgi file instead of outputing the value.....
>
> is there any thing that i need to do pre settings to print the
> ouput....
http://my.execpc.com/~keithp/bdlogcgi.htm
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 Jun 2006 07:47:38 -0700
From: "gundalav" <gundalav@gmail.com>
Subject: Re: Howto self-delete files periodically with Perl
Message-Id: <1149605258.662193.286710@y43g2000cwc.googlegroups.com>
Thanks a lot for the reply Tad.
Few things....
>
> perl -le 'for (@ARGV) {print $_ if -A > 10.0}' *
>
What does -A stands for? Where can I find
information about this? Is there a way also to print out
the actual date (just like when we do unix's "ls -l" ) under Perl
one-liner and coupled with -A option ?
Hope to hear from you again.
Regards,
Gundala
------------------------------
Date: 6 Jun 2006 04:36:21 -0700
From: "king" <hara.acharya@gmail.com>
Subject: Re: installing modules
Message-Id: <1149593781.223527.223480@y43g2000cwc.googlegroups.com>
Tintin wrote:
> "king" <hara.acharya@gmail.com> wrote in message
> news:1149569401.350668.295930@i40g2000cwc.googlegroups.com...
> >
> > niall.macpherson@ntlworld.com wrote:
> > > king wrote:
> > >
> > >
> > > > Can any-body suggest how to install the module in windows XP.
> > >
> > > Unless you specifically want to compile it yourself , you're probably
> > > better off letting the perl package manager (ppm) do it for you
> > >
> > > Type ppm at the command line and you will get this
> > >
> > > PPM - Programmer's Package Manager version 3.2.
> > > Copyright (c) 2001 ActiveState Corp. All Rights Reserved.
> > > ActiveState is a division of Sophos.
> > >
> > > Entering interactive shell. Using Term::ReadLine::Perl as readline
> > > library.
> > >
> > > Type 'help' to get started.
> > >
> > > ppm>
> > >
> > > Then
> > >
> > > search <modulename>
> > >
> > > to search for a module
> > >
> > > and
> > >
> > > install <modulename>
> > >
> > > to install a module
> > >
> > > Hope this helps
> >
> > Yes installing modules by PPM can be done. But what if not connected to
> > internet then how can i install a module in windows.
>
> How did you download the module to install in the first place? Did you get
> it off a CD?
>
>
>
> --
> Posted via a free Usenet account from http://www.teranews.com
yes suppose I downloaded it from a net cafe and brought it home with
usb stick.
then i want to install it in a windows machine.
------------------------------
Date: Tue, 06 Jun 2006 10:31:45 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: malformated substitution attempt
Message-Id: <lQchg.2091$o4.1731@newsread2.news.pas.earthlink.net>
Mumia W. wrote:
> OllyP wrote:
>> _____________________________________________________________
>> Tue Jun 06 00:43:59 CDT 2006
>>
>> I am not a programmer or an IT guy, but have an interest in learning
>> Perl. I am attempting to take a list of filepaths and rework them into
>> an html index so as to click them into a browser easily.
>
> $ARG = read_file 'file-list.txt';
> s/^.*$/<a href="$MATCH">@{[ basename $MATCH ]}<\/a><br>/mg;
> write_file 'file-list.html', $ARG;
>
Oops, I forgot that the source file was HTML with some stuff in it that
he wanted to keep. That substitution should be changed to this:
s/^[\/.\w\d-]+$/<a href="$MATCH">@{[ basename $MATCH ]}<\/a><br>/mg;
I was using English and File::Slurp in the code above.
------------------------------
Date: Tue, 06 Jun 2006 12:29:58 GMT
From: OllyP <OllyP@ATXmdk10.MAX>
Subject: Re: malformated substitution attempt
Message-Id: <slrne8at61.5r7.OllyP@ATXmdk10.MAX>
* Christian Winter <thepoet_nospam@arcor.de> [2006-06-06]:
>[..msg snipped..]
> Just do it all in one iteration.
>
_____________________________________________________________
Tue Jun 06 05:47:03 CDT 2006
Thank you Chris, John, and Dr Ruud for looking at my post and
commenting.
> for( @hot )
> {
> s/(.*)(perl.*)/<a href="file:$1$2">$2</a>/;
> }
>
> This should produce the required output. Note the $1 and $2
> variables, that refer to the capturing parenthesises inside
> the match (see "perldoc perlvar" and "perldoc perlre" for
> details.
>
I can understand the second part easy enough Chris, assuming you omitted
the <br> unintentionally but the first part I will have to hit those doc
pages on, as it looks like it would match the whole line. Keeping in mind
that I know very little in this area 8-) .
> If you want to do the insertion of the filename in a different
> step, the following may help:
>
> if( m#(perl/.+html)# )
> {
> my $substitute = $1; # Just for readability
> s/X/$substitute/;
> }
>
> Note that I have replaced the pattern separator "/" in the above
> example with "#", thus ridding me of the need to escape the
> forward slash. This comes in handy when doing replacements on paths
> or matching on closing html tags.
>
This "if" will likely cure my problem, and I learn in the bargain.
I had read about the "cure the toothpick syndrome".
> [...]
>> if($string =~ m/perl\/.+html/)
>> {s/\X/$&/};
>
> That wont work. In your replacement pattern $& is already filled
> with the current match (this being "X"). And no need to escape the
> X character either.
>
I was beating a dead horse here Chris, and of course could not make it
print a substitution, the escape on the X was an act of desperation that I
added in the throes of agony while trying to understand what was going
wrong. I fully intended to remove that before posting where people would
see it arrgh. The same thing with the commented warnings/strict that
both John and DR Ruud admonished me about, I do understand the
importance of those. I let them swoosh right by when proof reading.
Sometimes blindly stabbing at what you think it might be can work, of course
never with munitions.
John wrote in part:
>#!/usr/bin/perl
>use warnings;
>use strict;
>use Tie::File;
>use File::Basename;
>tie my @hot, 'Tie::File', 'dead.html' or die "Cannot open 'dead.html' $!";
>for my $path ( @hot ) {
> next if /^<a href=/; # skip if already converted.
> my $file = basename $path;
> $path = qq[<a href="file:$path">$file</a><br>];
> }
>__END__
I am unfamiliar with Basename John so I will do some reading there, I
had ran out of ideas on places to look as there is so much documentation
thank you for pointing me toward it.
Thanks to all of you
--
Olly P
------------------------------
Date: Tue, 06 Jun 2006 13:48:01 GMT
From: OllyP <OllyP@ATXmdk10.MAX>
Subject: Re: malformated substitution attempt
Message-Id: <slrne8b1f5.86a.OllyP@ATXmdk10.MAX>
* Mumia W. <mumia.w.18.spam+nospam.usenet@earthlink.net> [2006-06-06]:
>
> IMO, Tie::File complicates matters. Try something like this:
>
> use strict;
> use warnings;
> use File::Basename qw(basename);
> use File::Slurp qw(read_file write_file);
> use English;
>
> $ARG = read_file 'file-list.txt';
> s/^.*$/<a href="$MATCH">@{[ basename $MATCH ]}<\/a><br>/mg;
> write_file 'file-list.html', $ARG;
>
>
> __END__
>
> The 'm' option to the s/// operator allows it to match multiple lines in
> a single string. See "man perlop."
>
_____________________________________________________________
Tue Jun 06 08:11:41 CDT 2006
I am amazed Mumia, shock and awe.
I ran your code with only changing it to my filename 'dead.html' and
using your second post line:
s/^[\/.\w\d-]+$/<a href="$MATCH">@{[ basename $MATCH ]}<\/a><br>/mg;
and it produced:
<a href="/home/olly/aasys/perl/sandtr.html">sandtr.html</a><br>
<a href="/home/olly/aasys/perl/perlreg.html">perlreg.html</a><br>
<a href="/home/olly/aasys/perl/ch07_05.html">ch07_05.html</a><br>
and on etc.
This is exactly what you said, and is what I was trying to get perfectly.
I was convinced I was only going to get the prefix and suffix as I
can't see what matches the embedded filename even after I ran the code
and observed the results? It is a complete mystery to me how it finds
that filename. Unless you are some sort of wizard? I am going to study
the basename module, perhaps the key is there? At the moment I am
expecting my LED screen to burst into blue flames at any second.
Thank you
--
Olly P USA Mississippi
------------------------------
Date: 6 Jun 2006 07:14:46 -0700
From: "goliathuy" <mario.albornoz@gmail.com>
Subject: Need help with Apache::Session
Message-Id: <1149603286.405442.97480@y43g2000cwc.googlegroups.com>
Hi, i'm needing some guidance regarding Apache::Session::Informix, or
any kind of Apache::Session..
The issue is that i do not really know how it works and i would like if
any one can point me to some simple "how to", or give me some
directions.
Thanks in advance.
------------------------------
Date: 6 Jun 2006 06:18:15 -0700
From: "Dan" <daninbrum@hotmail.com>
Subject: problem with hashes of attachments and Mail::Sender::Easy
Message-Id: <1149599895.070699.118540@h76g2000cwa.googlegroups.com>
Ahoy all,
The following is a simplified extract of some code i'm knocking
together...
$attachmenthash->{'smily.gif'} = {'smily.gif' => { 'ctype' =>
'image/gif', 'file' => '/foo/bar/smiley.gif' }};
$attachmenthash->{'printtest.xls'} = {'printtest.xls' => { 'ctype' =>
'application/octet-stream', 'file' => '/foo/bar/printtest.xls' }};
email({
'from' => $from,
'to' => $to,
'cc' => $cc,
'bcc' => $bcc,
'subject' => $subject,
'priority' => 3, # 1-5 high to low
'smtp' => 'smtp.yadayadayada.com',
'port' => 25,
'auth' => 'LOGIN',
'authid' => 'yadayada',
'authpwd' => 'yada',
'_text' => $email,
'_attachments' => %attachmenthash,
}) or die "email() failed: $@";
... the code should create an email with the two attachments. In the
real world, the number of attachments would depend on variables passed
by the user. The email sends fine, but no attachments are included.
Please help, i've not done much with hashes of hashes before, and this
is driving me nuts.
Any advice appreciated.
Dan
------------------------------
Date: 6 Jun 2006 03:14:57 -0700
From: fred@fredthomas.co.uk
Subject: Re: Session Timeout in Perl
Message-Id: <1149588896.965580.165050@g10g2000cwb.googlegroups.com>
Mumia W. wrote:
> fred@fredthomas.co.uk wrote:
> > Hi,
> >
> > In ASP I can set the session timeout (Session.Timeout = mm) is there a
> > way to do this in Perl?
> >
> > Thanks
> >
> > Fred
> >
>
> Yes,
> http://www.apache-asp.org/objects.html#%24Session-%3E%7BTf539b225
>
> :)
Excellent!
Thanks
------------------------------
Date: 6 Jun 2006 03:16:45 -0700
From: "Le_T" <t.poisot@gmail.com>
Subject: Re: word replacement
Message-Id: <1149589005.575093.268460@c74g2000cwc.googlegroups.com>
Dr.Ruud wrote:
> t.poisot@gmail.com schreef:
>
>
> fup set to clpm
>
> > I'm currently working on a little script wich will look for acronyms
> > in a file, and then replace them by the html acronym tag.
> >
> > I have a text file to read, and two tables ( @mot and @remplacement )
> > containing respectively the words and the html code.
> >
> > I use the following code :
> >
> > sub parse_ligne
> > {
> > my $ligne = $_;
> > for ( my $i = 0 ; $i < $dictionnaire_taille-1 ; $i++ )
> > {
> > if ($ligne =~ m/$mot[$i]/gi)
> > {
> > $ligne =~ s/$mot[$i]/$remplacement[$i]/gi;
> > }
> > }
> > //print $ligne;
> > print `echo $ligne >> $path_sortie`;
> >
> > }
> >
> > But
> > - Acronyms are not replaced
> > - Only the last line of the file is printed out in the output file
> >
> > Does anybody have any idea on how to get rid of that ?
>
> That is not code that we can run. Please read the Posting Guidelines.
> Cross-posting to clp-misc and clp-moderated, is a bad idea.
>
>
> You can run this code on itself:
>
> =================
> #!/usr/bin/perl
> # Search & Replace demo
> use strict ;
> use warnings ;
>
> my @sr ;
> while ( <DATA> ) {
> chomp ;
> push @sr, [ split /,[[:blank:]]*/ ] ;
> }
>
> while ( my $line = <> ) {
> $line =~ s/\b\Q$$_[0]\E\b/$$_[1]/gi for @sr ;
> print $line ;
> }
>
> __DATA__
> initial, primary
> 1st, first
> 2nd, second
> 3rd, third
> first, initial
> =================
>
> Save it as sr-demo.pl and run
> perl sr-demo.pl < sr-demo.pl
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."
I'm sorry, am not very aware of usenet practices... ;s
I think the problem comes form my reg exp (and to be perfectly honnest,
I'd prefer solve the problem by myself, not just copy and paste another
code / that i won't be able to understand/ from a perl guru...)
However, I thank you a lot
If that is my regexp
:
$ligne =~ s/$mot[$i]/$remplacement[$i]/gi;
what is the problem ? Is it not uspposed to replace $mot[$i] by
$remplacement[$i] ?
is tehre any options i need to add at the end ?
------------------------------
Date: Tue, 6 Jun 2006 16:41:15 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: word replacement
Message-Id: <e64bgt.mc.1@news.isolution.nl>
Le_T schreef:
> I'm sorry, am not very aware of usenet practices... ;s
The Posting Guidelines for this group are regularly posted in this
group.
news:44852d21$0$50706$ae4e5890@news.nationwide.net
> I think the problem comes form my reg exp
> $ligne =~ s/$mot[$i]/$remplacement[$i]/gi;
>
> what is the problem ? Is it not uspposed to replace $mot[$i] by
> $remplacement[$i] ?
You showed a strange looking function pars_ligne() that was not used in
your code.
First post the minimal, but complete, code that doesn't do what you
expect it to, so that we can check it.
Alternative: ask questions about the code in my version.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9257
***************************************