RE: Calling a module within another module

2001-09-18 Thread Dianne Van Dulken


Please ignore my previous problem. 

I was introduced to a function called Exporter.  Not sure how general it is,
but for those who want to know, this is the syntax

use Exporter;
@ISA= 'Exporter';
@EXPORT = qw (&showdays
  &showmonths
  &showyears
 );

sub showdays 

etc..

Cheers

Di 

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




Re: searching for a few things

2001-09-18 Thread Brett W. McCoy

On Tue, 18 Sep 2001, Tyler Longren wrote:

> Can I do something like this:
> my @array;
> while () {
>   chomp;
>   push (@array, $_)
>   if m/AAA/i;
>   print "Reading logs...\r";
> }
>
> but have it search for more than one string (AAA being that one string)?
> I'd like to search for AAA, BBB, and CCC and have all results be put into
> @array.

push(@array, $_) if /AAA|BBB|CCC/i;

-- Brett
  http://www.chapelperilous.net/

If the grass is greener on other side of fence, consider what may be
fertilizing it.


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




searching for a few things

2001-09-18 Thread Tyler Longren

Hello,

Can I do something like this:
my @array;
while () {
  chomp;
  push (@array, $_)
  if m/AAA/i;
  print "Reading logs...\r";
}

but have it search for more than one string (AAA being that one string)?
I'd like to search for AAA, BBB, and CCC and have all results be put into
@array.

Thanks everyone,
Tyler


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




Calling a module within another module

2001-09-18 Thread Dianne Van Dulken

Hi, I have a bit of a problem, that I am SURE there must a simple solution
for, but I can't work it out.
 
I have a very simple module which just contains some subroutines to return a
drop down list of days of the month, with the current day selected.  This is
going to be used in a few spots, so I wanted to put it in a nice central
area.
 
There is another module, that takes the results of subroutines (always a
string) and replaces variables on a HTML template with them.
 
It calls it by requiring the replace variable and the subroutine:  eg
 
MID => [\&returnme, $merchant_id]  where MID is the variable being replaced,
returnme is the subvariable, and $merchant_id is a variable the function
needs.
 
This works fine whenever the sub is within my perl script, but for all the
ones in my third party module, it falls over with a "no a code reference"
 
It is probably how I am calling it, but I can't work out how!  I have
 
StartDay => [\DropDates::showdays, "startday", "19"] where DropDates is the
name of the module, and showdays is the sub I want.
 
I've also tried DropDates::&showdays, but that also doesn't work.
 
Any ideas?  I'm using strict in all modules, and I can't change the HTML
template module, as it is not my property.
 
Thanks!
 
Di

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




assigning complex data into a hash (of hashes?)

2001-09-18 Thread Sean Pfister

Hi,

I have a data file in which each line is an instance of an event (e.g. a
sale). The file contains info about where the event happened (the city,
state, country), the type of event (catalogue, telephone, in-store) and some
other classification data (cash, credit card, indentured labor, firstborn
child).

Data fields are:
timestamp
product_name
geo1 (e.g San Francisco)
geo2(e.g. California)
geo3 (e.g. usa)
geo4(West)
type1 (store)
type 2 (cash, etc.)


So, if there were 5 sales in San Francisco, then there will be 5 lines in
the text file.

I want to slurp in the whole file and put it in a hash structure of some
sort so I can count totals within each field.
e.g, print out a total of sales by State or by City or by region. I might
not know how many cities are in the field or how many state. The key will
always be the product_name field.


Do I need to make an array for each field, like this:

while (<$line>) {
($time, $product, etc.) = split(/,/,$line, 8);
push @{ $hash1{$product} }, $geo1;
push@{ $hash1{$product} }, $geo2;
etc.

and then count the number of entries by category later on, when I'm looping
through the appropriate array? (That is, for each  "city" in geo1, count
it--5 "San Francisco's" means 5 sales in SF.

I suspect that there's a better structure, which allows me to total the
counts for each field as I load it. And that I can use anonymous arrays to
load in the whole thing once.

I'd very much appreciate any advice.

Best,

Sean








> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 18, 2001 3:24 PM
> To: [EMAIL PROTECTED]
> Subject: autovivification of typeglobs
>
>
> Gurus,
> The Camel ( 3rd Ed. ), says, on page 385-386
> sub TIEHANDLE {
> 
> open my $self, $from, @_ or croak "can't open $from@_:$!";
> 
> }
>
> and then,
> " ... the my $self furnishes undefined scalar to open, which knows to
> autovivify it into a typeglob.  " and further mentions
> autovivifying a
> scalar ($$$self), an array (@$$self) etc.
> I have read and reread the above and related typeglob material many times
> but somehow I don't understand what is going on here. If $self is a
> reference then, the above should read $$self, @$self etc. What is the
> extra $ doing in there? Any help in taking apart the above expressions?
> Also, could somebody give any online pointers (: references :), that
> describe Typeglobs, in more detail?
>
> - Thanks in advance,
> Atul
>
>
> --
> 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]




Re: autovivification of typeglobs

2001-09-18 Thread Jeff 'japhy/Marillion' Pinyan

On Sep 18, [EMAIL PROTECTED] said:

>open my $self, $from, @_ or croak "can't open $from@_:$!";

>" ... the my $self furnishes undefined scalar to open, which knows to 
>autovivify it into a typeglob.  " and further mentions autovivifying a 

When you use an undefined value as a reference, Perl creates that
reference for you automatically.  THAT is autovivification.  Thus, when
you do:

  my $x;
  $x->{foo} = 10;
  $x->{bar}[5] = 20;

You've autovivified $x as a hash reference from the second line, and
autovivified $x->{bar} as an array reference on the third line.

When you do:

  open my($foo), $path;

Perl is expecting a typeglob.  If you give it an undefined value, it
autovivifies the typeglob reference, so *$foo is the filehandle.  However,
references to filehandles are accepted wherever a filehandle is, so you
can just use $foo and get away with it.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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




autovivification of typeglobs

2001-09-18 Thread Atul_Khot

Gurus,
The Camel ( 3rd Ed. ), says, on page 385-386
sub TIEHANDLE {

open my $self, $from, @_ or croak "can't open $from@_:$!";

}

and then,
" ... the my $self furnishes undefined scalar to open, which knows to 
autovivify it into a typeglob.  " and further mentions autovivifying a 
scalar ($$$self), an array (@$$self) etc. 
I have read and reread the above and related typeglob material many times 
but somehow I don't understand what is going on here. If $self is a 
reference then, the above should read $$self, @$self etc. What is the 
extra $ doing in there? Any help in taking apart the above expressions?
Also, could somebody give any online pointers (: references :), that 
describe Typeglobs, in more detail?

- Thanks in advance,
Atul


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




Re: Sending attachments in email

2001-09-18 Thread The Coastal Trading Post

Hi,

I've been wrestling with that same beast. I don't have it all figured out yet
but was able to get an attachment emailed with the MIME::Entity module. Check
CPAN - the documentation and example given were pretty useful to me and I know
nearly nothing about perl.

Dhiraj Rustagi wrote:

> Hello,
>
> I am using sendmail module to send emails but now I have a new requirement
> to send two attachments in the email which a user has attached in the form.
> I don't think sendmail has a capability to do that. What options do I have
> where I don't have to install a third party product?
>
> Thanks in advance,
>
> Dhiraj


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




Re: Removing duplicate PATH entries?

2001-09-18 Thread Paul Johnson

On Tue, Sep 18, 2001 at 04:08:45PM -0700, Randal L. Schwartz wrote:

> Paul> The script I use to do this is
> 
> Paul>   print join ":", grep !$seen{$_}++, split ":", $ENV{shift}
> 
> No it isn't.  Unless you are literally looking at $ENV{'shift'}.
> 
> You want $ENV{+shift} or $ENV{shift()}.

Bah!  You're right of course.  The actual script is

  print join ":", grep !$seen{$_}++, split ":", $ENV{shift || PATH}

and I don't use strict or warnings.

There's probably a lesson or three in there somewhere.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: Problems with @INC and CPAN

2001-09-18 Thread Michael Fowler

On Tue, Sep 18, 2001 at 02:44:35PM -0400, Michael D. Risser wrote:
> I'm having a little difficulty with @INC, a script I'm trying to run, 
> actually part of bugzilla, says it can't find DBI.pm in @INC, I've manually 
> searched those directories and can't find it, but CPAN says DBI.pm is up to 
> date.

The perl you're using with bugzilla is different from the perl you're using
to install modules.  I don't recall, does bugzilla use mod_perl, or simply
CGI scripts?  If the former (mod_perl) then you need to recompile mod_perl
to use the more recent libperl.so; if the latter (CGI script) your shebang
lines are likely to blame.  You can either fix the shebang lines, or fix the
perl they're pointing to to point to the correct perl.  For example, if they
all say "#!/usr/local/bin/perl" and /usr/local/bin/perl is 5.00503, and
/usr/bin/perl is 5.6.1, replace /usr/local/bin/perl with a symlink to
/usr/bin/perl.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: For list admin

2001-09-18 Thread Michael Kelly

On 9/18/01 10:54 AM, chris morris wrote:

> Could the list admin please contact me off-list.  Thank you.

Oh, boy. Please not this again. I suggest that you look at the bottom of
your own message for your answer.


-Michael Kelly
Email: [EMAIL PROTECTED]
The Web: http://jedimike.hypermart.net




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




Re: POE

2001-09-18 Thread Alfred Vahau

Hello,

I experienced similar error messages and found that the solution
involved the following steps:

1. visit www.cpan.org to download the missing module.
2. unarchive the module according to the prescribed instructions and
3. made sure that the module was in the perl directory.

So either you do not have the Call.pm module yet or if you already have,
it is not in the correct path. Usually the author of perl modules
specify which other modules that they incorporate.

I hope this helps.

A.K.Vahau
SNPS
Uni. PNG
email: [EMAIL PROTECTED]



> Hi,
> 
> I've tried to setup POE on my computer but I can't seem to set it up
> correctly. I'm running ActivePerl v5.6 on a Windows 2000 PC.
> 
> I got the following error message when I tried to use it.
> 
> c:\>perl
> use POE;
> Can't locate Filter/Util/Call.pm in @INC (@INC contains: C:/Perl/lib
> C:/Perl/site/lib .) at c:/Perl/lib/POE/Preprocessor.pm line 7.
> 
> Can anyone help me with it ? 
> 
> Thanks.
> 
> Zhe
>

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




Problems with @INC and CPAN

2001-09-18 Thread Michael D. Risser

I'm having a little difficulty with @INC, a script I'm trying to run, 
actually part of bugzilla, says it can't find DBI.pm in @INC, I've manually 
searched those directories and can't find it, but CPAN says DBI.pm is up to 
date.

Any ideas on how to fix this???
-- 
Michael D. Risser
Software Engineer
=
Machine Vision Products, Inc.
www.visionpro.com
[EMAIL PROTECTED]

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




Re: Removing duplicate PATH entries?

2001-09-18 Thread Jason Tiller

Hi, Jeff, :)

On Mon, 17 Sep 2001, Jeff 'japhy/Marillion' Pinyan wrote:
> On Sep 17, Jason Tiller said:

> >2) Duplicate path entries must be removed from the *tail*, not the
> >   head of the path.

> Then reverse the string, screw around with it, and reverse it again.

Got it.  Worked perfectly!  I'm still amazed at that.  The
look(ahead|behind) stuff is *powerful*.  Still trying to get my brain
around some of it...

Thanks!

---Jason Tiller
[EMAIL PROTECTED]


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




RE: Removing duplicate PATH entries?

2001-09-18 Thread Wagner Jeff Civ Northrop Grumman/TTMS

JT>> First off, is this the right way to go about this?  I know this isn't
JT>> a shell list, but I'm assuming that the perl script can't actually
JT>> *change* the PATH in the parent process - only for its own process.
JT>> Right?

PJ> Right.  Nothing can change the parent's environment.

How about changing the registry entry from which future processes get their
path value?

"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment\Path"

Would that have merit?

Just an idea...
Jeff


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




Re: Removing duplicate PATH entries?

2001-09-18 Thread Jason Tiller

Hi, Paul, :)

On Tue, 18 Sep 2001, Paul Johnson wrote:
> On Mon, Sep 17, 2001 at 03:25:20PM -0700, Jason Tiller wrote:

> > I'm trying to write a short script to remove duplicate entries in
> > my PATH variable.

> The script I use to do this is
>
>   print join ":", grep !$seen{$_}++, split ":", $ENV{shift}

Ah, *smooth*.  Gotta get comfortable with those 'grep' and 'map'
functions...

Thanks for the tip!  That's great stuff.

---Jason Tiller
[EMAIL PROTECTED]


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




Re: Index of foreach

2001-09-18 Thread Andrea Holstein

"Brett W. McCoy" wrote:
> 
> Then you can use 'for(my $i = 0; $i < @array; $i++)'.  In your example
> above, you are incrementing $i twice (first postincrement, then
> preincrement).  It doesn't make sense (to me, at least) to have an index
> counter, and then still assign the array element to a temp variable.
> Just loop through the array with the counter and use the array directly.
> 

Right.

Greetings,
Andrea

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




OpenSSL Interface

2001-09-18 Thread Nael Mohammad

Does anyone know how to invoke OpenSSL in perl in a web base form?

Nael Mohammad
Neomar, Inc.
[EMAIL PROTECTED]

"When Wireless Means Business"


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




POE

2001-09-18 Thread Zhe Hong

Hi,

I've tried to setup POE on my computer but I can't seem to set it up correctly. I'm 
running ActivePerl v5.6 on a Windows 2000 PC.

I got the following error message when I tried to use it.

c:\>perl
use POE;
Can't locate Filter/Util/Call.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib 
.) at c:/Perl/lib/POE/Preprocessor.pm line 7.

Can anyone help me with it ? 

Thanks.

Zhe



For list admin

2001-09-18 Thread chris morris

Could the list admin please contact me off-list.  Thank you.

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




Re: Help with regex

2001-09-18 Thread Rasoul Hajikhani

Curtis,
thanks for your email. My $args is just a string. Would that make any
difference?
-r

Curtis Poe wrote:
> 
> --- Rasoul Hajikhani <[EMAIL PROTECTED]> wrote:
> > Hi there,
> > I am trying to match an expression that would perform different tasks
> > depending on the returned value:
> >
> >   #if (arguments begin with " } else  {
> print "Not and HREF: $args";
> }
> }
> __DATA__
> 
> 
> 
> 
> 
> Knowing how your data gets into the system is at least as important as how your data 
>leaves the
> system.  Knowing your data source allows you to craft a better solution to the 
>problem.  For
> example, consider your regex:
> 
> /^\ 
> What is the source of the data?  Is it generated by another process or could humans 
>affect it?
> There are several places where you can insert whitespace into that anchor tag, have 
>valid HTML,
> and cause your regex to fail.  Here's an example which will break code *and* mine:
> 
>   href=
>  "somefile.html"
> >
> 
> That's annoying, but some of the documents I get have HTML formatted like that.  
>Also, you don't
> need the dot star at the end.  You don't use that information and forcing the regex 
>engine to
> match it is wasteful.
> 
> I would recommend learning to use HTML::TokeParser or a similar module to parse 
>HTML.  If you are
> only extracting links, try HTML::LinkExtor.
> 
> Cheers,
> Curtis "Ovid" Poe
> 
> =
> Senior Programmer
> Onsite! Technology (http://www.onsitetech.com/)
> "Ovid" on http://www.perlmonks.org/
> 
> __
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
> http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re: Help with regex

2001-09-18 Thread Curtis Poe

--- Rasoul Hajikhani <[EMAIL PROTECTED]> wrote:
> Hi there,
> I am trying to match an expression that would perform different tasks
> depending on the returned value:
> 
>   #if (arguments begin with "




Knowing how your data gets into the system is at least as important as how your data 
leaves the
system.  Knowing your data source allows you to craft a better solution to the 
problem.  For
example, consider your regex:

/^\

That's annoying, but some of the documents I get have HTML formatted like that.  Also, 
you don't
need the dot star at the end.  You don't use that information and forcing the regex 
engine to
match it is wasteful.

I would recommend learning to use HTML::TokeParser or a similar module to parse HTML.  
If you are
only extracting links, try HTML::LinkExtor.

Cheers,
Curtis "Ovid" Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re: Index of foreach

2001-09-18 Thread Rasoul Hajikhani

Thanks for all the help :)


"Brett W. McCoy" wrote:
> 
> On Tue, 18 Sep 2001, Andrea Holstein wrote:
> 
> > > On Tue, 18 Sep 2001, Andrea Holstein wrote:
> > >
> > > > Try
> > > > for (my $i=0, my $var = $array[$i]; $i < @array; $i++, $var =
> > > > $array[++$i]) {
> > > >...
> > > > }
> > >
> > > Good Heavens!  Why would you go to all of that trouble when a simple
> > > foreach will do?
> > >
> > You're right,
> > but
> > foreach my $var (0..$#array) {
> >   ...
> > }
> >
> > has to create a new list (0..$#array) of the same size as @array.
> 
> Then you can use 'for(my $i = 0; $i < @array; $i++)'.  In your example
> above, you are incrementing $i twice (first postincrement, then
> preincrement).  It doesn't make sense (to me, at least) to have an index
> counter, and then still assign the array element to a temp variable.
> Just loop through the array with the counter and use the array directly.
> 
> -- Brett
>   http://www.chapelperilous.net/
> 
> Your CHEEKS sit like twin NECTARINES above a MOUTH that knows no BOUNDS --
> 
> --
> 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]




Help with regex

2001-09-18 Thread Rasoul Hajikhani

Hi there,
I am trying to match an expression that would perform different tasks
depending on the returned value:

#if (arguments begin with "

Win32::NetAdmin::UserCreate() Problems!

2001-09-18 Thread David Simcik

Hello again,
I'm working with ActiveState Perl and am trying to make use of a Win32 call
to create new users. I'm not having much success. Every time my sub runs it
returns this error: "Overlapped I/O operation is in progress". I am using
the function Win32::NetAdmin::UserCreate(). I setup IIS to operate with
local Admin priv's for the application directory my CGI script resides in.
Any ideas???

Here's my code snippet:

#Create new user
(!createNewUser($user, $pass))? print "Could not create new local user
account!: $^E" : print "Created user account!";

sub createNewUser
{
my ($user, $pass) = @_;

%account = {
homedir => ' ',
priv=>  USER_PRIV_USER,
flags   => UF_SCRIPT | UF_NORMAL_ACCOUNT,
fullname=> $user,
comment => ' ',
logon   => ' '
};

#first, check to see if user account exists for some bizarre reason
#if (! Win32::NetAdmin::UsersExist('', $user))
#{
if (Win32::NetAdmin::UserCreate ('0050DA8430C4', $user, $pass, 0,
$account{privs}, $account{homedir}, $account{comment}, $account{flags},
$account{logon}) )
{
return 1;
}
else #account creation failed
{
return ;
}

#}
}


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




make sense?

2001-09-18 Thread P lerenard

I try to explain,
i'm on unix.
it is an intranet program, so everybody who are going to use this program 
are behind the same firewall than me + the prog run on server.
I allow people do access some data asking for their ip, the ip is still the 
same, but somebody can change the ip on their computer and access the 
program.
if I understand I can double check by knowing from where the ip is coming 
because the guy who changed his ip on is computer still as to go throught 
another server, so by reading the server name I can block this address.
but getservbyname doesn't seem to be the function to do it and there is no 
explanation on the internet about this function and nothing about any 
function coming from http://www.perldoc.com/perl5.6/pod/perlfunc.html 
Fetching network info

Thank you for your help
I don't have any code, it still an idea

Pierre

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




pls troubleshoot

2001-09-18 Thread Sunthari

Dear List,

I'm quite a beginner to Perl (it's going to be almost
2 mths).I've written the following codes and I can't
seem to get the correct output where user's can choose
their search engine for search. Pls correct me since I
really lost.

Secondly, I want to use the HTML::TreeBuilder to read
the search results and pick up the lines with the
search terms. How should I go abt it?

Should I put the search results from e.g  till
 into HTML::TreeBuilder and do a match to pick
the lines?  Any suggestions/comments to this?

Thanks in advance. Hope to hear a.s.a.p

Rgds,




 webexample.pl

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


Re: nobody knows!?

2001-09-18 Thread Brett W. McCoy

On Tue, 18 Sep 2001, P lerenard wrote:

> i'm behind a firewall and I want to get the name of the server related to
> the program(I know it, but how my progran can know it), so people coming
> from another server would be blocked.

Can you provide more details on what you're trying to do?  Where is the
program running?  Is this an CGI script?

-- Brett


Military intelligence is a contradiction in terms.
-- Groucho Marx


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




RE: nobody knows!?

2001-09-18 Thread John Edwards

Can you explain more clearly what you are after? Are you running a CGI
script? Is the other machine behind the firewall as well? Do you have any
example code you can post? What OS are you running?

-Original Message-
From: P lerenard [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2001 16:20
To: [EMAIL PROTECTED]
Subject: nobody knows!?


Hi,

i'm behind a firewall and I want to get the name of the server related to 
the program(I know it, but how my progran can know it), so people coming 
from another server would be blocked.

Thank you

don't worry is going to be my last question on this subject because it seems

that nobody can answer.

Pierre


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




nobody knows!?

2001-09-18 Thread P lerenard

Hi,

i'm behind a firewall and I want to get the name of the server related to 
the program(I know it, but how my progran can know it), so people coming 
from another server would be blocked.

Thank you

don't worry is going to be my last question on this subject because it seems 
that nobody can answer.

Pierre


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




RE: RegExp Problem...

2001-09-18 Thread Bob Showalter

> -Original Message-
> From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 18, 2001 9:57 AM
> To: David Simcik
> Cc: Perl Beginners
> Subject: Re: RegExp Problem...
> 
> 
> On Sep 18, David Simcik said:
> ...
> > if($id =~ m/^.+_.+$/i)
> 
> You're doing too much work here.  Just use the regex
> 
>   if ($id =~ /_/)

And if the underscore needs to be surrounded by other chars,
the regex

   /._./

should work as well.

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




Re: RegExp Problem...

2001-09-18 Thread Jeff 'japhy/Marillion' Pinyan

On Sep 18, David Simcik said:

>sub isFacStaff
>{
>   my $id = @_;

This is the error:  assignment of an array to a scalar returns the number
of elements.  You want want one of the following:

  my $id = shift;
  my ($id) = @_;
  my $id = $_[0];

>   if($id =~ m/^.+_.+$/i)

You're doing too much work here.  Just use the regex

  if ($id =~ /_/)

instead of working on the entire string.  Also, you can write:

  return $id !~ /_/;

which will return true or false.  Since you want the OPPOSITE value, I've
used !~ instead of =~ here.

Finally, you don't really need a regex in this case:

  return index($id, '_') == -1;  # -1 means not found

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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




Re: RegExp Problem...

2001-09-18 Thread Brett W. McCoy

On Tue, 18 Sep 2001, David Simcik wrote:

> Hi folks,
>   I'm stumped...I wrote a test script and this pattern matches just fine, but
> when I try to use it in another script it does match as it should.
> Basically, if the pattern detects an _ underscore in the string it should
> return undef; if it doesn't match it returns true. Here's some code:
>
> if(isFacStaff('xty_1233'))
> {
>   print "Is Faculty/Staff!\n";
> }
> else
> {
>   print "Is Student!\n";
> }

I'm not sure why you need a separate subroutine here, since the regular
expression returns true or false already and can be used directly in the
if statement.  At any rate, if you are just checking to see if there is an
underscore in the string, then just test for that:

$id = 'xty_1233';
if($id =~ /_/) { print "Is Faculty/Staff!\n" }
else { print "Is Student!\n" }

You can make this even more succint by using the trinary operator (?:),
but I'll leave tht as an exercise for the reader.

-- Brett
  http://www.chapelperilous.net/

They call them "squares" because it's the most complicated shape they can
deal with.


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




RegExp Problem...

2001-09-18 Thread David Simcik

Hi folks,
I'm stumped...I wrote a test script and this pattern matches just fine, but
when I try to use it in another script it does match as it should.
Basically, if the pattern detects an _ underscore in the string it should
return undef; if it doesn't match it returns true. Here's some code:

if(isFacStaff('xty_1233'))
{
print "Is Faculty/Staff!\n";
}
else
{
print "Is Student!\n";
}


sub isFacStaff
{
my $id = @_;

#this will match student-style ID's
#it is rather easier to match against student IDs than staf IDs
if($id =~ m/^.+_.+$/i)
{
return;
}
else
{
return 1;
}
}

Thanks in advance for any help!
DTS


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




Re: Date (Localtime)

2001-09-18 Thread Mellotto

Bob,


Tks a lot.


Cheers,
Mellotto.


"Bob Showalter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > -Original Message-
> > From: Mellotto [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 17, 2001 3:47 PM
> > To: [EMAIL PROTECTED]
> > Subject: Date (Localtime)
> >
> >
> > Hi Folks,
> > When I execute:
> >
> > $hora = exec('date +%y%m%d%H%M%S ');
> > print " $$hora\n ";
>
> Er, that print line isn't being executed. Good thing, because
> it's wrong. Enable warnings to catch this kind of thing.
>
>perldoc -f exec
>
> >
> > I have the output in the following format (YYMMDDHHMMSS):
> > 010917162026
> >
> > How I could make to show the previous day?
>
> Use POSIX strftime(), localtime(), and time():
>
>use POSIX qw(strftime);
>$hora = strftime('%y%m%d%H%M%S', localtime(time - 86400));
>print "$hora\n";



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




Re: regarding win32 functions

2001-09-18 Thread Jos I. Boumans

you can discriminate by OS if that helps you:

$^O will hold the name of the operating system you're running on
(alltho i think it'll probably be in %ENV somewhere too)

so something like this might work:

BEGIN: { use Win32 if $^O eq 'MSWIN32' } #or whatever it's called again

depending on the context of which you are writing this, many options are
possible.

you could have 2 different files holding os-specific methods to use
depending on the OS
or you could eval the statements, trapping errors as they might come up
or just write 2 completely different programs.

all depends on what you need

hth
Jos


- Original Message -
From: "jaya kumaran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 18, 2001 11:56 AM
Subject: regarding win32 functions


> Hi,
>
>   i have used
>
>   use win32::process() statement
>
>   This statement is used only for NT ie using if statement. In NT, this is
used to kill a process. But when the same code is taken to UNIX, it is
giving compilation error. Ie, its searching for Wind32 libraries in UNIX
which is not existing. How to resolve this problem??
>
>   Is there a facility in perl to have preprocessor statement.
>
> Thanks,
> Jaya
> --
>
> ___
> Get your free email from http://www.indiya.com
>
>
> Powered by Outblaze
>
> --
> 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]




regarding win32 functions

2001-09-18 Thread jaya kumaran

Hi,

  i have used

  use win32::process() statement

  This statement is used only for NT ie using if statement. In NT, this is used to 
kill a process. But when the same code is taken to UNIX, it is giving compilation 
error. Ie, its searching for Wind32 libraries in UNIX which is not existing. How to 
resolve this problem??

  Is there a facility in perl to have preprocessor statement.

Thanks,
Jaya 
-- 

___
Get your free email from http://www.indiya.com


Powered by Outblaze

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